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 <gwo...@acm.org> Kelowna, BC +1 250 762-7675 RoboHack <wo...@robohack.ca> Planix, Inc. <wo...@planix.com> Avoncote Farms <wo...@avoncote.ca>
pgpI2PbFfcYk5.pgp
Description: OpenPGP Digital Signature