Skip to content

Commit b278a63

Browse files
Unrudpchote
authored andcommitted
Makefile: Fail target version when not a git repository
1 parent 7ba140e commit b278a63

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ RM_R = $(RM) -r
6161
RM_F = $(RM) -f
6262
RM_RF = $(RM) -rf
6363

64-
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
64+
# Only for use in target version:
65+
VERSION := $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || (c=$$(git rev-parse --short HEAD 2>/dev/null) && echo git-$$c))
6566

6667
# Detect target platform for dependencies if not given by the user
6768
ifndef TARGETPLATFORM
@@ -136,8 +137,11 @@ test: all
136137
############# LOCAL INSTALLATION AND DOWNSTREAM PACKAGING ##############
137138
#
138139
version: VERSION mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modcontent/mod.yaml mods/all/mod.yaml
139-
@sh -c '. ./packaging/functions.sh; set_engine_version $(VERSION) .'
140-
@sh -c '. ./packaging/functions.sh; set_mod_version $(VERSION) mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modcontent/mod.yaml mods/all/mod.yaml'
140+
ifeq ($(VERSION),)
141+
$(error Unable to determine new version (requires git or override of variable VERSION))
142+
endif
143+
@sh -c '. ./packaging/functions.sh; set_engine_version "$(VERSION)" .'
144+
@sh -c '. ./packaging/functions.sh; set_mod_version "$(VERSION)" mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modcontent/mod.yaml mods/all/mod.yaml'
141145

142146
install:
143147
@sh -c '. ./packaging/functions.sh; install_assemblies_mono $(CWD) $(DESTDIR)$(gameinstalldir) $(TARGETPLATFORM) True True True'

0 commit comments

Comments
 (0)