Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v5] don't keep a gdb-specific date
@ 2013-06-21 17:33 Tom Tromey
  2013-06-21 18:00 ` Pedro Alves
                   ` (2 more replies)
  0 siblings, 3 replies; 39+ messages in thread
From: Tom Tromey @ 2013-06-21 17:33 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Right now there are two nightly commits to update a file in the tree
with the current date.  One commit is for BFD, one is for gdb.

It seems unnecessary to me to do this twice.  We can make do with a
single such commit.

This patch changes gdb in a minimal way to reuse the BFD date -- it
extracts it from bfd/version.h and changes version.in to use the
placeholder string "DATE" for those times when a date is wanted.

I propose removing the cron job that updates the version on trunk, and
then check in this patch.

For release branches, we can keep the cron job, but just tell it to
rewrite bfd/version.h.  I believe this is a simple change in the
crontab -- the script will work just fine on this file.

This also moves version.in and version.h into common/, to reflect
their shared status; and updates gdbserver to use version.h besides.

	* common/create-version.sh: New file.
	* Makefile.in (version.c): Use bfd/version.h, common/version.in,
	create-version.sh.
	(HFILES_NO_SRCDIR): Use common/version.h.
	* version.in: Move to ...
	* common/version.in: ... here.  Replace date with "DATE".
	* version.h: Move to ...
	* common/version.h: ... here.
gdbserver:
	* Makefile.in (version.c): Use bfd/version.h, common/version.in,
	create-version.sh.
	(version.o): Remove.
	* gdbreplay.c: Include version.h.
	(version, host_name): Don't declare.
	* server.h: Include version.h.
	(version, host_name): Don't declare.
doc:
	* Makefile.in (POD2MAN1, POD2MAN5): Use version.subst.
	(GDBvn.texi): Use version.subst.
	(version.subst): New target.
	(mostlyclean): Remove version.subst.
---
 gdb/Makefile.in              | 12 ++++--------
 gdb/common/create-version.sh | 38 ++++++++++++++++++++++++++++++++++++++
 gdb/common/version.h         | 31 +++++++++++++++++++++++++++++++
 gdb/common/version.in        |  1 +
 gdb/doc/Makefile.in          | 15 ++++++++++-----
 gdb/gdbserver/Makefile.in    | 10 +++-------
 gdb/gdbserver/gdbreplay.c    |  5 +----
 gdb/gdbserver/server.h       |  5 +----
 gdb/version.h                | 31 -------------------------------
 gdb/version.in               |  1 -
 10 files changed, 89 insertions(+), 60 deletions(-)
 create mode 100755 gdb/common/create-version.sh
 create mode 100644 gdb/common/version.h
 create mode 100644 gdb/common/version.in
 delete mode 100644 gdb/version.h
 delete mode 100644 gdb/version.in

diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index a6336a2..048b962 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -791,7 +791,7 @@ i386bsd-nat.h xml-support.h xml-tdesc.h alphabsd-tdep.h gdb_obstack.h \
 ia64-tdep.h ada-lang.h ada-varobj.h varobj.h frv-tdep.h nto-tdep.h serial.h \
 c-lang.h d-lang.h go-lang.h frame.h event-loop.h block.h cli/cli-setshow.h \
 cli/cli-decode.h cli/cli-cmds.h cli/cli-dump.h cli/cli-utils.h \
-cli/cli-script.h macrotab.h symtab.h version.h \
+cli/cli-script.h macrotab.h symtab.h common/version.h \
 gnulib/import/string.in.h gnulib/import/str-two-way.h \
 gnulib/import/stdint.in.h remote.h remote-notif.h gdb.h sparc-nat.h \
 gdbthread.h dwarf2-frame.h dwarf2-frame-tailcall.h nbsd-nat.h dcache.h \
