Skip to content

Commit e284257

Browse files
ympenguinTrueBrain
authored andcommitted
Fix: [Makefile] overwrite the info from Makefile.vcs with latest if possible
Addtionally, only evaluate it once per run.
1 parent eafb860 commit e284257

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Makefile

+12-12
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,16 @@ include Makefile.vcs
159159
ifneq ($(GIT),)
160160

161161
# Hash
162-
REPO_HASH ?= $(shell $(GIT) rev-parse HEAD)
162+
REPO_HASH := $(shell $(GIT) rev-parse HEAD)
163163

164164
# Date
165-
REPO_DATE ?= $(shell $(GIT) show -s --format="%ci" | cut -f1 -d" ")
165+
REPO_DATE := $(shell $(GIT) show -s --format="%ci" | cut -f1 -d" ")
166166

167167
# Version = Most recent tag, optionally followed by the number of commits since, current commit and dirty or broken indicators.
168-
REPO_VERSION ?= $(shell $(GIT) describe --tags --dirty --broken)
168+
REPO_VERSION := $(shell $(GIT) describe --tags --dirty --broken)
169169

170170
# Branch name
171-
REPO_BRANCH ?= $(shell $(GIT) rev-parse --abbrev-ref HEAD)
171+
REPO_BRANCH := $(shell $(GIT) rev-parse --abbrev-ref HEAD)
172172

173173
# Makefile.vcs contains all the data depending on the version reported by GIT.
174174
# It is renewed *before* processing any real targets, *only* if the version of the working copy changes.
@@ -177,26 +177,26 @@ REPO_BRANCH ?= $(shell $(GIT) rev-parse --abbrev-ref HEAD)
177177
#
178178
Makefile.vcs: FORCE
179179
$(_E) "[VCS] $@"
180-
$(_V) echo "REPO_HASH ?= $(REPO_HASH)" >> $@.new
181-
$(_V) echo "REPO_DATE ?= $(REPO_DATE)" >> $@.new
182-
$(_V) echo "REPO_VERSION ?= $(REPO_VERSION)" >> $@.new
183-
$(_V) echo "REPO_BRANCH ?= $(REPO_BRANCH)" >> $@.new
180+
$(_V) echo "REPO_HASH = $(REPO_HASH)" >> $@.new
181+
$(_V) echo "REPO_DATE = $(REPO_DATE)" >> $@.new
182+
$(_V) echo "REPO_VERSION = $(REPO_VERSION)" >> $@.new
183+
$(_V) echo "REPO_BRANCH = $(REPO_BRANCH)" >> $@.new
184184
$(_V) cmp -s $@.new $@ || cp $@.new $@
185185
$(_V) -rm -f $@.new
186186

187187
endif
188188

189189
# Days of commit since 2000-1-1 00-00
190-
REPO_DAYS_SINCE_2000 ?= $(shell $(PYTHON) -c "from datetime import date; print( (date(`echo "${REPO_DATE}" | sed s/-/,/g | sed s/,0/,/g`)-date(2000,1,1)).days)")
190+
REPO_DAYS_SINCE_2000 := $(shell $(PYTHON) -c "from datetime import date; print( (date(`echo "${REPO_DATE}" | sed s/-/,/g | sed s/,0/,/g`)-date(2000,1,1)).days)")
191191

192192
# Filename addition, if we're not building the default branch
193-
REPO_BRANCH_STRING ?= $(filter-out $(DEFAULT_BRANCH_NAME)-, $(REPO_BRANCH)-)
193+
REPO_BRANCH_STRING := $(filter-out $(DEFAULT_BRANCH_NAME)-, $(REPO_BRANCH)-)
194194

195195
# The version reported to OpenTTD. Usually days since 2000 + branch offset
196-
NEWGRF_VERSION ?= $(shell let x="$(REPO_DAYS_SINCE_2000) + 65536 * $(REPO_BRANCH_VERSION)"; echo "$$x")
196+
NEWGRF_VERSION := $(shell let x="$(REPO_DAYS_SINCE_2000) + 65536 * $(REPO_BRANCH_VERSION)"; echo "$$x")
197197

198198
# The title consists of name and version
199-
REPO_TITLE ?= $(REPO_NAME) $(REPO_VERSION)
199+
REPO_TITLE := $(REPO_NAME) $(REPO_VERSION)
200200

201201
distclean:: clean
202202
maintainer-clean:: distclean

0 commit comments

Comments
 (0)