Patch Makefile.in/Make-lang.in: create bison files atomically

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Fri Oct 13 09:52:00 GMT 2000


 > From: Alexandre Oliva <aoliva@redhat.com>
 > 
 > On Oct 12, 2000, "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> wrote:
 > 
 > >> I think I've just figured out why you chose to use move-if-change.
 > 
 > > Feel free to fill me in.  I don't think I had a good reason. :-)
 > 
 > If you have already generated the file in this session (i.e., it's
 > already up-to-date), you'd better not change its timestamp again,
 > otherwise builds that have already used the previous timestamp may
 > suddenly need to compile the generated files again.

Sure, that's the whole rationale behind move-if-change.  But as you
pointed out in your previous message, we do want to update the
timestamp or else the bison file will get regenerated over and over.

IMHO we don't need to worry about this, the current mechanism makes no
allowance for possible regeneration and no one has noticed.



 > > Um let's keep it simple, how about just "mv -f" ?
 > 
 > Fair enough.

Great, I went ahead and installed the following using "mv -f".

		--Kaveh



2000-10-12  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* Makefile.in (c-parse.c, tradcif.c): Create atomically.
	
	* objc/Make-lang.in (objc-parse.c): Likewise.
	
cp:
	* Makefile.in (parse.c, parse.h): Create atomically.

java:
	* Make-lang.in (parse.c, parse-scan.c): Create atomically.
	
	* Makefile.in (parse.c, parse-scan.c): Likewise.

diff -rup orig/egcs-CVS20001012/gcc/Makefile.in egcs-CVS20001012/gcc/Makefile.in
--- orig/egcs-CVS20001012/gcc/Makefile.in	Mon Oct  9 23:49:51 2000
+++ egcs-CVS20001012/gcc/Makefile.in	Fri Oct 13 11:24:08 2000
@@ -1103,7 +1103,8 @@ c-parse.o : $(srcdir)/c-parse.c $(CONFIG
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
 
 $(srcdir)/c-parse.c: $(srcdir)/c-parse.y
-	cd $(srcdir); $(BISON) $(BISONFLAGS) -o c-parse.c c-parse.y
+	cd $(srcdir); $(BISON) $(BISONFLAGS) -o c-p$$$$.c c-parse.y ; \
+	mv -f c-p$$$$.c c-parse.c
 $(srcdir)/c-parse.y: c-parse.in
 	echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
 	sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
@@ -1854,7 +1855,8 @@ tradcpp.o: tradcpp.c $(CONFIG_H) system.
 tradcif.o: $(srcdir)/tradcif.c $(CONFIG_H) system.h defaults.h
 
 $(srcdir)/tradcif.c: $(srcdir)/tradcif.y
-	cd $(srcdir); $(BISON) $(BISONFLAGS) -o tradcif.c tradcif.y
+	cd $(srcdir); $(BISON) $(BISONFLAGS) -o tr$$$$.c tradcif.y ; \
+	mv -f tr$$$$.c tradcif.c
 
 # Note for the stamp targets, we run the program `true' instead of
 # having an empty command (nothing following the semicolon).
diff -rup orig/egcs-CVS20001012/gcc/cp/Makefile.in egcs-CVS20001012/gcc/cp/Makefile.in
--- orig/egcs-CVS20001012/gcc/cp/Makefile.in	Wed Sep 27 11:36:33 2000
+++ egcs-CVS20001012/gcc/cp/Makefile.in	Fri Oct 13 11:32:40 2000
@@ -225,8 +225,9 @@ parse.o : $(PARSE_C) $(CXX_TREE_H) $(src
 CONFLICTS = expect 33 shift/reduce conflicts and 58 reduce/reduce conflicts.
 $(PARSE_H) $(PARSE_C) : $(srcdir)/parse.y
 	@echo $(CONFLICTS)
-	cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o parse.c parse.y
-	cd $(srcdir); grep '^#define[ 	]*YYEMPTY' parse.c >>parse.h
+	cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o p$$$$.c parse.y ; \
+	grep '^#define[ 	]*YYEMPTY' p$$$$.c >> p$$$$.h ; \
+	mv -f p$$$$.c $(PARSE_C) ; mv -f p$$$$.h $(PARSE_H)
 #$(PARSE_C) $(PARSE_H) : stamp-parse ; @true
 #stamp-parse: $(srcdir)/parse.y
 #	@echo $(CONFLICTS)
diff -rup orig/egcs-CVS20001012/gcc/java/Make-lang.in egcs-CVS20001012/gcc/java/Make-lang.in
--- orig/egcs-CVS20001012/gcc/java/Make-lang.in	Sun Oct  1 15:52:28 2000
+++ egcs-CVS20001012/gcc/java/Make-lang.in	Fri Oct 13 11:24:08 2000
@@ -122,12 +122,14 @@ JAVABISONFLAGS = --name-prefix=java_
 
 $(PARSE_C):  $(srcdir)/java/parse.y
 	$(SET_BISON); \
-	cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) $(JAVABISONFLAGS) \
-	    -o parse.c $(PARSE_RELDIR)/parse.y
+	cd $(PARSE_DIR) ; $$bison -t $(BISONFLAGS) $(JAVABISONFLAGS) \
+	    -o p$$$$.c $(PARSE_RELDIR)/parse.y ; \
+	mv -f p$$$$.c parse.c
 $(PARSE_SCAN_C):  $(srcdir)/java/parse-scan.y
 	$(SET_BISON); \
-	cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) -o parse-scan.c \
-	    $(PARSE_RELDIR)/parse-scan.y
+	cd $(PARSE_DIR) ; $$bison -t $(BISONFLAGS) -o ps$$$$.c \
+	    $(PARSE_RELDIR)/parse-scan.y ; \
+	mv -f ps$$$$.c parse-scan.c
 
 # This must be kept in sync with dependencies in Makefile.in.
 JV_SCAN_SOURCES = $(srcdir)/java/parse-scan.y $(srcdir)/java/lex.c \
