@@ -8,40 +8,18 @@ ci: test build
88# Determine the type of `push` and `version`
99# ################################################
1010
11- ifdef GITHUB_REF
12- VERSION ?= $(shell echo $(GITHUB_REF ) | sed 's/^refs\/tags\///')
13- NOT_RC := $(shell echo $(VERSION ) | grep -v -e -rc)
14- ifeq ($(NOT_RC),)
15- PUSHTYPE := release-candidate
16- else
17- PUSHTYPE := release
18- endif
19- else
20- VERSION ?= $(shell [ -d .git ] && git describe --tags --always --dirty="-dev")
21- # If we are not in an active git dir then try reading the version from .VERSION.
22- # .VERSION contains a slug populated by `git archive`.
23- VERSION := $(or $(VERSION ) ,$(shell make/version.sh .VERSION) )
24- PUSHTYPE := branch
25- endif
26-
27- VERSION := $(shell echo $(VERSION ) | sed 's/^v//')
28-
29- ifdef V
30- $(info GITHUB_REF is $(GITHUB_REF))
31- $(info VERSION is $(VERSION))
32- $(info PUSHTYPE is $(PUSHTYPE))
33- endif
34-
35- PKG? =github.com/smallstep/cli/cmd/step
36- BINNAME? =step
37-
3811# Set V to 1 for verbose output from the Makefile
3912Q =$(if $V,,@)
4013PREFIX? =
4114SRC =$(shell find . -type f -name '* .go')
4215GOOS_OVERRIDE ?=
4316CGO_OVERRIDE ?= CGO_ENABLED=0
4417OUTPUT_ROOT =output/
18+ BUILDID? =default
19+ ifdef DEBUG
20+ BUILDID=debug
21+ endif
22+
4523
4624.PHONY : all
4725
@@ -62,26 +40,19 @@ bootstra%:
6240# Build
6341# ########################################
6442
65- DATE := $(shell date -u '+% Y-% m-% d % H:% M UTC')
66- ifdef DEBUG
67- LDFLAGS := -ldflags='-X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"'
68- GCFLAGS := -gcflags "all=-N -l"
69- else
70- LDFLAGS := -ldflags='-w -X "main.Version=$(VERSION)" -X "main.BuildTime=$(DATE)"'
71- GCFLAGS :=
72- endif
73-
74- download :
75- $Q go mod download
76-
77- build : $(PREFIX ) bin/$(BINNAME )
43+ build : $(PREFIX ) bin/step
7844 @echo " Build Complete!"
7945
80- $(PREFIX ) bin/$( BINNAME ) : download $( call rwildcard, * .go)
46+ $(PREFIX ) bin/step :
8147 $Q mkdir -p $(@D )
82- $Q $(GOOS_OVERRIDE ) $(CGO_OVERRIDE ) go build -v -o $@ $(GCFLAGS ) $(LDFLAGS ) $(PKG )
48+ $Q $(GOOS_OVERRIDE ) $(CGO_OVERRIDE ) goreleaser build \
49+ --id $(BUILDID ) \
50+ --snapshot \
51+ --single-target \
52+ --clean \
53+ --output $(PREFIX ) bin/step
8354
84- .PHONY : build simple
55+ .PHONY : build
8556
8657# ########################################
8758# Test
@@ -157,7 +128,7 @@ define BUNDLE_MAKE
157128 # $(2) -- Go Architecture (e.g. amd64, arm, arm64, etc.)
158129 # $(3) -- Go ARM architectural family (e.g. 7, 8, etc.)
159130 # $(4) -- Parent directory for executables generated by 'make'.
160- $(q ) GOOS_OVERRIDE=' GOOS=$(1 ) GOARCH=$(2 ) GOARM=$(3 ) ' PREFIX=$(4 ) make $(4 ) bin/step
131+ $(q ) GOOS=$(1 ) GOARCH=$(2 ) GOARM=$(3 ) PREFIX=$(4 ) make $(4 ) bin/step
161132endef
162133
163134binary-linux-amd64 :
0 commit comments