Skip to content

Commit 479d2ad

Browse files
committed
EBMC: include git commit in version
To distinguish in-between release builds from releases, include the git commit in the version output, using the same style as CBMC.
1 parent 2d61d66 commit 479d2ad

10 files changed

+28
-10
lines changed

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ endif
2424
hw-cbmc.dir: trans-word-level.dir trans-netlist.dir verilog.dir \
2525
vhdl.dir smvlang.dir cprover.dir temporal-logic.dir
2626

27-
vlindex.dir: cprover.dir verilog.dir
27+
vlindex.dir: ebmc.dir cprover.dir verilog.dir
2828

2929
# building cbmc proper
3030
.PHONY: cprover.dir

src/config.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
EBMC_VERSION = 5.7

src/ebmc/Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ SRC = \
1616
ebmc_parse_options.cpp \
1717
ebmc_properties.cpp \
1818
ebmc_solver_factory.cpp \
19+
ebmc_version.cpp \
1920
instrument_past.cpp \
2021
k_induction.cpp \
2122
liveness_to_safety.cpp \
@@ -69,12 +70,27 @@ endif
6970
include ../config.inc
7071
include ../common
7172

73+
# get version from git
74+
GIT_INFO = $(shell git describe --tags --always --dirty || echo "n/a")
75+
RELEASE_INFO = const char *EBMC_VERSION="$(EBMC_VERSION) ($(GIT_INFO))";
76+
GIT_INFO_FILE = ebmc_version.cpp
77+
78+
$(GIT_INFO_FILE):
79+
echo '$(RELEASE_INFO)' > $@
80+
81+
# mark the actually generated file as a phony target to enforce a rebuild - but
82+
# only if the version information has changed!
83+
KNOWN_RELEASE_INFO = $(shell cat $(GIT_INFO_FILE) 2>/dev/null)
84+
ifneq ($(RELEASE_INFO), $(KNOWN_RELEASE_INFO))
85+
.PHONY: $(GIT_INFO_FILE)
86+
endif
87+
7288
ifneq ($(wildcard ../vhdl/Makefile),)
7389
OBJ += ../vhdl/vhdl$(LIBEXT)
7490
CXXFLAGS += -DHAVE_VHDL
7591
endif
7692

77-
CLEANFILES = ebmc$(EXEEXT)
93+
CLEANFILES = $(GIT_INFO_FILE) ebmc$(EXEEXT)
7894

7995
all: ebmc$(EXEEXT)
8096

src/ebmc/ebmc_parse_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void ebmc_parse_optionst::help()
347347
std::cout <<
348348
"\n"
349349
"* * EBMC - Copyright (C) 2001-2017 Daniel Kroening * *\n"
350-
"* * Version " EBMC_VERSION " * *\n"
350+
"* * Version " << EBMC_VERSION << " * *\n"
351351
"* * University of Oxford, Computer Science Department * *\n"
352352
"* * [email protected] * *\n"
353353
"\n";

src/ebmc/ebmc_parse_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ebmc_parse_optionst:public parse_options_baset
5555
argc,
5656
argv,
5757
std::string("EBMC ") + EBMC_VERSION),
58-
ui_message_handler(cmdline, "EBMC " EBMC_VERSION)
58+
ui_message_handler(cmdline, std::string("EBMC ")+EBMC_VERSION)
5959
{
6060
}
6161

src/ebmc/ebmc_solver_factory.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ ebmc_solver_factoryt ebmc_solver_factory(const cmdlinet &cmdline)
9292
auto dec = std::make_unique<smt2_convt>(
9393
ns,
9494
"ebmc",
95-
"Generated by EBMC " EBMC_VERSION,
95+
std::string("Generated by EBMC ") + EBMC_VERSION,
9696
"QF_AUFBV",
9797
smt2_solver.value(),
9898
*outfile_ptr);
@@ -118,7 +118,7 @@ ebmc_solver_factoryt ebmc_solver_factory(const cmdlinet &cmdline)
118118
return ebmc_solvert{std::make_unique<smt2_convt>(
119119
ns,
120120
"ebmc",
121-
"Generated by EBMC " EBMC_VERSION,
121+
std::string("Generated by EBMC ") + EBMC_VERSION,
122122
"QF_AUFBV",
123123
smt2_solver.value(),
124124
std::cout)};
@@ -128,7 +128,7 @@ ebmc_solver_factoryt ebmc_solver_factory(const cmdlinet &cmdline)
128128
return ebmc_solvert{std::make_unique<smt2_dect>(
129129
ns,
130130
"ebmc",
131-
"Generated by EBMC " EBMC_VERSION,
131+
std::string("Generated by EBMC ") + EBMC_VERSION,
132132
"QF_AUFBV",
133133
smt2_solver.value(),
134134
message_handler)};

src/ebmc/ebmc_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define EBMC_VERSION "5.7"
1+
extern const char *EBMC_VERSION;

src/vlindex/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ SRC = \
88
OBJ+= $(CPROVER_DIR)/util/util$(LIBEXT) \
99
$(CPROVER_DIR)/langapi/langapi$(LIBEXT) \
1010
$(CPROVER_DIR)/big-int/big-int$(LIBEXT) \
11+
../ebmc/ebmc_version$(OBJEXT) \
1112
../verilog/verilog$(LIBEXT)
1213

1314
include ../config.inc

src/vlindex/vlindex_parse_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void vlindex_parse_optionst::help()
8080
std::cout
8181
<< "\n"
8282
"* * VLINDEX - Copyright (C) 2024 * *\n"
83-
"* * Version " EBMC_VERSION
83+
"* * Version " << EBMC_VERSION <<
8484
" * *\n"
8585
"* * [email protected] * *\n"
8686
"\n";

src/vlindex/vlindex_parse_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class vlindex_parse_optionst : public parse_options_baset
3535
argc,
3636
argv,
3737
std::string("EBMC ") + EBMC_VERSION),
38-
ui_message_handler(cmdline, "EBMC " EBMC_VERSION)
38+
ui_message_handler(cmdline, std::string("EBMC ") + EBMC_VERSION)
3939
{
4040
}
4141

0 commit comments

Comments
 (0)