This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: gengtype-{lex,yacc}.c rules broken
Alexandre Oliva <aoliva@redhat.com> writes:
|> On Jan 13, 2003, Andreas Schwab <schwab@suse.de> wrote:
|>
|> > 2003-01-13 Andreas Schwab <schwab@suse.de>
|>
|> > * Makefile.in ($(parsedir)/gengtype-lex.c): Fix for relative
|> > srcdir.
|> > ($(parsedir)/gengtype-yacc.c): Likewise.
|>
|> Thanks, this is ok. However, if you have a spare minute...
|>
|> > + $(BISON) $(BISONFLAGS) -d -o gengtype-yacc.c $$s/gengtype-yacc.y || \
|> > + { rm -f gengtype-yacc.c && false; }
|>
|> I'd much rather generate a file with a temporary name (say .cT) and
|> then rename it than removing it on failure.
Ok, this is what I have checked in: there is no need to change directory
if we are going to move the file anyway.
Andreas.
2003-01-13 Andreas Schwab <schwab@suse.de>
* Makefile.in ($(parsedir)/gengtype-lex.c): Don't change to
$(parsedir), just move the temporary file at the end.
($(parsedir)/gengtype-yacc.c): Likewise.
--- gcc/Makefile.in.~1.969.~ 2003-01-13 10:08:03.000000000 +0100
+++ gcc/Makefile.in 2003-01-13 21:27:17.000000000 +0100
@@ -2111,20 +2111,23 @@ gengtype-yacc.o : $(parsedir)/gengtype-y
# The sed command works around a bug in flex-2.5.4.
$(parsedir)/gengtype-lex.c : $(srcdir)/gengtype-lex.l
- cd $(parsedir) && \
- $(FLEX) $(FLEXFLAGS) -t -o$@ $(srcdir)/gengtype-lex.l | \
+ $(FLEX) $(FLEXFLAGS) -t -o- $(srcdir)/gengtype-lex.l | \
sed 's/^\(char msg\[\];\)/yyconst \1/' > g-$$$$ ; \
if test $$? -eq 0 ; then \
- mv -f g-$$$$ gengtype-lex.c ; \
+ mv -f g-$$$$ $(parsedir)/gengtype-lex.c ; \
else \
- rm -f g-$$$$.* ; \
+ rm -f g-$$$$ ; \
false ; \
fi
$(parsedir)/gengtype-yacc.c: $(srcdir)/gengtype-yacc.y
- (cd $(parsedir) && \
- $(BISON) $(BISONFLAGS) -d -o gengtype-yacc.c $(srcdir)/gengtype-yacc.y || \
- ( rm -f $@ && false ) )
+ if $(BISON) $(BISONFLAGS) -d -o g-yacc.$$$$.c $(srcdir)/gengtype-yacc.y; then \
+ mv -f g-yacc.$$$$.h $(parsedir)/gengtype-yacc.h; \
+ mv -f g-yacc.$$$$.c $(parsedir)/gengtype-yacc.c; \
+ else \
+ rm -f g-yacc.$$$$.*; \
+ false; \
+ fi
genconditions$(build_exeext) : genconditions.o $(BUILD_EARLY_SUPPORT) \
$(BUILD_RTL) $(BUILD_ERRORS) $(BUILD_LIBDEPS)
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."