Between Bison releases, manually append `+' to the previous Bison

release number, and use that as a signal to automatically print the
ChangeLog's CVS Id keyword from --version.  Discussed starting at
<http://lists.gnu.org/archive/html/bison-patches/2006-05/msg00028.html>.
* ChangeLog: Add Id header.
* configure.ac (AC_INIT): Append `+' to `2.3'.
* src/.cvsignore: Add revision.c.
* src/Makefile.am (bison_SOURCES): Add revision.c and revision.h.
(BUILT_SOURCES): Add revision.c.
(revision.c): New target rule.  This file defines a new global variable
named revision.  It initializes it with either the Id from ChangeLog
or, if VERSION doesn't contain `+', with the empty string.
* src/getargs.c (version): Print the value of revision.
* src/revision.h: Extern revision.
This commit is contained in:
Joel E. Denny
2006-06-06 05:23:44 +00:00
parent 4ad3ed84f6
commit 7891a7c449
6 changed files with 62 additions and 2 deletions

View File

@@ -52,6 +52,7 @@ bison_SOURCES = \
print_graph.c print_graph.h \
reader.c reader.h \
reduce.c reduce.h \
revision.c revision.h \
relation.c relation.h \
scan-gram-c.c \
scan-skel-c.c scan-skel.h \
@@ -66,7 +67,7 @@ bison_SOURCES = \
EXTRA_bison_SOURCES = scan-skel.l scan-gram.l
BUILT_SOURCES = scan-skel.c scan-gram.c parse-gram.c parse-gram.h
BUILT_SOURCES = revision.c scan-skel.c scan-gram.c parse-gram.c parse-gram.h
MOSTLYCLEANFILES = yacc
@@ -78,6 +79,16 @@ yacc:
echo:
echo $(bison_SOURCES) $(noinst_HEADERS)
revision.c: $(top_srcdir)/configure $(top_srcdir)/ChangeLog
case "$(VERSION)" in \
*+*) sed -n \
's/^\$$\(Id.*\)\$$$$/const char *revision = "\1\\n";/p' \
$(top_srcdir)/ChangeLog \
;; \
*) echo 'const char *revision = "";' \
;; \
esac >$@
# The following rule is not designed to be portable,
# and relies on tools that not everyone has.