Unify the version stamp in the version_*.h header files.

Try to put all the version stamps into common version_base.h
and version_stamp.h header files. All the source programs then
get their version from these header files.

Also handle the version stamps in the man pages by using the
version_*.h header file contents to edit the version strings
in the man page title bar markers.
This commit is contained in:
Stephen Williams 2009-11-27 09:25:50 -08:00
parent f07577db11
commit 966e29db3b
22 changed files with 177 additions and 47 deletions

5
.gitignore vendored
View File

@ -62,6 +62,11 @@ dep
# Program created files
/vvp/tables.cc
/iverilog-vpi.man
/driver-vpi/res.rc
/driver/iverilog.man
/vvp/vvp.man
# The executables.
*.exe
/driver/iverilog

View File

@ -55,6 +55,7 @@ mandir = @mandir@
dllib=@DLLIB@
CC = @CC@
HOSTCC = @CC@
CXX = @CXX@
INSTALL = @INSTALL@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -71,7 +72,7 @@ CXXFLAGS = -Wall @CXXFLAGS@
PICFLAGS = @PICFLAG@
LDFLAGS = @rdynamic@ @LDFLAGS@
all: dep config.h _pli_types.h version.h ivl@EXEEXT@
all: dep config.h _pli_types.h version_tag.h ivl@EXEEXT@
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
# In the windows world, the installer will need a dosify program to
@ -96,10 +97,11 @@ ifeq (@MINGW32@,no)
(cd driver-vpi ; $(MAKE) $@)
endif
rm -f *.o parse.cc parse.h lexor.cc
rm -f ivl.exp iverilog-vpi.pdf iverilog-vpi.ps parse.output
rm -f ivl.exp iverilog-vpi.man iverilog-vpi.pdf iverilog-vpi.ps parse.output
rm -f syn-rules.output dosify.exe ivl@EXEEXT@ check.vvp
rm -f lexor_keyword.cc libivl.a libvpi.a iverilog-vpi syn-rules.cc
rm -rf dep
rm version.exe
distclean: clean
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
@ -184,6 +186,9 @@ iverilog-vpi: iverilog-vpi.sh Makefile
chmod +x $@
endif
version.exe: $(srcdir)/version.c $(srcdir)/version_base.h version_tag.h
$(HOSTCC) -o version.exe -I. -I$(srcdir) $(srcdir)/version.c
dep:
mkdir dep
@ -211,17 +216,16 @@ lexor_keyword.o: lexor_keyword.cc parse.h
lexor_keyword.cc: lexor_keyword.gperf
gperf -o -i 7 -C -k 1-4,$$ -L ANSI-C -H keyword_hash -N check_identifier -t $(srcdir)/lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false)
iverilog-vpi.ps: $(srcdir)/iverilog-vpi.man
$(MAN) -t $(srcdir)/iverilog-vpi.man > iverilog-vpi.ps
iverilog-vpi.man: $(srcdir)/iverilog-vpi.man.in version.exe
./version.exe `head -1 $(srcdir)/iverilog-vpi.man.in`'\n' > $@
tail +2 $(srcdir)/iverilog-vpi.man.in >> $@
iverilog-vpi.ps: iverilog-vpi.man
$(MAN) -t iverilog-vpi.man > iverilog-vpi.ps
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.
@ -299,8 +303,8 @@ $(includedir)/acc_user.h: $(srcdir)/acc_user.h
$(includedir)/veriuser.h: $(srcdir)/veriuser.h
$(INSTALL_DATA) $(srcdir)/veriuser.h "$(DESTDIR)$(includedir)/veriuser.h"
$(mandir)/man1/iverilog-vpi$(suffix).1: $(srcdir)/iverilog-vpi.man
$(INSTALL_DATA) $(srcdir)/iverilog-vpi.man "$(DESTDIR)$(mandir)/man1/iverilog-vpi$(suffix).1"
$(mandir)/man1/iverilog-vpi$(suffix).1: iverilog-vpi.man
$(INSTALL_DATA) iverilog-vpi.man "$(DESTDIR)$(mandir)/man1/iverilog-vpi$(suffix).1"
$(prefix)/iverilog-vpi$(suffix).pdf: iverilog-vpi.pdf
$(INSTALL_DATA) iverilog-vpi.pdf "$(DESTDIR)$(prefix)/iverilog-vpi$(suffix).pdf"

