[geeks] non-recursive make

Jonathan C. Patschke jp at celestrion.net
Wed Nov 9 11:11:29 CST 2005


On Wed, 9 Nov 2005, Charles Shannon Hendrix wrote:

>    project/
> 	Makefile
> 	util/
> 	    blah.c
> 	    blah.o
> 	net/
> 	    net.c
> 	    net.o
> 	bin/
> 	    final_binary

Just have your Makefile reflect that structure:

O_FILES=util/blah.o net/net.o

bin/final_binary: ${O_FILES}

util/blah.o: util/blah.c

net/net.o: net/net.c

If you're using GNU make, that should be sufficient.  For vendors' makes
and BSD make, you may need to flash out that last rule saying exactly
how you want things linked.

> ...rather than the traditional method:
> ...where the master Makefile calls the others recursively.

I wouldn't call that traditional so much as I'd call it FSF nonsense.
Multiple makefiles in a single project only makes sense if the project
contains other projects (ie: some of the directories are libraries that
make just as much sense distributed separately).

-- 
Jonathan Patschke   )  "someone set us up the IRQL_NOT_LESS_OR_EQUAL."
Elgin, TX          (                                           --jimmy



More information about the geeks mailing list