This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] document the use of stamps in gcc/Makefile.in


:ADDPATCH build:
Rafael

2005-10-24  Rafael Ávila de Espíndola  <rafael.espindola@gmail.com>

                  * gcc/Makefile.in: Documented the use of stamps
Index: gcc/Makefile.in
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1547
diff -u -3 -p -u -r1.1547 Makefile.in
--- gcc/Makefile.in	12 Oct 2005 12:38:00 -0000	1.1547
+++ gcc/Makefile.in	24 Oct 2005 16:32:47 -0000
@@ -1088,6 +1088,39 @@ endif
 # Rebuilding this configuration
 # -----------------------------
 
+# On the use of stamps:
+# if a target "a" depends on "b", one usually writes
+# a: b
+# 	command b -o a
+#
+# but if "a" doesn't change every time "b" changes, it would the nice if targets that
+# depend on "a" wouldn't be rebuild unnecessarily. To make this, "a" must not be
+# overwritten with a identical copy. One solution is to use a temporary file
+# a:b
+# 	command b -o a.temp
+# 	move-if-change a.temp a
+#
+# This solution has a different problem. Since the time stamp of a is unchanged, make
+# will try to update "a" every time it runs. To prevent this, one can add a stamp
+# a: s-a
+# s-a: b
+# 	command b -o a.temp
+# 	move-if-change a.temp a
+# 	$(STAMP) s-a
+#
+# The problem with this solution is that make thinks that "a" is always unchanged.
+# make must be deceived into thinking that "a" is rebuild by the "a: s-a" rule.
+# To do this, add a dummy command
+# a: s-a ; @true
+# s-a: b
+# 	command b -o a.temp
+# 	move-if-change a.temp a
+# 	$(STAMP) s-a
+#
+# This is what is done in this makefile. Note that mkconfig.sh has a move-if-change
+# built-in
+
+
 Makefile: config.status $(srcdir)/Makefile.in $(LANG_MAKEFRAGS)
 	LANGUAGES="$(CONFIG_LANGUAGES)" \
 	CONFIG_HEADERS= \
@@ -2690,9 +2723,7 @@ s-output : $(MD_DEPS) build/genoutput$(b
 
 genrtl.o : genrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
   $(GGC_H)
-genrtl.c genrtl.h : s-genrtl
-	@true	# force gnu make to recheck modification times.
-
+genrtl.c genrtl.h : s-genrtl; @true
 s-genrtl: build/gengenrtl$(build_exeext)
 	$(RUN_GEN) build/gengenrtl$(build_exeext) -h > tmp-genrtl.h
 	$(SHELL) $(srcdir)/../move-if-change tmp-genrtl.h genrtl.h

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]