Skip to content

Commit

Permalink
Unify the version stamp in the version_*.h header files.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
steveicarus committed Nov 27, 2009
1 parent f07577d commit 966e29d
Show file tree
Hide file tree
Showing 22 changed files with 177 additions and 47 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 15 additions & 11 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ mandir = @mandir@
dllib=@DLLIB@

CC = @CC@
HOSTCC = @CC@
CXX = @CXX@
INSTALL = @INSTALL@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion driver-vpi/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
#
Expand Down
4 changes: 2 additions & 2 deletions driver-vpi/res.rc → driver-vpi/res.rc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
18 changes: 11 additions & 7 deletions driver/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion driver/iverilog.man → driver/iverilog.man.in
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 2 additions & 1 deletion driver/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion iverilog-vpi.man → iverilog-vpi.man.in
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion ivlpp/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion ivlpp/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion tgt-null/null.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
3 changes: 2 additions & 1 deletion tgt-stub/stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion tgt-vhdl/vhdl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 2 additions & 1 deletion tgt-vvp/vvp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
88 changes: 88 additions & 0 deletions version.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright (c) 2009 Stephen Williams ([email protected])
*
* 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 changes: 19 additions & 0 deletions version_base.h
Original file line number Diff line number Diff line change
@@ -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
7 changes: 0 additions & 7 deletions version_base.in

This file was deleted.

5 changes: 3 additions & 2 deletions vpi/vams_simparam.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit 966e29d

Please sign in to comment.