View File

@ -50,7 +50,7 @@ all: iverilog-vpi@EXEEXT@
check: all
clean:
rm -f *.o config.h iverilog-vpi@EXEEXT@
rm -f *.o config.h iverilog-vpi@EXEEXT@ res.rc
distclean: clean
rm -f Makefile config.log
@ -74,6 +74,10 @@ config.h: $(srcdir)/config.h.in Makefile
-e 's;@SHARED@;@shared@;' $< > $@
# Windows specific...
res.rc: $(srcdir)/res.rc.in ../version.exe
sed -e 's;@PRODUCTVERSION@;'`../version.exe '%M,%m,%n,0'`';' \
$(srcdir)/res.rc.in > $@
res.o: res.rc
windres -i res.rc -o res.o
#

View File

@ -10,7 +10,7 @@ LANGUAGE 9, 4
1 VERSIONINFO
FILEVERSION 2002,11,13,0
PRODUCTVERSION 0,7,0,0
PRODUCTVERSION @PRODUCTVERSION@
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x2L
FILEOS 0x40004L
@ -28,7 +28,7 @@ BEGIN
VALUE "LegalCopyright", "Copyright 2002 Gus Baldauf\0"
VALUE "OriginalFilename", "iverilog-vpi.exe\0"
VALUE "ProductName", "Icarus Verilog\0"
VALUE "ProductVersion", "0, 7, 0, 0\0"
VALUE "ProductVersion", "@PRODUCTVERSION@\0"
END
END
BLOCK "VarFileInfo"

View File

@ -45,13 +45,13 @@ CPPFLAGS = -I. -I.. -I$(srcdir)/.. -I$(srcdir) @CPPFLAGS@ @DEFS@
CFLAGS = -Wall @CFLAGS@
LDFLAGS = @LDFLAGS@
all: dep iverilog@EXEEXT@
all: dep iverilog@EXEEXT@ iverilog.man
check: all
clean:
rm -f *.o cflexor.c cfparse.c cfparse.h cfparse.output
rm -f iverilog@EXEEXT@ iverilog.pdf iverilog.ps
rm -f iverilog@EXEEXT@ iverilog.man iverilog.pdf iverilog.ps
rm -rf dep
distclean: clean
@ -78,14 +78,18 @@ dep:
$(CC) $(CPPFLAGS) $(CFLAGS) -MD -c $< -o $*.o
mv $*.d dep
main.o: main.c globals.h ../version.h Makefile
main.o: main.c globals.h ../version_base.h ../version_tag.h Makefile
$(CC) $(CPPFLAGS) $(CFLAGS) -MD -c -DIVL_ROOT='"@libdir@/ivl$(suffix)"' -DIVL_INC='"@includedir@"' -DIVL_LIB='"@libdir@"' -DDLLIB='"@DLLIB@"' $(srcdir)/main.c
mv $*.d dep
cflexor.o: cflexor.c cfparse.h
iverilog.ps: $(srcdir)/iverilog.man
$(MAN) -t $(srcdir)/iverilog.man > iverilog.ps
iverilog.man: $(srcdir)/iverilog.man.in ../version.exe
../version.exe `head -1 $(srcdir)/iverilog.man.in`'\n' > $@
tail +2 $(srcdir)/iverilog.man.in >> $@
iverilog.ps: iverilog.man
$(MAN) -t iverilog.man > iverilog.ps
iverilog.pdf: iverilog.ps
$(PS2PDF) iverilog.ps iverilog.pdf
@ -112,8 +116,8 @@ install: all installdirs $(bindir)/iverilog$(suffix)@EXEEXT@ $(INSTALL_DOC)
$(bindir)/iverilog$(suffix)@EXEEXT@: ./iverilog@EXEEXT@
$(INSTALL_PROGRAM) ./iverilog@EXEEXT@ "$(DESTDIR)$(bindir)/iverilog$(suffix)@EXEEXT@"
$(mandir)/man1/iverilog$(suffix).1: $(srcdir)/iverilog.man
$(INSTALL_DATA) $(srcdir)/iverilog.man "$(DESTDIR)$(mandir)/man1/iverilog$(suffix).1"
$(mandir)/man1/iverilog$(suffix).1: iverilog.man
$(INSTALL_DATA) iverilog.man "$(DESTDIR)$(mandir)/man1/iverilog$(suffix).1"
$(prefix)/iverilog$(suffix).pdf: iverilog.pdf
$(INSTALL_DATA) iverilog.pdf "$(DESTDIR)$(prefix)/iverilog$(suffix).pdf"

