Re: Make with another make as a prerequisite

Henrik Carlqvist <[email protected]>
Newsgroups gmane.comp.gnu.utils
Organization SunSITE.dk - Supporting Open source
Message-ID <[email protected]>
[email protected] wrote:
> I think I've found a simple enough solution to this problem.

I have another solution, but as you already have found a solution which
works you might not want to use my way:

-8<---------------------------------
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: ;
-8<---------------------------------

The above Makefile doesn't know anything about how mylib.a is made.
Instead it allways calls another makefile who has the responsibility to
update mylib.a if needed.

Only if mysrc.c or mylib.a has been updated myprog will be rebuilt.

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.