Skip to content

Commit b076bc2

Browse files
authored
More cross-platform mcmitm_version.cpp target (#532)
1 parent 64f978e commit b076bc2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ GIT_BRANCH := $(shell git symbolic-ref --short HEAD | sed s/[^a-zA-Z0-9_-]/_/g)
55
GIT_HASH := $(shell git rev-parse --short HEAD)
66
GIT_TAG := $(shell git describe --tags `git rev-list --tags --max-count=1`)
77

8-
VERSION := $(shell [[ $(GIT_TAG) =~ ^v([0-9]+).([0-9]+).([0-9]+) ]] && printf '0x%02X%02X%02X' $${BASH_REMATCH[1]} $${BASH_REMATCH[2]} $${BASH_REMATCH[3]})
8+
VERSION := $(shell printf "0x%02X%02X%02X" $(shell echo "$(GIT_TAG)" | sed -E 's/^v([0-9]+).([0-9]+).([0-9]+)/\1 \2 \3/g'))
99
BUILD_VERSION := $(GIT_TAG:v%=%)-$(GIT_BRANCH)-$(GIT_HASH)
10+
BUILD_DATE := $(shell date)
1011

1112
TARGETS := mcmitm_version.cpp mc_mitm
1213

1314
all: $(TARGETS)
1415

1516
mcmitm_version.cpp: .git/HEAD .git/index
16-
echo "namespace ams::mitm { unsigned int mc_version = $(VERSION); const char *mc_build_name = \"$(BUILD_VERSION)\"; const char *mc_build_date = \"$$(date)\"; }" > mc_mitm/source/$@
17+
echo "namespace ams::mitm { unsigned int mc_version = $(VERSION); const char *mc_build_name = \"$(BUILD_VERSION)\"; const char *mc_build_date = \"$(BUILD_DATE)\"; }" > mc_mitm/source/$@
1718

1819
mc_mitm:
1920
$(MAKE) -C $@

0 commit comments

Comments
 (0)