Fix race when building ada-lex.c
[deliverable/binutils-gdb.git] / gdb / Makefile.in
index 648f66d31df3a1b2561af3f33c76cd06e28ca0cb..be769280a9397fb502d74bd9b559e1f4ca27503b 100644 (file)
@@ -2483,9 +2483,8 @@ po/$(PACKAGE).pot: force
 # Makefile.in, but that was a pretty big annoyance.
 
 %.c: %.y
-       rm -f $@ $@.tmp
-       $(SHELL) $(YLWRAP) $< y.tab.c $@ -- $(YACC) $(YFLAGS) && mv $@ $@.tmp \
-               || (rm -f $@; false)
+       $(SHELL) $(YLWRAP) $< y.tab.c $@.tmp -- $(YACC) $(YFLAGS) \
+               || (rm -f $@.tmp; false)
        sed -e '/extern.*malloc/d' \
             -e '/extern.*realloc/d' \
             -e '/extern.*free/d' \
@@ -2496,13 +2495,13 @@ po/$(PACKAGE).pot: force
             -e 's/\([ \t;,(]\)free$$/\1xfree/g' \
             -e '/^#line.*y.tab.c/d' \
             -e 's/YY_NULL/YY_NULLPTR/g' \
-         < $@.tmp > $@
-       rm -f $@.tmp
+         < $@.tmp > $@.new && \
+         rm -f $@.tmp && \
+         mv $@.new $@
 %.c: %.l
        if [ "$(FLEX)" ] && $(FLEX) --version >/dev/null 2>&1; then \
-           $(FLEX) -o$@ $< && \
-           rm -f $@.new && \
-           sed -e '/extern.*malloc/d' \
+           $(FLEX) --stdout $<  \
+           | sed -e '/extern.*malloc/d' \
                -e '/extern.*realloc/d' \
                -e '/extern.*free/d' \
                -e '/include.*malloc.h/d' \
@@ -2511,8 +2510,7 @@ po/$(PACKAGE).pot: force
                -e 's/\([ \t;,(]\)free\([ \t]*[&(),]\)/\1xfree\2/g' \
                -e 's/\([ \t;,(]\)free$$/\1xfree/g' \
                -e 's/yy_flex_xrealloc/yyxrealloc/g' \
-             < $@ > $@.new && \
-           rm -f $@ && \
+             > $@.new && \
            mv $@.new $@; \
        elif [ -f $@ ]; then \
            echo "Warning: $*.c older than $*.l and flex not available."; \
This page took 0.02525 seconds and 4 git commands to generate.