svn commit: r289734 - head/share/mk

Bryan Drewery bdrewery at FreeBSD.org
Thu Oct 22 04:42:19 UTC 2015


Author: bdrewery
Date: Thu Oct 22 04:42:17 2015
New Revision: 289734
URL: https://svnweb.freebsd.org/changeset/base/289734

Log:
  Rewrite crunchgen target handling for progs so that it can be parallelized.
  
  This covers 'clean', 'cleandepend', 'cleandir', 'obj', 'objlink' and
  'build-tools'.
  
  This uses the same method as bsd.subdir.mk.
  
  MFC after:	2 weeks
  X-MFC-With:	r289731
  Sponsored by:	EMC / Isilon Storage Division

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

Modified: head/share/mk/bsd.crunchgen.mk
==============================================================================
--- head/share/mk/bsd.crunchgen.mk	Thu Oct 22 04:38:05 2015	(r289733)
+++ head/share/mk/bsd.crunchgen.mk	Thu Oct 22 04:42:17 2015	(r289734)
@@ -123,29 +123,32 @@ objs: $(OUTMK)
 
 # <sigh> Someone should replace the bin/csh and bin/sh build-tools with
 # shell scripts so we can remove this nonsense.
-build-tools:
 .for _tool in $(CRUNCH_BUILDTOOLS)
+build-tools-${_tool}:
 	${_+_}cd $(.CURDIR)/../../${_tool}; \
-	${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} obj; \
-	${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} build-tools
+	    ${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} obj; \
+	    ${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} build-tools
+build-tools: build-tools-${_tool}
 .endfor
 
 # Use a separate build tree to hold files compiled for this crunchgen binary
 # Yes, this does seem to partly duplicate bsd.subdir.mk, but I can't
 # get that to cooperate with bsd.prog.mk.  Besides, many of the standard
 # targets should NOT be propagated into the components.
-cleandepend cleandir obj objlink:
+.for __target in clean cleandepend cleandir obj objlink
 .for D in $(CRUNCH_SRCDIRS)
 .for P in $(CRUNCH_PROGS_$(D))
 .ifdef CRUNCH_SRCDIR_${P}
-	${_+_}cd ${CRUNCH_SRCDIR_$(P)} && \
-	    ${CRUNCHENV} MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
-	    DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
+__dir=	${CRUNCH_SRCDIR_$(P)}
 .else
-	${_+_}cd $(.CURDIR)/../../${D}/${P} && \
-	    ${CRUNCHENV} MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
-	    DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
+__dir=	${.CURDIR}/../../${D}/${P}
 .endif
+${__target}_crunchdir_${P}: .PHONY .MAKE
+	${_+_}cd ${__dir} && \
+	    ${CRUNCHENV} MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
+	    DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${__target}
+${__target}: ${__target}_crunchdir_${P}
+.endfor
 .endfor
 .endfor
 
@@ -154,16 +157,3 @@ clean:
 	${_+_}if [ -e ${.OBJDIR}/$(OUTMK) ]; then				\
 		${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} -f $(OUTMK) clean;	\
 	fi
-.for D in $(CRUNCH_SRCDIRS)
-.for P in $(CRUNCH_PROGS_$(D))
-.ifdef CRUNCH_SRCDIR_${P}
-	${_+_}cd ${CRUNCH_SRCDIR_$(P)} && \
-	    ${CRUNCHENV} MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
-	    DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
-.else
-	${_+_}cd $(.CURDIR)/../../${D}/${P} && \
-	    ${CRUNCHENV} MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
-	    DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
-.endif
-.endfor
-.endfor


More information about the svn-src-head mailing list