Tom Lane writes:
> But we could provide some security for multiple children of a single
> make by changing the rules to be like
>
> $(srcdir)/parse.h: gram.y
> ifdef YACC
> $(YACC) -d $(YFLAGS) $<
> mv y.tab.h $(srcdir)/parse.h
> mv y.tab.c $(srcdir)/gram.c
> else
> @$(missing) bison $< $@
> endif
>
> $(srcdir)/gram.c: $(srcdir)/parse.h
So I did and tried that:
| peter ~/pgsql/src/backend/parser$ make gram.c -j
| bison -y -d gram.y
| mv y.tab.c ./gram.c
| mv y.tab.h ./parse.h
| bison -y gram.y
| mv -f y.tab.c gram.c
| peter ~/pgsql/src/backend/parser$
Huh?
The problem is that
$(srcdir)/gram.c: $(srcdir)/parse.h
says, "before trying to make gram.c you must make parse.h", but it does
*not* says *how* to make gram.c. So when faced with that question, make
runs the built-in %.y => %.c rule that you see. In backend/bootstrap you
can see crash and burn as a result of this.
The correct version uses the rule
$(srcdir)/gram.c: $(srcdir)/parse.h ;
which says, "to make gram.c, make parse.h and then run the empty command".
This is what I checked in.
--
Peter Eisentraut peter_e@gmx.net