30.5. Hidden Dependencies

Suppose you have build items A,
B, and C, and suppose
that B doesn't actually require
C to build, but anyone who needs
B also needs C. In
this case, B should declare a dependency
on C, or B and
C should be combined. In other words, a
build item should depend on all build items that will be needed
if you use it.

Consider a concrete example. Suppose our three build items are
main, lib-headers, and
lib-src. Suppose
lib-headers doesn't have an
Abuild.mk and doesn't actually build
anything. Instead, it just has an
Abuild.interface that adds its directory to
your INCLUDES variable. Suppose
lib-src builds a library and has an
Abuild.interface that adds the library
directory to LIBDIRS and the library to
LIBS. If main uses the
library built by lib-src but declares a
dependency on lib-headers, then it will be
able to compile but not link. In order to link, it requires a
dependency on lib-src. This means that
anyone that depends on lib-headers must
also depend on lib-src. Rather than
having this situation, make lib-src's
Abuild.interface append to
INCLUDES and just eliminate the
lib-headers build item entirely. It is
still okay to have the headers in a separate directory; just
don't place an Abuild.conf in that
directory.