Permalink
Browse files

Keep source code version information in version files.

Rather then spread VERSION= defines throughout all the makefiles, put
the base version in version_base.in. Use that to generate a version.h
that includes the base version as well as the detailed version.
  • Loading branch information...
1 parent eaea529 commit 90a4ddebbadbaa1b3cfa36a28775b9717f7c8359 @steveicarus committed Jan 6, 2009
View
@@ -18,30 +18,16 @@
#
SHELL = /bin/sh
-# Normally, the "make" will build all the files only by dependencies.
-# The MODE, however, can control your rebuild intentions. The proper way
-# to use the MODE is on the make command like, this this:
+# The interesting make targets are:
#
-# make MODE=XXXX all
+# make version
+# Force the version_tag.h file to be rebuilt. Otherwise, it will only
+# be built if it is missing.
#
-# The possible MODE= values are:
+# make all
+# make install
#
-# regular
-# Build as normal
-#
-# full
-# Do some extra builds. in particular:
-# Build version.h again, even if it already exists.
-#
-MODE=regular
-
-# This version string is only used in the version message printed
-# by the compiler. It reflects the assigned version number for the
-# product as a whole. Most components also print the CVS Name: token
-# in order to get a more automatic version stamp as well.
-VERSION = 0.9.devel
-
-# This string is used as an installation suffix. It modifies certain
+# The "suffix" is used as an installation suffix. It modifies certain
# key install paths/files such that a build and install of Icarus Verilog
# with the same $(prefix) but a different $(suffix) will not interfere.
# The normal configuratin leaves suffix empty
@@ -80,13 +66,13 @@ MAN = @MAN@
PS2PDF = @PS2PDF@
GIT = @GIT@
-CPPFLAGS = @DEFS@ -I. -I$(srcdir) -DVERSION='"$(VERSION)"' @CPPFLAGS@
+CPPFLAGS = @DEFS@ -I. -I$(srcdir) @CPPFLAGS@
CXXFLAGS = -Wall @CXXFLAGS@
PICFLAGS = @PICFLAG@
LDFLAGS = @rdynamic@ @LDFLAGS@
all: dep config.h _pli_types.h version.h ivl@EXEEXT@
- for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) VERSION=$(VERSION) $@); done
+ for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
# In the windows world, the installer will need a dosify program to
# dosify text files.
@@ -219,30 +205,33 @@ iverilog-vpi.ps: $(srcdir)/iverilog-vpi.man
iverilog-vpi.pdf: iverilog-vpi.ps
$(PS2PDF) iverilog-vpi.ps iverilog-vpi.pdf
+# The version.h header file is the concatenation of a relatively static
+# base version and the detailed version tag.
+version.h: $(srcdir)/version_base.in version_tag.h
+ cat $(srcdir)/version_base.in version_tag.h > version.h
+
# For VERSION_TAG in driver/main.c, first try git-describe, then look for a
# version.h file in the source tree (included in snapshots and releases), and
# finally use nothing.
-ifeq ($(MODE),full)
-.PHONY: version.h
-endif
+
# "true" and "false" in the next few lines are Unix shell command names
ifeq ($(GIT),none)
GIT_PRESENT = false
else
GIT_PRESENT = true
endif
-version.h:
+version_tag.h version:
@if $(GIT_PRESENT) && test -d $(srcdir)/.git; then \
echo "Using git-describe for VERSION_TAG"; \
tmp=`$(GIT) --git-dir $(srcdir)/.git describe \
| sed -e 's;\(.*\);#define VERSION_TAG "\1";'`; \
- echo "$$tmp" | diff - $@ > /dev/null 2>&1 || echo "$$tmp" > $@ || exit 1; \
- elif test -r $(srcdir)/$@; then \
- echo "Using $(srcdir)/$@ for VERSION_TAG"; \
- diff $(srcdir)/$@ $@ > /dev/null 2>&1 || cp $(srcdir)/$@ $@; \
+ echo "$$tmp" | diff - version_tag.h > /dev/null 2>&1 || echo "$$tmp" > version_tag.h || exit 1; \
+ elif test -r $(srcdir)/version_tag.h; then \
+ echo "Using $(srcdir)/version_tag.h for VERSION_TAG"; \
+ diff $(srcdir)/version_tag.h version_tag.h > /dev/null 2>&1 || cp $(srcdir)/version_tag.h version_tag.h; \
else \
echo "Using empty VERSION_TAG"; \
- echo '#define VERSION_TAG ""' > $@; \
+ echo '#define VERSION_TAG ""' > version_tag.h; \
fi
ifeq (@MINGW32@,yes)
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
@@ -43,7 +41,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-CPPFLAGS = -I. -I$(srcdir)/.. -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@
+CPPFLAGS = -I. -I$(srcdir)/.. @CPPFLAGS@ @DEFS@
CFLAGS = -Wall @CFLAGS@
LDFLAGS = @LDFLAGS@
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
@@ -43,7 +41,7 @@ INSTALL_DATA = @INSTALL_DATA@
MAN = @MAN@
PS2PDF = @PS2PDF@
-CPPFLAGS = -I. -I.. -I$(srcdir)/.. -I$(srcdir) -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@
+CPPFLAGS = -I. -I.. -I$(srcdir)/.. -I$(srcdir) @CPPFLAGS@ @DEFS@
CFLAGS = -Wall @CFLAGS@
LDFLAGS = @LDFLAGS@
View
@@ -20,8 +20,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
@@ -39,7 +37,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-CPPFLAGS = -I. -I.. -I$(srcdir)/.. -I$(srcdir) -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@
+CPPFLAGS = -I. -I.. -I$(srcdir)/.. -I$(srcdir) @CPPFLAGS@ @DEFS@
CFLAGS = -Wall @CFLAGS@
LDFLAGS = @LDFLAGS@
@@ -76,4 +74,4 @@ uninstall:
rm -f $(DESTDIR)$(libdir)/ivl$(suffix)/ivlpp@EXEEXT@
lexor.o: lexor.c globals.h
-main.o: main.c globals.h
+main.o: main.c globals.h ../version.h
View
@@ -19,8 +19,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
@@ -36,7 +34,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-CPPFLAGS = -I.. -I$(srcdir)/.. -I$(srcdir) -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@ @PICFLAG@
+CPPFLAGS = -I.. -I$(srcdir)/.. -I$(srcdir) @CPPFLAGS@ @DEFS@ @PICFLAG@
CFLAGS = -Wall @CFLAGS@
LDFLAGS = @LDFLAGS@
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
prefix = @prefix@
exec_prefix = @exec_prefix@
srcdir = @srcdir@
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
@@ -37,7 +35,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-CPPFLAGS = -I.. -I$(srcdir)/.. -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@ @PICFLAG@
+CPPFLAGS = -I.. -I$(srcdir)/.. @CPPFLAGS@ @DEFS@ @PICFLAG@
CFLAGS = -Wall @CFLAGS@
LDFLAGS = @LDFLAGS@
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
prefix = @prefix@
exec_prefix = @exec_prefix@
srcdir = @srcdir@
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
@@ -38,7 +36,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-CPPFLAGS = -I. -I.. -I$(srcdir)/.. -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@ @PICFLAG@
+CPPFLAGS = -I. -I.. -I$(srcdir)/.. @CPPFLAGS@ @DEFS@ @PICFLAG@
CXXFLAGS = -Wall @CXXFLAGS@
LDFLAGS = @LDFLAGS@
View
@@ -21,8 +21,6 @@
#
SHELL = /bin/sh
-VERSION = 0.0
-
suffix = @install_suffix@
prefix = @prefix@
@@ -40,7 +38,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-CPPFLAGS = -I. -I.. -I$(srcdir)/.. -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@ @PICFLAG@
+CPPFLAGS = -I. -I.. -I$(srcdir)/.. @CPPFLAGS@ @DEFS@ @PICFLAG@
CFLAGS = -Wall @CFLAGS@
LDFLAGS = @LDFLAGS@
View
@@ -0,0 +1,7 @@
+#ifndef VERSION
+/*
+ * Edit this definition in version_base.in to define the base version
+ * number for the compiled result.
+ */
+#define VERSION "0.9.devel"
+#endif
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
View
@@ -18,8 +18,6 @@
#
SHELL = /bin/sh
-VERSION = 0.9.devel
-
suffix = @install_suffix@
prefix = @prefix@
@@ -47,7 +45,7 @@ YACC = @YACC@
MAN = @MAN@
PS2PDF = @PS2PDF@
-CPPFLAGS = -I. -I.. -I $(srcdir) -I$(srcdir)/.. -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@
+CPPFLAGS = -I. -I.. -I $(srcdir) -I$(srcdir)/.. @CPPFLAGS@ @DEFS@
CXXFLAGS = -Wall @CXXFLAGS@
LDFLAGS = @rdynamic@ @LDFLAGS@
LIBS = @LIBS@ @EXTRALIBS@

0 comments on commit 90a4dde

Please sign in to comment.