help-make
[Top][All Lists]
Advanced

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

how to do recursive "subsystem" make properly?


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

Hello,  I see the following recommendation for a “subsystem” recursive make in the gnu make manual:

 

subsystem:

             $(MAKE) -C subdir

 

 

Well, I must not be understanding something, because this does not make (no pun) sense to me… 

 

The problem I have, is that the “subsystem” target as above, will always be remaked, if only to execute make recursively and find out in fact, that everything was up to date in that subdirectory.  Then of course, everything up above, depending on the subsystem target, will also have to be remaked.  In other words, even if you don’t change anything, make will still take time to remake some things.  Clearly this is against the spirit of make. 

 

 

Now, I know what to do to try to prevent that:  for example if the first target in the subdir make is (non-.PHONY):

 

foobar.o: foobar.c

 

then I could put in the upper directory, instead of the above target “subsystem”, the following:

 

subdir/foobar.o: subdir/foobar.c

        $(MAKE) –C subdir foobar.o

 

 

OK, but you see, if foobar.c depended on something else, then again  I would have to include that, prepended with “subdir/” in the upper directory.  And so forth.  Essentially, I would have to include the whole subdir makefile, in the top level makefile, with all targets prepended with “subdir/”.

 

Clearly not the right thing to do. 

 

What am I missing here?    

 

Thank you for any insight. 

 

Mark

 


reply via email to

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