How to express inter-directory dependencies in <bsd.*.mk> infrastructure?

mdf at mdf at
Sun Oct 30 16:11:45 UTC 2011

2011/10/30 Lev Serebryakov <lev at>:
> Hello, Hackers.
>  How to express inter-directory dependencies in <bsd.*.mk> infrastructure?
>  I have project, which has two subdirectories: "lib" and "bin".
>  Top-level Makefile is simple one, looks like this:
> ===================================
> SUBDIR= lib \
>        bin
> .include <>
> ===================================
>  "lib" subdirectory has Makefile with "<>" included, and
>  "bin" -- with <> included.
>  But how could I express, that PROG in bin depends on LIB from lib, to
> cause rebuilding of PROG when LIB is changed (when I call "make" on
> top level)?

Normally I'd expect the dependency to be handled by make depend; that
is, the source for the binary should be #including header files from
the library.  If the interfaces change, make depend will handle this.

I guess the problem comes if you are using static linking and just
implementation details internal to the library change.

There is a DPADD makefile variable that seems to be used; I'm not sure
though if this handles the type of dependency you're wanting.


More information about the freebsd-hackers mailing list