Kris Kirby wrote:
> In my project root, I have the following makefile:
> SUBDIR = 1 2 3 4 5 6 7 8 9
> .include <bsd.subdir.mk>
Assuming you have an `encode' target that you want to run in parallel;
you need something like:
.for entry in ${SUBDIR}
${entry}.encode__D: .PHONY
@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \
edir=${entry}.${MACHINE_ARCH}; \
cd ${.CURDIR}/$${edir}; \
else \
${ECHODIR} "===> ${DIRPRFX}${entry}"; \
edir=${entry}; \
cd ${.CURDIR}/$${edir}; \
fi; \
${MAKE} encode DIRPRFX=${DIRPRFX}$${edir}/
.endfor
par-encode: ${SUBDIR:S/$/.encode__D/}
(Taken from src/Makefile.inc1)
By having all the subdirs as dependencies for the par-encode target,
make will start doing them in parallel.
> @for prog in ${OBJ} ; do \
> ${PROG} ${PAF}/$$prog ; \
> done
>
> I am thinking that the for loop is not the way to run things parallel,
> but I see no other option. This is a batch MP3 encode, not a compling
> run, but the concepts are similar (programs and thier arguments).
Correct. The for-loop is expanded before any targets are made. That's
why the normal use of SUBDIR is non-parallel; it's used in a for-loop.
--
Marcel Moolenaar mailto:[EMAIL PROTECTED]
SCC Internetworking & Databases http://www.scc.nl/
The FreeBSD project mailto:[EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message