svn commit: r318092 - head/share/mk
Bryan Drewery
bdrewery at FreeBSD.org
Tue May 9 18:45:36 UTC 2017
Author: bdrewery
Date: Tue May 9 18:45:34 2017
New Revision: 318092
URL: https://svnweb.freebsd.org/changeset/base/318092
Log:
PROGS+META_MODE: Avoid rebuilding common sources when recursing.
This could be seen in lib/libkvm/tests where kvm_test_common.o was
a common dependency, but one of the recursed progs had a special
CFLAGS+= -I that changed the build command. This would cause
all recursed builds to rebuild while fighting over the meta file
and object file.
Reported by: Mark Millard
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Modified:
head/share/mk/bsd.progs.mk
Modified: head/share/mk/bsd.progs.mk
==============================================================================
--- head/share/mk/bsd.progs.mk Tue May 9 18:33:41 2017 (r318091)
+++ head/share/mk/bsd.progs.mk Tue May 9 18:45:34 2017 (r318092)
@@ -87,11 +87,7 @@ $v =
# handle being called [bsd.]progs.mk
.include <bsd.prog.mk>
-.if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
-# 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
+# Find common sources among the PROGS to depend on them before building
# anything. This allows parallelization without them each fighting over
# the same objects.
_PROGS_COMMON_SRCS=
@@ -110,6 +106,20 @@ _PROGS_COMMON_OBJS= ${_PROGS_COMMON_SRCS
.if !empty(_PROGS_COMMON_SRCS:N*.[dhly])
_PROGS_COMMON_OBJS+= ${_PROGS_COMMON_SRCS:N*.[dhly]:R:S/$/.o/g}
.endif
+.endif
+
+# When recursing, ensure common sources are not rebuilt in META_MODE.
+.if defined(_RECURSING_PROGS) && !empty(_PROGS_COMMON_OBJS) && \
+ !empty(.MAKE.MODE:Mmeta)
+${_PROGS_COMMON_OBJS}: .NOMETA
+.endif
+
+.if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
+# tell progs.mk we might want to install things
+PROGS_TARGETS+= checkdpadd clean cleandepend cleandir depend install
+
+# Ensure common objects are built before recursing.
+.if !empty(_PROGS_COMMON_OBJS)
${PROGS}: ${_PROGS_COMMON_OBJS}
.endif
More information about the svn-src-head
mailing list