Skip to content

Commit

Permalink
build: don't link to optional_mutex if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
gperciva committed Feb 22, 2024
1 parent e8f139f commit 521eb68
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions release-tools/metabuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ printf "RELATIVE_DIR=%s\n" "${D}" >> "${OUT}"
if [ -n "$(${MAKEBSD} -v LIB)" ]; then
cat "${SUBDIR_DEPTH}/release-tools/Makefile.lib" >> "${OUT}"
elif [ -n "$(${MAKEBSD} -v SRCS)" ]; then
# This *must* come after SUBDIR_DEPTH has been copied into
# the Makefile, because it depends on being able to run:
# make -v SUBDIR_DEPTH
copyvar_LIBALL_optional_mutex
add_makefile_prog
else
Expand Down

0 comments on commit 521eb68

Please sign in to comment.