Subject: Re: make: making .WAIT recursive
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-toolchain
Date: 02/13/2006 17:33:18
--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, Feb 13, 2006 at 10:19:10PM +0000, David Laight wrote:
> On Mon, Feb 13, 2006 at 08:31:08AM -0800, Chuck Silvers wrote:
> > if the problem at hand is src/etc/Makefile, how about the attached patch?
> > it replaces all the .WAITs with equivalent (but functional) dependencies.
> 
> That patch won't help, the sub-paths of snap-kern will still get build
> before the commands of snap-pre.

er, right.  here's take 2, this one is better.

-Chuck

--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="diff.etc-mk.2"

Index: src/etc/Makefile
===================================================================
RCS file: /cvsroot/src/etc/Makefile,v
retrieving revision 1.322
diff -u -p -r1.322 Makefile
--- src/etc/Makefile	11 Feb 2006 20:56:29 -0000	1.322
+++ src/etc/Makefile	14 Feb 2006 01:29:29 -0000
@@ -41,11 +41,6 @@
 .include <bsd.kernobj.mk>	# For KERNSRCDIR, KERNOBJDIR, ...
 .include <bsd.endian.mk>	# For TARGET_ENDIANNESS
 
-# XXX: .WAIT doesn't work the way this makefile needs it to.
-# So until that is fixed.
-# Actually that isn't enough either.... snap_pre must not depend on anything
-.NOTPARALLEL:
-
 .MAKEOVERRIDES+=	USETOOLS
 
 TZDIR=		/usr/share/zoneinfo
@@ -141,7 +136,7 @@ PWD_MKDB_ENDIAN=
 # distribution --
 #	Build a distribution
 #
-distribution: .PHONY check_DESTDIR .WAIT distrib-dirs
+distribution: .PHONY check_DESTDIR distrib-dirs
 .if !defined(DISTRIBUTION_DONE)
 .if !defined(INSTALL_DONE)
 	${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB=
@@ -392,10 +387,7 @@ distrib-dirs: .PHONY check_DESTDIR
 # release, snapshot --
 #	Build a full distribution including kernels & install media.
 #
-release snapshot: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \
-		    distribution .WAIT \
-		    snap_pre .WAIT snap_kern .WAIT \
-		    snap_post .WAIT snap_md_post
+release snapshot: .PHONY check_DESTDIR check_RELEASEDIR snap_md_post
 	${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets
 	${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \
 		${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@}
@@ -413,7 +405,7 @@ CDROM.image=${RELEASEDIR}/${RELEASEMACHI
 CDROM.dir=	${.OBJDIR}/cdrom.dir
 CDROM.pathlist=	${.OBJDIR}/cdrom.pathlist
 
-iso-image: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-md-post
+iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post
 	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom '*.iso'
 	@echo "iso-image created as: ${CDROM.image}"
 
@@ -431,8 +423,7 @@ iso-image-setup: .PHONY check_RELEASEDIR
 # iso-image-mi --
 #	Create the image after the MD operations have completed.
 #
-iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \
-		iso-image-setup .WAIT iso-image-md-pre
+iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre
 	@if ! ${MKISOFS} --version; then \
 		echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \
 		false; \
@@ -444,21 +435,21 @@ iso-image-mi: .PHONY check_DESTDIR check
 #	Setup ${CDROM.dir} to produce a bootable CD image.
 #	Overridden by etc.$MACHINE/Makefile.inc
 #
-iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR
+iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup
 #	(empty -- look in the machine-dependent Makefile.inc)
 
 # iso-image-md-post --
 #	Fixup the CD-image to be bootable.
 #	Overridden by etc.$MACHINE/Makefile.inc
 #
-iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-mi
+iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi
 #	(empty -- look in the machine-dependent Makefile.inc)
 
 
 # snap_pre --
 #	Create ${RELEASEDIR} and necessary subdirectories.
 #
-snap_pre: .PHONY # check_DESTDIR check_RELEASEDIR
+snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution
 	${INSTALL} -d -m 755 ${RELEASEDIR}
 .if ${MKUPDATE} == "no"
 # Could be a mount point, ignore the errors
@@ -472,14 +463,15 @@ snap_pre: .PHONY # check_DESTDIR check_R
 # snap_post --
 #	Build the install media and notes from distrib
 #
-snap_post: .PHONY .MAKE check_DESTDIR check_RELEASEDIR
+snap_post: .PHONY .MAKE check_DESTDIR check_RELEASEDIR build_kernels \
+	build_kernelsets build_releasekernels
 .if ${MKUPDATE} == "no"
 	cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
 .endif
 	cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
 	    ${MAKE} release
 
-# snap_kern --
+# build_kernels --
 #	This target builds the kernels specified by each port.
 #	A port may specify the following kernels:
 #
@@ -519,8 +511,6 @@ ALL_KERNELS?=	${KERNEL_SETS} ${EXTRA_KER
 GETKERNELAWK=	awk '/^config/ {print $$2; found=1} \
 		END{ if (found == 0) print "netbsd"; }'
 
-.if !target(snap_kern)						# {
-
 # build_kernels --
 #	Configure & compile kernels listed in ${ALL_KERNELS}
 #
@@ -531,7 +521,7 @@ GETKERNELAWK=	awk '/^config/ {print $$2;
 .if !defined(KERNELS_DONE)						# {
 .for configfile in ${ALL_KERNELS}					# {
 _KERNELS_TO_BUILD+=kern-${configfile}
-kern-${configfile}: .PHONY .MAKE
+kern-${configfile}: .PHONY .MAKE snap_pre
 	cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \
 	    -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
 .if ${MKUPDATE} == "no"
@@ -550,7 +540,7 @@ build_kernels: .PHONY ${_KERNELS_TO_BUIL
 #
 .for configfile in ${KERNEL_SETS}					# {
 _KERNELSETS_TO_BUILD+=kernset-${configfile}
-kernset-${configfile}: .PHONY
+kernset-${configfile}: .PHONY kern-${configfile}
 	@ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
 	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
 	kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
@@ -586,7 +576,7 @@ build_kernelsets: ${_KERNELSETS_TO_BUILD
 #
 .for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS}			# {
 _RELEASEKERNELS_TO_BUILD+=releasekern-${configfile}
-releasekern-${configfile}: .PHONY
+releasekern-${configfile}: .PHONY kern-${configfile}
 	@ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
 	kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
 	kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
@@ -606,21 +596,11 @@ releasekern-${configfile}: .PHONY
 
 build_releasekernels: ${_RELEASEKERNELS_TO_BUILD}
 
-# snap_kern --
-#	build the kernels, then the sets & release kernels
-#
-snap_kern: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \
-	    build_kernels .WAIT \
-	    build_kernelsets build_releasekernels
-
-.endif # !target(snap_kern)					# }
-
-
 # snap_md_post --
 #	Machine dependent distribution media operations.
 #	Overridden by etc.$MACHINE/Makefile.inc
 #
-snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR
+snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post
 #	(empty -- look in the machine-dependent Makefile.inc)
 
 

--qMm9M+Fa2AknHoGS--