[geeks] non-recursive make

der Mouse mouse at Rodents.Montreal.QC.CA
Wed Nov 9 20:57:39 CST 2005


>> When I'm not nesting projects, I use the "single Makefile multiple
>> source" method all the time.
> Are your Makefiles portable?  I'd like to see one if you don't mind.

I'm not the person you're responding to, but I tend to build multiple
programs in a directory with relatively simple Makefiles (though the
included file is rather complex).

For example, here is the Makefile for a directory containing two
programs, each of which is built from a single .c file and has a
manpage; one of the .c files is built from lex source.  (The OBJ_*
lines are actually redundant; this Makefile is nearly 8 years old.)

	BUILDBINS = char-to-code code-to-char
	OBJ_char-to-code = char-to-code.o
	OBJ_code-to-char = code-to-char.o
	INSTALLMAN = char-to-code.1 code-to-char.1
	
	.MAIN: $(BUILDBINS) $(INSTALLMAN:C/1$/cat1/)
	
	code-to-char.c: code-to-char.lex
	        $(LEX) -o$(.TARGET) $(.ALLSRC)
	CLEANFILES += code-to-char.c
	
	.include <local-prog>

All the hair is in <local-prog>.  You can fetch it by FTP; get
ftp.rodents.montreal.qc.ca:/mouse/local/src/makefiles/makefiles-20030721/local-prog
if you're interested.

Is it portable? It depends on having a BSD make, but I *think*
everything I've done should work onj pretty much any BSD make.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse at rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B



More information about the geeks mailing list