diff --git a/Makefile.inc b/Makefile.inc index 2ae1b810..e5390ced 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -14,11 +14,22 @@ IDIRS := ${IDIRS} # Default is no man pages MAN = +# The SUBDIR_DEPTH variable (defined above) initializes tracking the +# subdirectory depth, but it's not fully set at this stage in the build +# process. Instead, we jump back to the shell and print the (finalized) value +# of SUBDIR_DEPTH. This avoids an infinite loop because we query the Makefile +# (which does not include ../Makefile.inc), rather than Makefile.BSD (which +# would end up including this file again). +FINALIZED_SUBDIR_DEPTH != ${MAKE} -v SUBDIR_DEPTH + .if !defined(NOLIBALL) # Link everything to liball.a, unless they specifically ask not to use it. -# If appropriate, metabuild.sh will do: +LIBALL = ${SUBDIR_DEPTH}/liball/liball.a +.if exists(${FINALIZED_SUBDIR_DEPTH}/liball/optional_mutex_normal) +# If we have optional_mutex, add it. If appropriate, metabuild.sh will do: # s/optional_mutex_normal/optional_mutex_pthread/g -LIBALL = ${SUBDIR_DEPTH}/liball/liball.a ${SUBDIR_DEPTH}/liball/optional_mutex_normal/liball_optional_mutex_normal.a +LIBALL += ${SUBDIR_DEPTH}/liball/optional_mutex_normal/liball_optional_mutex_normal.a +.endif LDADD += ${LIBALL} DPADD += ${LIBALL} .endif