merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) (04/29/89)
In article <477@front.se>, zap@front (Svante Lindahl) writes: | In article <459@front.se>,I wrote: | [ The target, a library, should be removed and rebuilt if the makefile | has been updated. ] | | > Makefile: FRC | > -@if newer Makefile $(TARGET) ; then rm -f $(TARGET); fi | ... | | I got some good suggestions from Rich $alz on how to avoid the need | for the newer(1L) program. This is what it looks like: | | Makefile: FRC | -@if echo "Makefile: $(TARGET) ; @/bin/false" | make -qf - ; \ | then rm -f $(TARGET) ; fi | | Svante.Lindahl@front.se (!-net: ...!uunet!front.se!svante) | (non-mx: Svante.Lindahl%front.se@uunet.uu.net) Whoa, whoa, whoa. Why not just: $(TARGET):: Makefile -rm -f $@ $(TARGET):: fred.o barney.o wilma.o betty.o ar r $@ $? (Better have them in that order, though.) This is more along the spirit of Make. You are saying that TARGET depends on Makefile, so *say* it. -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095===\ { on contract to BiiN, Hillsboro, Oregon, USA, until 30 May 1989 } { <merlyn@intelob.intel.com> ...!uunet!tektronix!biin!merlyn } { or try <merlyn@agora.hf.intel.com> after 30 May 1989 } \=Cute quote: "Welcome to Oregon... home of the California Raisins!"=/
zap@front.se (Svante Lindahl) (05/02/89)
In article <4351@omepd.UUCP>, merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) writes: > Whoa, whoa, whoa. Why not just: > $(TARGET):: Makefile > -rm -f $@ > > $(TARGET):: fred.o barney.o wilma.o betty.o > ar r $@ $? Yes! A pair of double colon rules works nicely for this situation. Although I think the second rule should be: $(TARGET):: $(OBJECTS) ranlib $@ as suggested by Root Boy Jim in another posting, and Leo de Wit in a posting that didn't make it out, but which was mailed to me. Thank you, everybody! Svante