Re: Patch for Makefile race against current cvs

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Klaus Naumann <knaumann(at)gmx-ag(dot)de>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Patch for Makefile race against current cvs
Date: 2001-11-17 13:35:46
Message-ID: Pine.LNX.4.30.0111161554540.644-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Weiping He 2001-11-17 16:33:26 the new patches for zh_CN NLS
Previous Message Peter Eisentraut 2001-11-17 13:35:01 Re: Patch to add Heimdal kerberos support