summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2017-05-16 02:23:54 +0000
committerbdrewery <bdrewery@FreeBSD.org>2017-05-16 02:23:54 +0000
commit3d732f4288d35793c1793f87874a5546ebbfac9e (patch)
treed9cd822098f4a372e38516a0c76a2daeb571b3f7 /share/mk
parent87ef7e4a0e3c2f09250c80533f2b40cfb88a0c55 (diff)
downloadFreeBSD-src-3d732f4288d35793c1793f87874a5546ebbfac9e.zip
FreeBSD-src-3d732f4288d35793c1793f87874a5546ebbfac9e.tar.gz
MFC r318092:
PROGS+META_MODE: Avoid rebuilding common sources when recursing.
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.progs.mk20
1 files changed, 15 insertions, 5 deletions
diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk
index 3254bda..c50410d 100644
--- a/share/mk/bsd.progs.mk
+++ b/share/mk/bsd.progs.mk
@@ -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:M*.[dhly]}
.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
OpenPOWER on IntegriCloud