@@ -1420,13 +1420,9 @@ $(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
-	rm -f version.c-tmp version.c
-	echo '#include "version.h"' >> version.c-tmp
-	echo 'const char version[] = "'"`sed q ${srcdir}/version.in`"'";' >> version.c-tmp
-	echo 'const char host_name[] = "$(host_alias)";' >> version.c-tmp
-	echo 'const char target_name[] = "$(target_alias)";' >> version.c-tmp
-	mv version.c-tmp version.c
+version.c: Makefile common/version.in $(srcdir)/../bfd/version.h $(srcdir)/common/create-version.sh
+	$(SHELL) $(srcdir)/common/create-version.sh $(srcdir) \
+	    $(host_alias) $(target_alias) version.c
 
 observer.h: observer.sh doc/observer.texi
 	${srcdir}/observer.sh h ${srcdir}/doc/observer.texi observer.h
diff --git a/gdb/common/create-version.sh b/gdb/common/create-version.sh
new file mode 100755
index 0000000..2d2bc74
--- /dev/null
+++ b/gdb/common/create-version.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Copyright (C) 1989-2013 Free Software Foundation, Inc.
+
+# This file is part of GDB.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Create version.c from version.in.
+# Usage:
+#    create-version.sh PATH-TO-GDB-SRCDIR HOST_ALIAS \
+#        TARGET_ALIAS OUTPUT-FILE-NAME
+
+srcdir="$1"
+host_alias="$2"
+target_alias="$3"
+output="$4"
+
+rm -f version.c-tmp $output version.tmp
+date=`sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$$/\1/p' $srcdir/../bfd/version.h`
+sed -e "s/DATE/$date/" < $srcdir/common/version.in > version.tmp
+echo '#include "version.h"' >> version.c-tmp
+echo 'const char version[] = "'"`sed q version.tmp`"'";' >> version.c-tmp
+echo 'const char host_name[] = "$host_alias";' >> version.c-tmp
+echo 'const char target_name[] = "$target_alias";' >> version.c-tmp
+mv version.c-tmp $output
+rm -f version.tmp
diff --git a/gdb/common/version.h b/gdb/common/version.h
new file mode 100644
index 0000000..94b577c
--- /dev/null
+++ b/gdb/common/version.h
@@ -0,0 +1,31 @@
+/* Version information for GDB.
+   Copyright (C) 1999-2013 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef VERSION_H
+#define VERSION_H
+
+/* Version number of GDB, as a string.  */
+extern const char version[];
+
+/* Canonical host name as a string.  */
+extern const char host_name[];
+
+/* Canonical target name as a string.  */
+extern const char target_name[];
+
+#endif /* #ifndef VERSION_H */
diff --git a/gdb/common/version.in b/gdb/common/version.in
new file mode 100644
index 0000000..99adaca
--- /dev/null
+++ b/gdb/common/version.in
@@ -0,0 +1 @@
+7.6.50.DATE-cvs
diff --git a/gdb/doc/Makefile.in b/gdb/doc/Makefile.in
index fdd57d6..d4ab738 100644
--- a/gdb/doc/Makefile.in
+++ b/gdb/doc/Makefile.in
@@ -172,9 +172,9 @@ TEXI2POD = perl $(srcdir)/../../etc/texi2pod.pl \
 		$(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS)
 
 POD2MAN1 = pod2man --center="GNU Development Tools" \
-		   --release="gdb-`sed q $(srcdir)/../version.in`" --section=1
+		   --release="gdb-`sed q version.subst`" --section=1
 POD2MAN5 = pod2man --center="GNU Development Tools" \
-		   --release="gdb-`sed q $(srcdir)/../version.in`" --section=5
+		   --release="gdb-`sed q version.subst`" --section=5
 
 # List of man pages generated from gdb.texi
 MAN1S = gdb.1 gdbserver.1 gcore.1
@@ -378,9 +378,9 @@ refcard.pdf : refcard.tex $(REFEDITS)
 	mv sedref.pdf refcard.pdf
 	rm -f sedref.log sedref.tex tmp.sed
 
-# File to record current GDB version number (copied from main dir version.in)
-GDBvn.texi : ${gdbdir}/version.in
-	echo "@set GDBVN `sed q $(srcdir)/../version.in`" > ./GDBvn.new
+# File to record current GDB version number.
+GDBvn.texi : version.subst
+	echo "@set GDBVN `sed q version.subst`" > ./GDBvn.new
 	if [ -n "$(PKGVERSION)" ]; then \
 	  echo "@set VERSION_PACKAGE $(PKGVERSION)" >> ./GDBvn.new; \
 	fi
@@ -396,6 +396,10 @@ GDBvn.texi : ${gdbdir}/version.in
 	fi
 	mv GDBvn.new GDBvn.texi
 
+version.subst: $(gdbdir)/common/version.in $(gdbdir)/../bfd/version.h
+	date=`sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$$/\1/p' $(gdbdir)/../bfd/version.h`; \
+	sed -e "s/DATE/$$date/" < $(gdbdir)/common/version.in > version.subst
+
 # Updated atomically
 .PRECIOUS: GDBvn.texi
 
@@ -649,6 +653,7 @@ mostlyclean:
 	rm -f $(STABS_TEX_TMPS)
 	rm -f $(ANNOTATE_TEX_TMPS)
 	rm -f sedref.dvi sedref.tex tmp.sed
+	rm -f version.subst
 
 clean: mostlyclean
 	rm -f gdb-cfg.texi GDBvn.texi
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index e8470a8..e5ecdd3 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -389,13 +389,9 @@ am--refresh:
 
 force:
 
-version.c: Makefile $(srcdir)/../version.in
-	rm -f version.c-tmp version.c
-	echo '#include "server.h"' >> version.c-tmp
-	echo 'const char version[] = "'"`sed q ${srcdir}/../version.in`"'";' >> version.c-tmp
-	echo 'const char host_name[] = "$(host_alias)";' >> version.c-tmp
-	mv version.c-tmp version.c
-version.o: version.c $(server_h)
+version.c: Makefile $(srcdir)/../common/version.in $(srcdir)/../../bfd/version.h $(srcdir)/../common/create-version.sh
+	$(SHELL) $(srcdir)/../common/create-version.sh $(srcdir)/.. \
+	    $(host_alias) $(target_alias) version.c
 
 xml-builtin.c: stamp-xml; @true
 stamp-xml: $(XML_DIR)/feature_to_c.sh Makefile $(XML_FILES)
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index 0aa52d8..c0d0c8f 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -19,6 +19,7 @@
 
 #include "config.h"
 #include "build-gnulib-gdbserver/config.h"
+#include "version.h"
 
 #include <stdio.h>
 #if HAVE_SYS_FILE_H
@@ -72,10 +73,6 @@ typedef int socklen_t;
 /* Sort of a hack... */
 #define EOL (EOF - 1)
 
-/* Version information, from version.c.  */
-extern const char version[];
-extern const char host_name[];
-
 static int remote_desc;
 
 #ifdef __MINGW32CE__
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 18d060c..c68c651 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -28,6 +28,7 @@
 
 #include "libiberty.h"
 #include "ansidecl.h"
+#include "version.h"
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -531,8 +532,4 @@ CORE_ADDR get_set_tsv_func_addr (void);
 extern CORE_ADDR current_insn_ptr;
 extern int emit_error;
 
-/* Version information, from version.c.  */
-extern const char version[];
-extern const char host_name[];
-
 #endif /* SERVER_H */
diff --git a/gdb/version.h b/gdb/version.h
deleted file mode 100644
index 94b577c..0000000
--- a/gdb/version.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Version information for GDB.
-   Copyright (C) 1999-2013 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef VERSION_H
-#define VERSION_H
-
-/* Version number of GDB, as a string.  */
-extern const char version[];
-
-/* Canonical host name as a string.  */
-extern const char host_name[];
-
-/* Canonical target name as a string.  */
-extern const char target_name[];
-
-#endif /* #ifndef VERSION_H */
diff --git a/gdb/version.in b/gdb/version.in
deleted file mode 100644
index 5af97ee..0000000
--- a/gdb/version.in
+++ /dev/null
@@ -1 +0,0 @@
-7.6.50.20130619-cvs
-- 
1.8.1.4


^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2013-06-28 18:11 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-21 17:33 [PATCH v5] don't keep a gdb-specific date Tom Tromey
2013-06-21 18:00 ` Pedro Alves
2013-06-24 14:56 ` Tom Tromey
2013-06-24 19:22   ` Joel Brobecker
2013-06-24 22:41   ` [commit] Fix host_name and target_name generation by common/create-version.sh Joel Brobecker
2013-06-24 22:59   ` [PATCH v5] don't keep a gdb-specific date Joel Brobecker
2013-06-24 23:58     ` [commit] Adapt sim to new version number & date locations Joel Brobecker
2013-06-25  0:52       ` Mike Frysinger
2013-06-25  1:53         ` Joel Brobecker
2013-06-25 15:51           ` Tom Tromey
2013-06-25 15:57             ` Tom Tromey
2013-06-25 15:46         ` Tom Tromey
2013-06-25 16:01           ` Eli Zaretskii
2013-06-25 15:28       ` Tom Tromey
2013-06-25 16:41         ` Mike Frysinger
2013-06-25  1:08     ` [PATCH v5] don't keep a gdb-specific date Hans-Peter Nilsson
2013-06-25 14:16       ` Tom Tromey
2013-06-25 14:25         ` Joel Brobecker
2013-06-25 14:43           ` Tom Tromey
2013-06-25 15:27             ` Tom Tromey
2013-06-26 11:23               ` sim checkout broken (was: [PATCH v5] don't keep a gdb-specific date) Hans-Peter Nilsson
2013-06-26 16:52                 ` sim checkout broken Tom Tromey
2013-06-26 17:58                   ` Hans-Peter Nilsson
2013-06-27  3:22                     ` Tom Tromey
2013-06-27  4:05                       ` Hans-Peter Nilsson
2013-06-27 15:22                         ` Tom Tromey
2013-06-27 16:30                           ` Tom Tromey
2013-06-27 17:09                             ` RFC: move common/version.in to gdb/ (Was: sim checkout broken) Tom Tromey
2013-06-28  3:18                               ` Hans-Peter Nilsson
2013-06-28 18:17                                 ` RFC: move common/version.in to gdb/ Tom Tromey
2013-06-27 17:27                             ` sim checkout broken Hans-Peter Nilsson
2013-06-27  8:19                       ` Andreas Schwab
2013-06-25 14:50         ` [PATCH v5] don't keep a gdb-specific date Pedro Alves
2013-06-25 14:53           ` Joel Brobecker
2013-06-25 15:01           ` Tom Tromey
2013-06-25 15:14             ` Pedro Alves
2013-06-26  2:45 ` Yao Qi
2013-06-26 16:06   ` Tom Tromey
2013-06-27  2:11     ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox