Skip to content

Commit 5808096

Browse files
committed
Re-add BINNAME and describe available vars
1 parent dd1b642 commit 5808096

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

Makefile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
# Set V=1 for verbose output.
1+
# Variables:
2+
# V=1 for verbose output.
3+
# BINNAME=step to change the name of the executable
4+
# PREFIX=bin/ to change the build output path
5+
# INSTALL_PREFIX=/usr/local/bin to change the install path
6+
# GOOS_OVERRIDE="GOOS=linux GOARCH=arm64" to change OS and arch
7+
# CGO_OVERRIDE="CGO_ENABLED=1" to enable CGO
8+
#
29
# Run `make bootstrap` to set up your local environment.
310
# To build using go, use `make build`
411
# For a binary that's in parity with how our CI system builds,
@@ -53,6 +60,7 @@ SRC=$(shell find . -type f -name '*.go')
5360
GOOS_OVERRIDE ?=
5461
CGO_OVERRIDE ?= CGO_ENABLED=0
5562
OUTPUT_ROOT=output/
63+
BINNAME?=step
5664

5765
GORELEASER_BUILD_ID?=default
5866
ifdef DEBUG
@@ -78,14 +86,14 @@ bootstra%:
7886
# Build
7987
#########################################
8088

81-
build: $(PREFIX)bin/step
89+
build: $(PREFIX)bin/$(BINNAME)
8290
@echo "Build Complete!"
8391

84-
$(PREFIX)bin/step:
92+
$(PREFIX)bin/$(BINNAME):
8593
$Q mkdir -p $(@D)
8694
$Q $(GOOS_OVERRIDE) $(CGO_OVERRIDE) go build \
8795
-v \
88-
-o $(PREFIX)bin/step \
96+
-o $(PREFIX)bin/$(BINNAME) \
8997
$(GCFLAGS) $(LDFLAGS) \
9098
github.com/smallstep/cli/cmd/step
9199

@@ -96,9 +104,9 @@ goreleaser:
96104
--snapshot \
97105
--single-target \
98106
--clean \
99-
--output $(PREFIX)bin/step
107+
--output $(PREFIX)bin/$(BINNAME)
100108

101-
.PHONY: build gobuild
109+
.PHONY: build goreleaser
102110

103111

104112
#########################################
@@ -115,7 +123,7 @@ race:
115123

116124
integrate: integration
117125

118-
integration: bin/step
126+
integration: bin/$(BINNAME)
119127
$Q $(CGO_OVERRIDE) gotestsum -- -tags=integration ./integration/...
120128

121129
.PHONY: integrate integration
@@ -174,7 +182,7 @@ define BUNDLE_MAKE
174182
# $(2) -- Go Architecture (e.g. amd64, arm, arm64, etc.)
175183
# $(3) -- Go ARM architectural family (e.g. 7, 8, etc.)
176184
# $(4) -- Parent directory for executables generated by 'make'.
177-
$(q) GOOS=$(1) GOARCH=$(2) GOARM=$(3) PREFIX=$(4) make $(4)bin/step
185+
$Q GOOS=$(1) GOARCH=$(2) GOARM=$(3) PREFIX=$(4) make $(4)bin/step
178186
endef
179187

180188
binary-linux-amd64:

0 commit comments

Comments
 (0)