@@ -7,6 +7,10 @@ RELEASE_ROOT ?=releases
77DEV_TEST_BUILD =./$(PROJECT )
88TARGETS ?=linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64
99
10+ define is_not_number
11+ $(shell echo ${1} | sed -e 's/[0123456789]//g')
12+ endef
13+
1014ifneq ($(VERSION ) ,)
1115VERSION_SPLIT: =$(subst ., ,$(VERSION ) )
1216 ifneq ($(words $(VERSION_SPLIT)),3)
@@ -18,12 +22,15 @@ VERSION_SPLIT:=$(subst ., ,$(VERSION_TAG))
1822 ifneq ($(words $(VERSION_SPLIT)),3)
1923 $(error VERSION_TAG does not have 3 parts |$(words $(VERSION_SPLIT))|$(VERSION_TAG)|$(VERSION_SPLIT)|)
2024 endif
25+
26+ ifneq ($(words $(call is_not_number,$(word 3,$(VERSION_SPLIT)))), 0)
27+ $(error The VERSION_TAG patch version string contain non-numeric characters)
28+ endif
29+
2130 VERSION_SPLIT: =$(wordlist 1, 2, $(VERSION_SPLIT ) ) $(shell echo $$(($(word 3,$(VERSION_SPLIT ) ) +1 ) ) )
2231endif
2332
24- IS_NOT_NUMBER: =$(shell echo $(VERSION_SPLIT ) | sed -e 's/[0123456789]//g')
25-
26- ifneq ($(words $(IS_NOT_NUMBER ) ) , 0)
33+ ifneq ($(words $(call is_not_number,$(VERSION_SPLIT ) ) ) , 0)
2734 $(error The version string contain non-numeric characters)
2835endif
2936
@@ -101,6 +108,7 @@ release-all: release-clean distbuild $(RELEASES) show-releases
101108distbuild :
102109 @mkdir -p $(RELEASE_ROOT )
103110
111+ # Arguments os,arch,build
104112define build-target
105113release-$(1 ) /$(2 ) -$(PROJECT ) : RELEASE_GO_LDFLAGS:=-ldflags="$(GO_LDFLAGS ) -X '$(GOMODULECMD ) .GoOs=$(1 ) ' -X '$(GOMODULECMD ) .GoArch=$(2 ) '"
106114
0 commit comments