Where to put common Makefile code

Dimitry Andric dim at FreeBSD.org
Sun Jan 12 14:43:32 UTC 2014


On 12 Jan 2014, at 11:25, Julio Merino <julio at meroh.net> wrote:
> 
> I have some common Makefile boilerplate code for both lib/atf/ and
> usr.bin/atf/ that I'm unsure about where to best put it.
> 
> The code in question is the definition of a set of useful variables
> and target rules that can be depended on where necessary to, e.g.
> obtain atf's version number from the files in contrib/atf/
> 
> The fragment is not "long enough" to be a big deal if it were
> duplicated in 3 different Makefiles, but obviously I'd prefer to avoid
> the copy/paste.
> 
> So where would you put this?

For an example (admittedly not the most elegant, but it works), have a
look at lib/clang/clang.build.mk, which contains the common make-related
bits for clang and llvm.  This is included by the clang and llvm
libraries (which live under lib/clang) via lib/clang/clang.lib.mk, and
by the clang and llvm programs (which live under usr.bin/clang) via
usr.bin/clang/clang.prog.mk.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20140112/254d1796/attachment.sig>


More information about the freebsd-hackers mailing list