Skip to content

Commit 24915c8

Browse files
committed
mk: Move version info to top of main.mk
Just so it's easier to find.
1 parent 334af01 commit 24915c8

File tree

1 file changed

+33
-22
lines changed

1 file changed

+33
-22
lines changed

mk/main.mk

+33-22
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,39 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11+
######################################################################
12+
# Version numbers and strings
13+
######################################################################
14+
15+
# The version number
16+
CFG_RELEASE = 0.10-pre
17+
18+
# The version string plus commit information
19+
CFG_VERSION = $(CFG_RELEASE)
20+
CFG_GIT_DIR := $(CFG_SRC_DIR).git
21+
# since $(CFG_GIT) may contain spaces (especially on Windows),
22+
# we need to escape them. (" " to r"\ ")
23+
# Note that $(subst ...) ignores space after `subst`,
24+
# so we use a hack: define $(SPACE) which contains space character.
25+
SPACE :=
26+
SPACE +=
27+
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT))),)
28+
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
29+
CFG_VERSION += $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 \
30+
--pretty=format:'(%h %ci)')
31+
CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
32+
endif
33+
endif
34+
35+
# windows exe's need numeric versions - don't use anything but
36+
# numbers and dots here
37+
CFG_VERSION_WIN = $(subst -pre,,$(CFG_RELEASE))
38+
39+
40+
######################################################################
41+
# More configuration
42+
######################################################################
43+
1144
# We track all of the object files we might build so that we can find
1245
# and include all of the .d files in one fell swoop.
1346
ALL_OBJ_FILES :=
@@ -97,28 +130,6 @@ else
97130
CFG_VALGRIND_COMPILE :=
98131
endif
99132

100-
# version-string calculation
101-
CFG_GIT_DIR := $(CFG_SRC_DIR).git
102-
CFG_RELEASE = 0.10-pre
103-
CFG_VERSION = $(CFG_RELEASE)
104-
# windows exe's need numeric versions - don't use anything but
105-
# numbers and dots here
106-
CFG_VERSION_WIN = 0.10
107-
108-
# since $(CFG_GIT) may contain spaces (especially on Windows),
109-
# we need to escape them. (" " to r"\ ")
110-
# Note that $(subst ...) ignores space after `subst`,
111-
# so we use a hack: define $(SPACE) which contains space character.
112-
SPACE :=
113-
SPACE +=
114-
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT))),)
115-
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
116-
CFG_VERSION += $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 \
117-
--pretty=format:'(%h %ci)')
118-
CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
119-
endif
120-
endif
121-
122133
ifdef CFG_ENABLE_VALGRIND
123134
$(info cfg: enabling valgrind (CFG_ENABLE_VALGRIND))
124135
else

0 commit comments

Comments
 (0)