help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make with another make as a prerequisite


From: Henrik Carlqvist
Subject: Re: Make with another make as a prerequisite
Date: Sat, 03 Mar 2007 23:13:58 +0100
User-agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.)

"crjjrc" <crjjrc@gmail.com> wrote:
> Henrik Carlqvist <Henrik.Carlqv...@deadspam.com> wrote:

>> all: myprog
>>
>> myprog: mysrc.c ../lib/mylib.a
>>         gcc -o $@ $^
>>
>> ../lib/mylib.a: FORCE
>>         cd ../lib && $(MAKE)
>>
>> # Used to force some rules to always be compiled
>> FORCE: ;

> I'm not sure I quite understand why it works though.  The prerequisite
> is always checked for out-of-date in and of itself, and not if any of
> the prerequisite's prerequisites cause its commands to be run?  That
> is, even though mylib.a always has its commands run, only when the
> file's modification time (or mysrc.c's) changes is myprog rebuilt?

As the above Makefile doesn't know anything about the prerequisites of
mylib.a it cant tell if anything needs to be compiled to create mylib.a.
Instead it trusts another Makefile to take care of creating mylib.a. The
other Makefile is allways called. Sometimes it does some work, sometimes
it might only say something like "nothing to be done for mylib.a".

Once the other Makefile is finished the Makefile above checks the
timestamps of mylib.a and mysrc.c. If any of those timestamps are newer
than myprog it will rebuild myprog.

regards Henrik
-- 
The address in the header is only to prevent spam. My real address is:
hc1(at)poolhem.se Examples of addresses which go to spammers:
root@localhost postmaster@localhost



reply via email to

[Prev in Thread] Current Thread [Next in Thread]