File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ GOLANGCI_LINT_VERSION := v1.52.2
2828
2929GOFLAGS := -trimpath
3030
31+ GO_OS := $(shell go env GOOS)
32+ GO_ARCH := $(shell go env GOARCH)
33+
3134RELEASE_VERSION := $(shell git describe --tags --match='v* ' --abbrev=14)
3235GITCOMMIT := $(shell git rev-parse HEAD)
3336
@@ -38,8 +41,22 @@ GOLDFLAGS := -w -s \
3841.PHONY : build
3942build : $(BINDIR ) /boilersuite
4043
41- $(BINDIR ) /boilersuite : $(GO_FILES ) $(TEMPLATE_FILES ) | $(BINDIR )
42- CGO_ENABLED=0 go build $(GOFLAGS ) -ldflags " $( GOLDFLAGS) " -o $@ main.go
44+ $(BINDIR ) /boilersuite : $(BINDIR ) /boilersuite-$(GO_OS ) -$(GO_ARCH )
45+ ln -fs $< $@
46+
47+ .PHONY : build-release
48+ build-release : $(BINDIR ) /SHA256SUMS
49+
50+ $(BINDIR ) /SHA256SUMS : $(BINDIR ) /boilersuite-linux-amd64 $(BINDIR ) /boilersuite-darwin-amd64 $(BINDIR ) /boilersuite-darwin-arm64
51+ cd $(BINDIR ) && sha256sum $(notdir $^ ) > $(notdir $@ )
52+
53+ # Expects to be called with a golang OS / Arch combination separated by a dash
54+ $(BINDIR ) /boilersuite-% : $(GO_FILES ) $(TEMPLATE_FILES ) | $(BINDIR )
55+ # the OS is the part before the dash
56+ $(eval OS := $(word 1,$(subst -, ,$* ) ) )
57+ # the arch is the part after the dash
58+ $(eval ARCH := $(word 2,$(subst -, ,$* ) ) )
59+ GOOS=$(OS ) GOARCH=$(ARCH ) CGO_ENABLED=0 go build $(GOFLAGS ) -ldflags " $( GOLDFLAGS) " -o $@ main.go
4360
4461.PHONY : test
4562test :
You can’t perform that action at this time.
0 commit comments