From 9a27f362075390957411f7bea5c9a45877d95e7e Mon Sep 17 00:00:00 2001 From: bdrewery Date: Thu, 22 Oct 2015 04:42:17 +0000 Subject: 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 --- share/mk/bsd.crunchgen.mk | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'share/mk') diff --git a/share/mk/bsd.crunchgen.mk b/share/mk/bsd.crunchgen.mk index acef93b..d6a32ef 100644 --- a/share/mk/bsd.crunchgen.mk +++ b/share/mk/bsd.crunchgen.mk @@ -123,29 +123,32 @@ objs: $(OUTMK) # 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 -- cgit v1.1