Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Dec 2015 18:06:47 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r291789 - stable/10/share/mk
Message-ID:  <201512041806.tB4I6mEo016089@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Fri Dec  4 18:06:47 2015
New Revision: 291789
URL: https://svnweb.freebsd.org/changeset/base/291789

Log:
  MFC r289286,r291338,r291340:
  
    r289286:
      Follow-up r288218 by ensuring common objects are built before recursing.
    r291338:
      Fix the "common object" handling to not depend on ".o" if SRCS only
      contains headers.
    r291340:
      Follow-up r291338 to handle .d, .y and .l files better as well.

Modified:
  stable/10/share/mk/bsd.progs.mk
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/mk/bsd.progs.mk
==============================================================================
--- stable/10/share/mk/bsd.progs.mk	Fri Dec  4 18:04:56 2015	(r291788)
+++ stable/10/share/mk/bsd.progs.mk	Fri Dec  4 18:06:47 2015	(r291789)
@@ -92,6 +92,28 @@ $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:M*.[dhly]}
+.if !empty(_PROGS_COMMON_SRCS:N*.[dhly])
+_PROGS_COMMON_OBJS+=	${_PROGS_COMMON_SRCS:N*.[dhly]:R:S/$/.o/g}
+.endif
+${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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512041806.tB4I6mEo016089>