help-make
[Top][All Lists]
Advanced

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

Use result of sub-make as a prerequisite?


From: Nestor Amaya
Subject: Use result of sub-make as a prerequisite?
Date: Tue, 10 Feb 2004 23:55:24 -0500

Hello,

My question: Is there a way for the top-level make to use a sub-make to
check for whether test.db is up-to-date or not? 

Take this simple makefile:
#START Makefile
%.db :
        $(MAKE) -C db $@

all.log : test.db
        @echo remaking all | tee all.log
#END Makefile

Now assume that the sub-make within "db" dir is a complicated one, with many
checks, etc...

In my tests, "all.log" will be remade even if "test.db" is up to date,
because the top-level make doesn't know what the prereqs for "test.db" are,
and thus assumes that it must be remade.

I have tried using VPATH so that the top-level make "sees" db/test.db, but
then it never makes all.log even if test.db is out-of-date (since there are
no pre-reqs)...

I guess I could try to auto-generate the pre-reqs for test.db using the
sub-make, and then include them into the top-level make. But then I am
testing "test.db" twice to see if it is up-to-date... This seems clumsy and
inefficent.

Is there any other way? Your help is much appreciated.

Cheers,
Nestor




reply via email to

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