[RFA 05/10] Use a stamp file for version.c

Tom Tromey
2018-07-02T20:18:49Z

This introduces a stamp file for version.c, preventing unnecessary
version.o rebuilds.

2018-07-02 Tom Tromey <tom@tromey.com>

* Makefile.in (clean mostlyclean): Remove stamp-version.
(version.c): Depend on stamp-version.
(stamp-version): New rule, from version.c rule.
---
gdb/ChangeLog | 6 ++++++
gdb/Makefile.in | 12 +++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index d14e86727b8..fa93ac36c8f 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1948,7 +1948,7 @@ tags: TAGS
clean mostlyclean: $(CONFIG_CLEAN)
@$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do
rm -f *.o *.a $(ADD_FILES) *~ init.c-tmp init.l-tmp version.c-tmp
- rm -f init.c stamp-init version.c
+ rm -f init.c stamp-init version.c stamp-version
rm -f gdb$(EXEEXT) core make.log
rm -f gdb[0-9]$(EXEEXT)
rm -f test-cp-name-parser$(EXEEXT)
@@ -2138,9 +2138,15 @@ $(srcdir)/copying.c: @MAINTAINER_MODE_TRUE@ $(srcdir)/../COPYING3 $(srcdir)/copy
< $(srcdir)/../COPYING3 > $(srcdir)/copying.tmp
mv $(srcdir)/copying.tmp $(srcdir)/copying.c

-version.c: Makefile version.in $(srcdir)/../bfd/version.h $(srcdir)/common/create-version.sh
+version.c: stamp-version; @true
+# Note that the obvious names for the temp file are taken by
+# create-version.sh.
+stamp-version: Makefile version.in $(srcdir)/../bfd/version.h $(srcdir)/common/create-version.sh
$(ECHO_GEN) $(SHELL) $(srcdir)/common/create-version.sh $(srcdir) \
- $(host_alias) $(target_alias) version.c
+ $(host_alias) $(target_alias) version-t.t
+ @$(SHELL) $(srcdir)/../move-if-change version-t.t version.c
+ @echo stamp > stamp-version
+

lint: $(LINTFILES)
$(LINT) $(INCLUDE_CFLAGS) $(LINTFLAGS) $(LINTFILES) \
--
2.13.6