Skip to content

EBMC: include git commit in version #1118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endif
hw-cbmc.dir: trans-word-level.dir trans-netlist.dir verilog.dir \
vhdl.dir smvlang.dir cprover.dir temporal-logic.dir

vlindex.dir: cprover.dir verilog.dir
vlindex.dir: ebmc.dir cprover.dir verilog.dir

# building cbmc proper
.PHONY: cprover.dir
Expand Down
1 change: 1 addition & 0 deletions src/config.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EBMC_VERSION = 5.7
18 changes: 17 additions & 1 deletion src/ebmc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SRC = \
ebmc_parse_options.cpp \
ebmc_properties.cpp \
ebmc_solver_factory.cpp \
ebmc_version.cpp \
instrument_past.cpp \
k_induction.cpp \
liveness_to_safety.cpp \
Expand Down Expand Up @@ -69,12 +70,27 @@ endif
include ../config.inc
include ../common

# get version from git
GIT_INFO = $(shell git describe --tags --always --dirty || echo "n/a")
RELEASE_INFO = const char *EBMC_VERSION="$(EBMC_VERSION) ($(GIT_INFO))";
GIT_INFO_FILE = ebmc_version.cpp

$(GIT_INFO_FILE):
echo '$(RELEASE_INFO)' > $@

# mark the actually generated file as a phony target to enforce a rebuild - but
# only if the version information has changed!
KNOWN_RELEASE_INFO = $(shell cat $(GIT_INFO_FILE) 2>/dev/null)
ifneq ($(RELEASE_INFO), $(KNOWN_RELEASE_INFO))
.PHONY: $(GIT_INFO_FILE)
endif

ifneq ($(wildcard ../vhdl/Makefile),)
OBJ += ../vhdl/vhdl$(LIBEXT)
CXXFLAGS += -DHAVE_VHDL
endif

CLEANFILES = ebmc$(EXEEXT)
CLEANFILES = $(GIT_INFO_FILE) ebmc$(EXEEXT)

all: ebmc$(EXEEXT)

Expand Down
14 changes: 7 additions & 7 deletions src/ebmc/ebmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,13 @@ Function: ebmc_parse_optionst::help

void ebmc_parse_optionst::help()
{
std::cout <<
"\n"
"* * EBMC - Copyright (C) 2001-2017 Daniel Kroening * *\n"
"* * Version " EBMC_VERSION " * *\n"
"* * University of Oxford, Computer Science Department * *\n"
"* * [email protected] * *\n"
"\n";
std::cout
<< '\n'
<< banner_string("EBMC", EBMC_VERSION) << '\n'
<< "* * EBMC - Copyright (C) 2001-2017 Daniel Kroening * *\n"
"* * University of Oxford, Computer Science Department * *\n"
"* * [email protected] * *\n"
"\n";

std::cout << help_formatter(
// clang-format off
Expand Down
2 changes: 1 addition & 1 deletion src/ebmc/ebmc_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ebmc_parse_optionst:public parse_options_baset
argc,
argv,
std::string("EBMC ") + EBMC_VERSION),
ui_message_handler(cmdline, "EBMC " EBMC_VERSION)
ui_message_handler(cmdline, std::string("EBMC ") + EBMC_VERSION)
{
}

Expand Down
6 changes: 3 additions & 3 deletions src/ebmc/ebmc_solver_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ebmc_solver_factoryt ebmc_solver_factory(const cmdlinet &cmdline)
auto dec = std::make_unique<smt2_convt>(
ns,
"ebmc",
"Generated by EBMC " EBMC_VERSION,
std::string("Generated by EBMC ") + EBMC_VERSION,
"QF_AUFBV",
smt2_solver.value(),
*outfile_ptr);
Expand All @@ -118,7 +118,7 @@ ebmc_solver_factoryt ebmc_solver_factory(const cmdlinet &cmdline)
return ebmc_solvert{std::make_unique<smt2_convt>(
ns,
"ebmc",
"Generated by EBMC " EBMC_VERSION,
std::string("Generated by EBMC ") + EBMC_VERSION,
"QF_AUFBV",
smt2_solver.value(),
std::cout)};
Expand All @@ -128,7 +128,7 @@ ebmc_solver_factoryt ebmc_solver_factory(const cmdlinet &cmdline)
return ebmc_solvert{std::make_unique<smt2_dect>(
ns,
"ebmc",
"Generated by EBMC " EBMC_VERSION,
std::string("Generated by EBMC ") + EBMC_VERSION,
"QF_AUFBV",
smt2_solver.value(),
message_handler)};
Expand Down
2 changes: 1 addition & 1 deletion src/ebmc/ebmc_version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define EBMC_VERSION "5.7"
extern const char *EBMC_VERSION;
1 change: 1 addition & 0 deletions src/vlindex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SRC = \
OBJ+= $(CPROVER_DIR)/util/util$(LIBEXT) \
$(CPROVER_DIR)/langapi/langapi$(LIBEXT) \
$(CPROVER_DIR)/big-int/big-int$(LIBEXT) \
../ebmc/ebmc_version$(OBJEXT) \
../verilog/verilog$(LIBEXT)

include ../config.inc
Expand Down
5 changes: 2 additions & 3 deletions src/vlindex/vlindex_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ void vlindex_parse_optionst::help()
{
std::cout
<< "\n"
"* * VLINDEX - Copyright (C) 2024 * *\n"
"* * Version " EBMC_VERSION
" * *\n"
<< banner_string("VLINDEX", EBMC_VERSION) << '\n'
<< "* * Copyright (C) 2024 * *\n"
"* * [email protected] * *\n"
"\n";

Expand Down
2 changes: 1 addition & 1 deletion src/vlindex/vlindex_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class vlindex_parse_optionst : public parse_options_baset
argc,
argv,
std::string("EBMC ") + EBMC_VERSION),
ui_message_handler(cmdline, "EBMC " EBMC_VERSION)
ui_message_handler(cmdline, std::string("EBMC ") + EBMC_VERSION)
{
}

Expand Down
Loading