[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] [PATCH] dependency for parallel make (bison)
From: |
Petr Ovtchenkov |
Subject: |
Re: [bug-gawk] [PATCH] dependency for parallel make (bison) |
Date: |
Tue, 12 Sep 2017 20:44:12 +0300 |
On Tue, 12 Sep 2017 11:34:40 -0400
"Andrew J. Schorr" <address@hidden> wrote:
> On Tue, Sep 12, 2017 at 10:41:28AM +0300, Petr Ovtchenkov wrote:
> > Add dependency between command.c and awkgram.c to avoid
> > parallel bison running. Bison produce y.tab.c, so if
> > ones generated in parallel, collision may happens.
> > ---
> > Makefile.am | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile.am b/Makefile.am
> > index 8660c11..3fb88d3 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -207,7 +207,7 @@ awkgram.c: awkgram.y
> > if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
> > else :; fi
> >
> > -command.c: command.y
> > +command.c: command.y awkgram.c
> > $(YACC) -p zz $<
> > sed 's/parse error/syntax error/g' < y.tab.c | awk -f
> > "$(srcdir)"/bisonfix.awk command
> > > $*.c && rm y.tab.c
>
> Good catch. If we are allowed to use the "-o" option to yacc (bison?), then
> this
> rule might be a better fix:
>
> command.c: command.y
> $(YACC) -o $@ -p zz $<
> sed 's/parse error/syntax error/g' < $@ > address@hidden && mv
> address@hidden $@
I'm agree, this is better.
>
> But I don't know whether it's safe to use "-o" on all of our platforms.
-o should work for all *nixes. I have no opinion about W.
> With
> -o, we could eliminate the bisonfix.awk hack for awkgram.y as well, but that
> rule is a bit messier because of the shenanigans with y.tab.h.
>
> And if we knew that we were dealing with GNU sed, we could write:
>
> command.c: command.y
> $(YACC) -o $@ -p zz $<
> sed -i 's/parse error/syntax error/g' $@
>
> Regards,
> Andy
WBR,
--
- ptr