Re: parallel build failure with .c.o rule interrupted mid-step!
"Greg A. Woods" <[email protected]> Mon, 03 Mar 2025 13:09:00 -0800
| Newsgroups | gmane.os.netbsd.current,gmane.os.netbsd.devel.toolchain |
|---|---|
| Organization | Planix, Inc. |
| Message-ID | <[email protected]> |
I couldn't see the forest for the trees it seems.
Here's a working version:
#
# tfail.mk:
#
# Demo two-commands-in-one-script failure
#
# Run with:
#
# rm -rf tfail; mkdir -p tfail; touch tfail/tfail.trace; make MAKEOBJDIR=tfail -T tfail.trace -f tfail.mk -j 20; rc=$?; ls -l tfail/*.int; exit $rc
#
# or:
#
# rm -rf tfail; mkdir -p tfail; cd tfail; touch tfail.trace; make -T tfail.trace -f ../tfail.mk -j 20; rc=$?; ls -l *.int; exit $rc
#
# When it fails, if it behaves the same as I see in a NetBSD build, then there
# will be one or more .int files, and for each there might also be an empty
# associated .obj file too.
#
.SUFFIXES: .src .obj
OBJECT_TARGET = ${.TARGET}.int
.src.obj:
if [ ${.TARGET} = "src-3-5.obj" ]; then exit 1; fi
(sleep 0.2; cat ${.IMPSRC}; ) > ${OBJECT_TARGET}
(sleep 0.1; cat ${OBJECT_TARGET} ) > ${.TARGET} && rm -f ${OBJECT_TARGET}
.for _i in 0 1 2 3 4 5 6 7 8 9
DIRS += dir-${_i}
PRODS += foo-${_i}
SRCS += srcs-${_i}
.for _j in 0 1 2 3 4 5 6 7 8 9
SRCS.${_i} += src-${_i}-${_j}.src
OBJS.${_i} += src-${_i}-${_j}.obj
.endfor
.endfor
all: .PHONY ${DIRS}
.for _i in 0 1 2 3 4 5 6 7 8 9
#
# pretend each "foo-*" is built in a separate subdirectory so that they can be
# built in parallel
#
dir-${_i}: .PHONY srcs-${_i}
${MAKE} -f ${MAKEFILE} foo-${_i}
foo-${_i}: ${OBJS.${_i}}
cat ${OBJS.${_i}} > ${.TARGET}
srcs-${_i}: .PHONY
${MAKE} -f ${MAKEFILE} ${SRCS.${_i}}
.for _j in 0 1 2 3 4 5 6 7 8 9
src-${_i}-${_j}.src:
echo ${.TARGET} > ${.TARGET}
.endfor
.endfor
--
Greg A. Woods <[email protected]>
Kelowna, BC +1 250 762-7675 RoboHack <[email protected]>
Planix, Inc. <[email protected]> Avoncote Farms <[email protected]>
signature.asc
(application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRuK6dmwVAucmRxuh9mfXG3eL/0fwUCZ8YaZAAKCRBmfXG3eL/0 f2ejAKC9bUPSVcYEmao12RVN5ijxeY5LOACgp4Tx9Dv0ZqYJNRgiw1GIPDtrt38= =1dUO -----END PGP SIGNATURE-----