In the last episode (Nov 21), Brian Reichert said:
> I'm crunching out some complex 'make' rules , and am having a brain
> fart as to what sorts of rules are safe to use with '-j'.
>
> As a matter of example, I'm looking at /usr/share/mk/sys.mk under
> 4.5-RELEASE:
>
> # XXX not -j safe
> .y.out:
> ${YACC} ${YFLAGS} ${.IMPSRC}
> ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
> rm -f y.tab.c
>
> .l.out:
> ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c
> ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET}
> rm -f ${.PREFIX}.tmp.c
.y.out uses a constant filename (y.tab.c) as an intermediate file. If
make -j decided to compile two .y files in the same directory at the
same time, one's going to get overwritten. .l.out avoids this by using
${.PREFIX}, which expands to the filename of the source file minus path
and extension. .y.out could be made safe by making the first line
${YACC} ${YFLAGS} -o ${.PREFIX}.y.tmp.c ${.IMPSRC}
and replacing y.tab.c. with ${.PREFIX}.y.tmp.c . For good measure,
.l.out should probably be using ${.PREFIX}.l.tmp.c, just so you can
tell which rule generated a particular tempfile.
--
Dan Nelson
[EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message