help-make
[Top][All Lists]
Advanced

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

RE: how to do recursive "subsystem" make properly?


From: Mark Galeck (CW)
Subject: RE: how to do recursive "subsystem" make properly?
Date: Tue, 3 Nov 2009 16:16:02 -0800

>The sentinel file has to be created: it has to exist.  A non-existent
file is always considered out of date.  If it exists but then is not
updated, THEN it is not considered out of date.


Yes - I did have it created, and still it did not work, just like I explained.  


So, in my last message (before this one) I actually posted a short example of 
what I am trying to accomplish - so that it is precise.  That example can be 
solved with the use of FORCE target as Paul described earlier.  But of course, 
I do have more targets than one in the submakefile.  


So then, I finally got it to work by combining two of Pauls suggestions, the 
sentinel and the FORCE:

top makefile is


foobar: subdir/sentinel 
                echo making foobar
                touch foobar
subdir/sentinel: FORCE
                $(MAKE) -C subdir
FORCE: ;


bottom makefile is

.PHONY: all
all: foobaro foobazo
sentinel: all

foobaro:  foobarc
                touch foobaro
                echo making foobaro
                touch sentinel
                
foobazo:  foobazc
                touch foobazo
                echo making foobazo
                touch sentinel


Now, if I touch foobarc or foobarz, then and only then foobar gets rebuilt!  
Great, finally I got it!  


Except...  there is still one little problem.  When foobar does not get 
rebuilt, we would like some kind of message to the user, indicating that fact, 
such as "nothing to be done for foobar". And that message has to be after the 
subdir messages.  How in the world do I do this?? 

Mark






reply via email to

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