Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Dec 1997 20:45:05 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        asami@cs.berkeley.edu, jkh@FreeBSD.ORG, nnd@nnd.itfs.nsk.su, stable@FreeBSD.ORG
Subject:   Re: make buildworld -j2 problems
Message-ID:  <199712140945.UAA11602@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I looked at the logs a bit more and found out why.  This part looks
>like:
>
>===
>.ORDER: grammar.c tokdefs.h
>tokdefs.h grammar.c: grammar.y
>        ${YACC} ${YACCFLAGS} -d ${PCAP_DISTDIR}/grammar.y
>        mv y.tab.c grammar.c
>        mv y.tab.h tokdefs.h
>===
>
>in -current.  .ORDER might have been necessary here, but merging only
>that line to -stable was bogus.  (Although I still don't quite see why 
>we need .ORDER -- they are both made from the same rule, it seems.)

.ORDER is needed to prevent `make' from executing two copies of the rule
concurrently.

> * (2) I'll try again after adding a "scanner.so: tokdefs.h" line.  But
> *     it seems to me that there should be a more elegant way to handle
> *     this.  (Don't we need to add a ".po" line too?)

The more elegant way is already in bsd.lib.mk.  It substitutes .so or .po
for .o as required.

>The answer to this question is probably also in -current.  I'll see
>about merging the 1.12 -> 1.13 fix:

Removing the `scanner.o: tokdefs.h' line in rev.1.13 was a mistake.
scanner.o really does depend on tokdefs.h, and the dependency is not
otherwise given in the Makefile.  It worked in the non-parallel case
because grammar.c is before scanner.c in ${SRCS}.  It works for `make
depend' because tokdefs.h is in ${SRCS} (and also because grammar.c is
in ${SRCS} and building grammar.c builds tokdefs.h; perhaps tokdefs.h
doesn't need to be in ${SRCS} because of this).  Of course, it works for
`make' after `make depend', but `make depend' should not be necessary
in clean obj directories.

See sh/Makefile for more instructive examples.  There, created files
like tokdefs.h are included in more than one .c file.  This makes it
more likely for parallel makes to fail unless lots of dependencies
are listed explicitly.

>===
>1.13 Sun Jan 5 18:25:53 1997 by wollman 
>
>Fix Makefile so that dependencies are actually right this time.
>It is almost always the wrong thing to put .y and .l files directly
>into the SRCS.
>===

I think it was also mistake to override the default rule for creating
grammar.c from grammar.y.  The default rule creates y.tab.h as a side
effect, and I don't see any additional problems for creating tokdefs.h by
mv'ing y.tab.h as in the old rule.  Then .ORDER would not be required.
There might be problems with concurrent yaccs clobbering each other's
y.tab.[ch], but only one yacc is necessary here (since there is only
one yacc source file), and multiple ones would have to be handled more
carefully anyway (e.g., using .ORDER or yacc -b or yacc -o).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712140945.UAA11602>