Re: Patch for Makefile race against current cvs - Mailing list pgsql-patches

From Peter Eisentraut
Subject Re: Patch for Makefile race against current cvs
Date
Msg-id Pine.LNX.4.30.0111161554540.644-100000@peter.localdomain
Whole thread Raw
In response to Re: Patch for Makefile race against current cvs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
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


pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Fix for PlPython trust problems
Next
From: Peter Eisentraut
Date:
Subject: Re: Patch to add Heimdal kerberos support