[Top][All Lists]

[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 

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


I have a build system that has a top level makefile and includes
multiple makefile fragments ( from each source subdirectory.
   I want the build to only rebuild the objects if the corresponding
source file or file has been touched.
eg. source tree

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)/
build/%.o : src/%.c $(dir src/%.c)
build/%.o : src/%.c $(dir src/$*.c)

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.
Brendan Simon.

Help-make mailing list

reply via email to

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