Example BSD Makefiles *outside* the src tree??

Giorgos Keramidas keramida at hellug.gr
Mon Feb 7 20:52:33 PST 2005

On 2005-02-05 17:27, Jonathon McKitrick <jcm at FreeBSD-uk.eu.org> wrote:
>On Sat, Feb 05, 2005 at 12:21:48PM -0500, Lowell Gilbert wrote:
>>Jonathon McKitrick <jcm at FreeBSD-uk.eu.org> writes:
>>> does anyone know of any project out there I could get my hands on
>>> that use BSD make?  Obviously the src tree is not a good place to
>>> learn the basics, but most makefiles I run across are for GNU make
>>> and/or are too complex to learn the basics from.
>> There are many examples in the Tutorial, which I think you said (in
>> another message) that you had already read.  What are you looking
>> for that isn't in those examples?
> Setting up basic recursion (I can do it, but not the right way).
> Building library sonames and installing them correctly.

Recursion should be as easy as:

	% cd /proj/foo
	% cat Makefile
	SUBDIR=	alpha \

	.include <bsd.subdir.mk>

The Makefile files of /proj/foo/alpha and /proj/foo/beta will then be
'called' recursively to build the respective module parts.  Note that
the files:


will pull in any Makefile.inc you put in /proj/foo (yes, that is one
level higher than the Makefiles of the subdirs themselves).  This may
seem counter-intuitive at first, but it makes sense if you consider
the common Makefile.inc include file as "things common to all the
subdirs of /proj/foo".

Examples of this sort can be found in abundance in src/.  Just look at
the Makefile for src/bin/, src/usr.bin/, etc.

> Doing the above in a makefile that will run under GNU make.

I don't use gmake if I can avoid it.  Someone else should chime in
with gmake help, if they want.

More information about the freebsd-questions mailing list