View File

@ -1,4 +1,4 @@
.TH iverilog 1 "October 28th, 2009" "" "Version 0.10.devel"
.TH iverilog 1 "October 28th, 2009" "" "Version %M.%m.%n %E"
.SH NAME
iverilog - Icarus Verilog compiler

View File

@ -18,7 +18,8 @@
*/
# include "config.h"
# include "version.h"
# include "version_base.h"
# include "version_tag.h"
const char NOTICE[] =
" This program is free software; you can redistribute it and/or modify\n"

View File

@ -1,4 +1,4 @@
.TH iverilog-vpi 1 "April 17th, 2009" "" "Version 0.10.devel"
.TH iverilog-vpi 1 "April 17th, 2009" "" "Version %M.%m.%n %E"
.SH NAME
iverilog-vpi - Compile front end for VPI modules

View File

@ -74,4 +74,4 @@ uninstall:
rm -f "$(DESTDIR)$(libdir)/ivl$(suffix)/ivlpp@EXEEXT@"
lexor.o: lexor.c globals.h
main.o: main.c globals.h ../version.h
main.o: main.c globals.h ../version_base.h ../version_tag.h

View File

@ -18,7 +18,8 @@ const char COPYRIGHT[] =
*/
# include "config.h"
# include "version.h"
# include "version_base.h"
# include "version_tag.h"
const char NOTICE[] =
" This program is free software; you can redistribute it and/or modify\n"

View File

@ -20,7 +20,8 @@ const char COPYRIGHT[] =
*/
# include "config.h"
# include "version.h"
# include "version_base.h"
# include "version_tag.h"
const char NOTICE[] =
" This program is free software; you can redistribute it and/or modify\n"

View File

@ -17,7 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "version.h"
# include "version_base.h"
# include "version_tag.h"
# include "config.h"
# include <string.h>

View File

@ -24,7 +24,8 @@
* understand the behavior of the core as it uses a target module.
*/
# include "version.h"
# include "version_base.h"
# include "version_tag.h"
# include "config.h"
# include "priv.h"
# include <stdlib.h>

View File

@ -18,7 +18,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "version.h"
#include "version_base.h"
#include "version_tag.h"
#include "vhdl_target.h"
#include "state.hh"

View File

@ -17,7 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "version.h"
# include "version_base.h"
# include "version_tag.h"
# include "vvp_priv.h"
# include <string.h>
# include <assert.h>

88
version.c Normal file
View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2009 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "version_base.h"
# include "version_tag.h"
# include <stdio.h>
# include <string.h>
static void run_string(const char*txt)
{
const char*cp = txt;
while (*cp) {
if (cp[0] == '%' && cp[1] != 0) {
switch (cp[1]) {
case 'M':
fprintf(stdout, "%u", VERSION_MAJOR1);
break;
case 'm':
fprintf(stdout, "%u", VERSION_MAJOR2);
break;
case 'n':
fprintf(stdout, "%u", VERSION_MINOR);
break;
case 'E':
fprintf(stdout, "%s", VERSION_EXTRA);
break;
case 'T':
fprintf(stdout, "%s", VERSION_TAG);
break;
case '%':
putc('%', stdout);
break;
default:
break;
}
cp += 2;
} else if (cp[0] == '\\' && cp[1] != 0) {
switch (cp[1]) {
case 'n':
putc('\n', stdout);
break;
default:
putc(cp[1], stdout);
break;
}
cp += 2;
} else {
putc(cp[0], stdout);
cp += 1;
}
}
}
int main(int argc, char*argv[])
{
int idx;
if (argc == 1) {
printf("%s\n", VERSION);
return 0;
}
run_string(argv[1]);
for (idx = 2 ; idx < argc ; idx += 1) {
printf(" ");
run_string(argv[idx]);
}
return 0;
}

