Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Feb 2005 06:53:03 +0200
From:      Giorgos Keramidas <keramida@hellug.gr>
To:        Jonathon McKitrick <jcm@FreeBSD-uk.eu.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Example BSD Makefiles *outside* the src tree??
Message-ID:  <20050208045303.GA24803@igloo.linux.gr>
In-Reply-To: <20050205172727.GA26430@dogma.freebsd-uk.eu.org>
References:  <20050205142225.GA11546@dogma.freebsd-uk.eu.org> <44u0oqylar.fsf@be-well.ilk.org> <20050205172727.GA26430@dogma.freebsd-uk.eu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-02-05 17:27, Jonathon McKitrick <jcm@FreeBSD-uk.eu.org> wrote:
>On Sat, Feb 05, 2005 at 12:21:48PM -0500, Lowell Gilbert wrote:
>>Jonathon McKitrick <jcm@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 \
		beta

	.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:

	/proj/foo/alpha/Makefile
	/proj/foo/beta/Makefile

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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050208045303.GA24803>