help-make
[Top][All Lists]
Advanced

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

RE: make dependency question


From: Fox, Brian E (Brian)
Subject: RE: make dependency question
Date: Thu, 13 Jun 2002 09:35:11 -0400

I had this same problem on a very large project here at Lucent. I wanted the 
top level make to know about all the subfolders, but I also wanted to be able 
to simply go to a folder and build just those sources exclusively to save time 
fixing build issues. My solution was to setup the parent make to include the 
makefiles for each of the subfolders. In the parent makefile, I have a list of 
the subfolders and I have a loop that builds the filename and includes each 
makefile. The subfolder makefiles include a common file that figures out how to 
handle the sources (it knows what to do when included and when being built 
directly). 

This turns out to work very well, but it would be very nice if make could 
handle this more gracefully.

-----Original Message-----
From: Brendan J Simon [mailto:address@hidden
Sent: Thursday, June 13, 2002 1:50 AM
To: make-help
Subject: make dependency question



Hi,

I have a build system that has a top level makefile and includes
multiple makefile fragments (module.mk) from each source subdirectory.
   I want the build to only rebuild the objects if the corresponding
source file or module.mk file has been touched.
eg. source tree
Makefile
src/foo/module.mk
src/foo/test1.c
src/foo/test2.c

I currently have the following generic rule in the Makefile.

build/%.o : src/%.c
      $(CC) -o $@ $(CFLAGS) $<

I was thinking something along the lines of:

build/%.o : src/%.c $(<D)/module.mk
or
build/%.o : src/%.c $(dir src/%.c)module.mk
or
build/%.o : src/%.c $(dir src/$*.c)module.mk

but none of these work.
Can anyone suggest another way of achieving the same thing.  I was
hoping to have a generic rule.

Please do reply-all to email me directly as well as the list.
Thanks,
Brendan Simon.





_______________________________________________
Help-make mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-make



reply via email to

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