summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-10-14 04:42:05 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-10-14 04:42:05 +0000
commit3451a7cd5bc9b8f33d720b0d2b575d9093c4680f (patch)
treee1a4e36896d84a59dc6096eb8a07cfb868235461 /share
parente146e19fb5fee8587e3eca2c4ba6d73628e244eb (diff)
downloadFreeBSD-src-3451a7cd5bc9b8f33d720b0d2b575d9093c4680f.zip
FreeBSD-src-3451a7cd5bc9b8f33d720b0d2b575d9093c4680f.tar.gz
Follow-up r288218 by ensuring common objects are built before recursing.
Some example where this is a problem: lib/atf/libatf-c++/tests/Makefile:SRCS.${_T}= ${_T}.cpp test_helpers.cpp lib/atf/libatf-c++/tests/detail/Makefile:SRCS.${_T}= ${_T}.cpp test_helpers.cpp lib/atf/libatf-c/tests/Makefile:SRCS.${_T}= ${_T}.c test_helpers.c lib/atf/libatf-c/tests/detail/Makefile:SRCS.${_T}= ${_T}.c test_helpers.c lib/libpam/libpam/tests/Makefile:SRCS.${test} = ${test}.c ${COMMONSRC} A similar change may be needed for FILES, SCRIPTS, or INCS, but for now stay with just SRCS. Reported by: rodrigc MFC after: 3 weeks X-MFC-With: r288218 Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'share')
-rw-r--r--share/mk/bsd.progs.mk19
1 files changed, 19 insertions, 0 deletions
diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk
index ab52708..3efa691 100644
--- a/share/mk/bsd.progs.mk
+++ b/share/mk/bsd.progs.mk
@@ -84,6 +84,25 @@ $v =
# tell progs.mk we might want to install things
PROGS_TARGETS+= checkdpadd clean cleandepend cleandir depend install
+# Find common sources among the PROGS and depend on them before building
+# anything. This allows parallelization without them each fighting over
+# the same objects.
+_PROGS_COMMON_SRCS=
+_PROGS_ALL_SRCS=
+.for p in ${PROGS}
+.for s in ${SRCS.${p}}
+.if ${_PROGS_ALL_SRCS:M${s}} && !${_PROGS_COMMON_SRCS:M${s}}
+_PROGS_COMMON_SRCS+= ${s}
+.else
+_PROGS_ALL_SRCS+= ${s}
+.endif
+.endfor
+.endfor
+.if !empty(_PROGS_COMMON_SRCS)
+_PROGS_COMMON_OBJS= ${_PROGS_COMMON_SRCS:N*.h:R:S/$/.o/g}
+${PROGS}: ${_PROGS_COMMON_OBJS}
+.endif
+
.for p in ${PROGS}
.if defined(PROGS_CXX) && !empty(PROGS_CXX:M$p)
# bsd.prog.mk may need to know this
OpenPOWER on IntegriCloud