19
version_base.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef VERSION
/*
* Edit this definition in version_base.in to define the base version
* number for the compiled result.
*/
# define VERSION_MAJOR1 0
# define VERSION_MAJOR2 10
# define VERSION_MINOR 0
# define VERSION_EXTRA "(devel)"
/* This is a concatenation of MAJOR1.MAJOR2 that is used by
vams_simparam.c to make a double value. */
# define VERSION_MAJOR 0.10
# define VERSION_STRINGIFY(x) #x
# define VERSION_STR(a,b,extra) VERSION_STRINGIFY(a.b) " " extra
#define VERSION VERSION_STR(VERSION_MAJOR,VERSION_MINOR,VERSION_EXTRA)
#endif

View File

@ -1,7 +0,0 @@
#ifndef VERSION
/*
* Edit this definition in version_base.in to define the base version
* number for the compiled result.
*/
#define VERSION "0.10.0 (devel)"
#endif

View File

@ -26,6 +26,7 @@
#include <unistd.h>
#include <vpi_user.h>
#include "sys_priv.h"
#include "version_base.h"
/* Once we have real string objects replace this with a dynamic string. */
#define MAX_STRING_RESULT 1024
@ -149,9 +150,9 @@ static PLI_INT32 simparam_calltf(PLI_BYTE8 *name_ext)
} else if (strcmp(param, "shrink") == 0) {
retval = 0.0; /* Nothing for now. */
} else if (strcmp(param, "simulatorSubversion") == 0) {
retval = 0.0;
retval = VERSION_MINOR;
} else if (strcmp(param, "simulatorVersion") == 0) {
retval = 0.10;
retval = VERSION_MAJOR;
} else if (strcmp(param, "sourceScaleFactor") == 0) {
retval = 0.0; /* Nothing for now. */
} else if (strcmp(param, "tnom") == 0) {

View File

@ -54,11 +54,11 @@ dllib=@DLLIB@
MDIR1 = -DMODULE_DIR1=\"$(libdir)/ivl$(suffix)/.\"
all: dep vvp@EXEEXT@ libvpi.a
all: dep vvp@EXEEXT@ libvpi.a vvp.man
clean:
rm -f *.o *~ parse.cc parse.h lexor.cc tables.cc
rm -rf dep vvp@EXEEXT@ libvpi.a parse.output vvp.pdf vvp.exp
rm -rf dep vvp@EXEEXT@ libvpi.a parse.output vvp.man vvp.pdf vvp.exp
distclean: clean
rm -f Makefile config.log
@ -131,7 +131,11 @@ parse.h: parse.cc
lexor.cc: $(srcdir)/lexor.lex
$(LEX) -s -olexor.cc $(srcdir)/lexor.lex
vvp.pdf: $(srcdir)/vvp.man
vvp.man: $(srcdir)/vvp.man.in ../version.exe
../version.exe `head -1 $(srcdir)/vvp.man.in`'\n' > $@
tail +2 $(srcdir)/vvp.man.in >> $@
vvp.pdf: vvp.man
$(MAN) -t $(srcdir)/vvp.man | $(PS2PDF) - vvp.pdf
ifeq (@MINGW32@,yes)
@ -167,8 +171,8 @@ $(bindir)/vvp$(suffix)@EXEEXT@: ./vvp@EXEEXT@
$(libdir)/libvpi$(suffix).a : ./libvpi.a
$(INSTALL_DATA) libvpi.a "$(DESTDIR)$(libdir)/libvpi$(suffix).a"
$(mandir)/man1/vvp$(suffix).1: $(srcdir)/vvp.man
$(INSTALL_DATA) $(srcdir)/vvp.man "$(DESTDIR)$(mandir)/man1/vvp$(suffix).1"
$(mandir)/man1/vvp$(suffix).1: vvp.man
$(INSTALL_DATA) vvp.man "$(DESTDIR)$(mandir)/man1/vvp$(suffix).1"
$(prefix)/vvp$(suffix).pdf: vvp.pdf
$(INSTALL_DATA) vvp.pdf "$(DESTDIR)$(prefix)/vvp$(suffix).pdf"

View File

@ -17,7 +17,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
# include "version.h"
# include "version_base.h"
# include "version_tag.h"
# include "config.h"
# include "parse_misc.h"
# include "compile.h"

View File

@ -1,4 +1,4 @@
.TH vvp 1 "April 17th, 2009" "" "Version 0.10.devel"
.TH vvp 1 "April 17th, 2009" "" "Version %M.%m.%n %E"
.SH NAME
vvp - Icarus Verilog vvp runtime engine