svn commit: r289286 - head/share/mk

Bryan Drewery bdrewery at FreeBSD.org
Wed Oct 14 04:42:07 UTC 2015


Author: bdrewery
Date: Wed Oct 14 04:42:05 2015
New Revision: 289286
URL: https://svnweb.freebsd.org/changeset/base/289286

Log:
  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

Modified:
  head/share/mk/bsd.progs.mk

Modified: head/share/mk/bsd.progs.mk
==============================================================================
--- head/share/mk/bsd.progs.mk	Wed Oct 14 04:32:55 2015	(r289285)
+++ head/share/mk/bsd.progs.mk	Wed Oct 14 04:42:05 2015	(r289286)
@@ -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


More information about the svn-src-all mailing list