Where to put common Makefile code

Julio Merino julio at meroh.net
Sun Jan 12 10:26:15 UTC 2014


Hello,

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?

An option that comes to mind is to add a Makefile.inc file to
contrib/atf/ that I can explicitly include.  But I'm not sure if that
makes sense because this file wouldn't come from the vendor branch.

Another option is to just stick the code in the existing
lib/atf/Makefile.inc (the "lowermost component in the dependency
chain" for atf) and just include that file from
usr.bin/atf/Makefile.inc .

Thoughts?

Thanks,

-- 
Julio Merino / @jmmv


More information about the freebsd-hackers mailing list