[geeks] non-recursive make

Sridhar Ayengar ploopster at gmail.com
Wed Nov 9 12:03:35 CST 2005


Charles Shannon Hendrix wrote:
> For years, I have used recursive make to build projects, but have always
> hated it.  It is an ugly hack and gets messy rather quick.
> 
> I would like to know if any of you know any good references to using
> single make files to build projects, while still using a hierarchy for
> source organization.
> 
> I have read the paper "Recursive Make Considered Harmful" but really
> didn't get enough ideas out of it.
> 
> I'd like to try moving some projects to a non-recursive build, so any
> pointers to references or sources already set up that way would be a big
> help.
> 
> Note: In case it isn't obvious, I'm not looking for a make tutorial or
> how to build in a single dir, I mean this kind of setup:
> 
>     project/
> 	Makefile
> 	util/
> 	    blah.c
> 	    blah.o
> 	net/
> 	    net.c
> 	    net.o
> 	bin/
> 	    final_binary
> 
> ...rather than the traditional method:
> 
>     project/
> 	Makefile
> 	util/
> 	    Makefile
> 	    blah.c
> 	    blah.o
> 	net/
> 	    Makefile
> 	    net.c
> 	    net.o
> 	bin/
> 	    Makefile
> 	    final_binary
> 
> ...where the master Makefile calls the others recursively.

When I'm not nesting projects, I use the "single Makefile multiple 
source" method all the time.  It works fine.  I usually just maintain a 
list of source files and object file targets in a variable.

Peace...  Sridhar



More information about the geeks mailing list