Using bsd.prog.mk in a project with multiple binaries

Brooks Davis brooks at freebsd.org
Wed Nov 6 22:25:33 UTC 2013


On Wed, Nov 06, 2013 at 08:45:26AM -0800, R. Tyler Croy wrote:
> Howdy, I'm trying to find some documentation or examples of using bsd.prog.mk
> inside of a project with multiple binaries that need to get created. I'm able
> to shuffle the manpages and source code into directories to where each binary
> can have a Makefile, but I cannot find anything in the Developer's Handbook
> discussing such a project layout. E.g.:
> 
>   -daemon.git/
>     -daemon/
>       daemon.man.1
>       daemon.c
>     -daemontool/
>       daemontool.man.1
>       daemontool.c
> 
> 
> Does one simply use a parent Makefile which calls into each directory? Or is
> there some other .mk file with helpers for this?

You can use bsd.subdir.mk.  See usr.bin/clang for a somewhat complicated
example.

> A related question would be, does this even make snese as far as a
> project layout is concerned? This project I intend on creating a port
> for once it's further along, and I'd like to avoid painting myself
> into any cornners with the makefiles now if I can avoid it.

This seems plusable as a layout.  Note that while you need one Makefile
per program, you don't necessicairly need to spread the code out if you
don't want to.  If you'd rather keep the source files in one place you
can use .PATH: directives to access them from a central location.

-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20131106/e37f59a8/attachment.sig>


More information about the freebsd-hackers mailing list