diff -rup orig/egcs-CVS20001012/gcc/java/Makefile.in egcs-CVS20001012/gcc/java/Makefile.in
--- orig/egcs-CVS20001012/gcc/java/Makefile.in	Sat Oct  7 09:53:38 2000
+++ egcs-CVS20001012/gcc/java/Makefile.in	Fri Oct 13 11:24:08 2000
@@ -230,12 +230,14 @@ PARSE_H = $(srcdir)/parse.h
 
 $(PARSE_C):  $(srcdir)/parse.y
 	$(SET_BISON); \
-	cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) $(JAVABISONFLAGS) \
-	    -o parse.c $(PARSE_RELDIR)/parse.y
+	cd $(PARSE_DIR) ; $$bison -t $(BISONFLAGS) $(JAVABISONFLAGS) \
+	    -o p$$$$.c $(PARSE_RELDIR)/parse.y ; \
+	mv -f p$$$$.c parse.c
 $(PARSE_SCAN_C):  $(srcdir)/parse-scan.y
 	$(SET_BISON); \
-	cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) -o parse-scan.c \
-	    $(PARSE_RELDIR)/parse-scan.y
+	cd $(PARSE_DIR) ; $$bison -t $(BISONFLAGS) -o ps$$$$.c \
+	    $(PARSE_RELDIR)/parse-scan.y ; \
+	mv -f ps$$$$.c parse-scan.c
 
 lex.c: keyword.h lex.h
 
diff -rup orig/egcs-CVS20001012/gcc/objc/Make-lang.in egcs-CVS20001012/gcc/objc/Make-lang.in
--- orig/egcs-CVS20001012/gcc/objc/Make-lang.in	Sun Sep 17 11:00:53 2000
+++ egcs-CVS20001012/gcc/objc/Make-lang.in	Fri Oct 13 11:24:08 2000
@@ -75,7 +75,8 @@ objc-parse.o : $(srcdir)/objc/objc-parse
 $(INTL_TARGETS): $(srcdir)/objc/objc-parse.c
 $(srcdir)/objc/objc-parse.c : $(srcdir)/objc/objc-parse.y
 	cd $(srcdir)/objc; \
-	$(BISON) $(BISONFLAGS) -o objc-parse.c objc-parse.y
+	$(BISON) $(BISONFLAGS) -o op$$$$.c objc-parse.y ; \
+	mv -f op$$$$.c objc-parse.c
 
 $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in
 	echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y


More information about the Gcc-patches mailing list