Skip to content

Commit 1621586

Browse files
author
Daniel Kroening
committed
move build commands for cbmc/version.h from common to cbmc/Makefile
1 parent 6fd77f4 commit 1621586

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/cbmc/Makefile

+18-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,24 @@ LIBS =
5959
include ../config.inc
6060
include ../common
6161

62-
CLEANFILES = cbmc$(EXEEXT)
62+
# get version from git
63+
GIT_INFO = $(shell git describe --tags --always --dirty || echo "n/a")
64+
RELEASE_INFO = \#define CBMC_VERSION "$(CBMC_VERSION) ($(GIT_INFO))"
65+
GIT_INFO_FILE = version.h
66+
67+
$(GIT_INFO_FILE):
68+
echo '$(RELEASE_INFO)' > $@
69+
70+
cbmc_parse_options$(OBJEXT): $(GIT_INFO_FILE)
71+
72+
# mark the actually generated file as a phony target to enforce a rebuild - but
73+
# only if the version information has changed!
74+
KNOWN_RELEASE_INFO = $(shell cat $(GIT_INFO_FILE) 2>/dev/null)
75+
ifneq ($(RELEASE_INFO), $(KNOWN_RELEASE_INFO))
76+
.PHONY: $(GIT_INFO_FILE)
77+
endif
78+
79+
CLEANFILES = cbmc$(EXEEXT) $(GIT_INFO_FILE)
6380

6481
all: cbmc$(EXEEXT)
6582

src/common

+1-18
Original file line numberDiff line numberDiff line change
@@ -227,29 +227,12 @@ OBJ += $(patsubst %.cc, %$(OBJEXT), $(filter %.cc, $(SRC)))
227227
%.obj:%.c
228228
$(CC) $(CP_CFLAGS) /nologo /c /EHsc $< /Fo$@
229229

230-
# get version from git
231-
GIT_INFO = $(shell git describe --tags --always --dirty || echo "n/a")
232-
RELEASE_INFO = \#define CBMC_VERSION "$(CBMC_VERSION) ($(GIT_INFO))"
233-
GIT_INFO_FILE = version.h
234-
235-
$(GIT_INFO_FILE):
236-
echo '$(RELEASE_INFO)' > $@
237-
238-
$(filter %_parse_options$(OBJEXT), $(OBJ)): $(GIT_INFO_FILE)
239-
240-
# mark the actually generated file as a phony target to enforce a rebuild - but
241-
# only of the version information has changed!
242-
KNOWN_RELEASE_INFO = $(shell cat $(GIT_INFO_FILE) 2>/dev/null)
243-
ifneq ($(RELEASE_INFO), $(KNOWN_RELEASE_INFO))
244-
.PHONY: $(GIT_INFO_FILE)
245-
endif
246-
247230
clean:
248231
$(RM) $(patsubst %.cpp, %$(OBJEXT), $(filter %.cpp, $(SRC))) \
249232
$(patsubst %.cpp, %$(DEPEXT), $(filter %.cpp, $(SRC))) \
250233
$(patsubst %.cc, %$(OBJEXT), $(filter %.cc, $(SRC))) \
251234
$(patsubst %.cc, %$(DEPEXT), $(filter %.cc, $(SRC))) \
252-
$(CLEANFILES) $(GIT_INFO_FILE)
235+
$(CLEANFILES)
253236

254237
.PHONY: first_target clean all
255238
.PHONY: sources generated_files

0 commit comments

Comments
 (0)