-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
34 lines (28 loc) · 1.11 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.PHONY: all mod build
OUTPUT = kube-job
OUTDIR = bin
BUILD_CMD = go build -a -tags netgo -installsuffix netgo -ldflags \
" \
-extldflags '-static' \
-X github.com/h3poteto/kube-job/cmd.version=$(shell git describe --tag --abbrev=0) \
-X github.com/h3poteto/kube-job/cmd.revision=$(shell git rev-list -1 HEAD) \
-X github.com/h3poteto/kube-job/cmd.build=$(shell git describe --tags) \
"
VERSION = $(shell git describe --tag --abbrev=0)
all: mac linux windows macarm
mod: go.mod
go mod download
build: mod
GOOS=linux GOARCH=amd64 $(BUILD_CMD) -o $(OUTPUT)
mac: mod
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(BUILD_CMD) -o $(OUTPUT)
zip $(OUTDIR)/$(OUTPUT)_${VERSION}_darwin_amd64.zip $(OUTPUT)
macarm: mod
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 $(BUILD_CMD) -o $(OUTPUT)
zip $(OUTDIR)/$(OUTPUT)_${VERSION}_darwin_arm64.zip $(OUTPUT)
linux: mod
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(BUILD_CMD) -o $(OUTPUT)
zip $(OUTDIR)/$(OUTPUT)_${VERSION}_linux_amd64.zip $(OUTPUT)
windows: mod
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(BUILD_CMD) -o $(OUTPUT).exe
zip $(OUTDIR)/$(OUTPUT)_${VERSION}_windows_amd64.zip $(OUTPUT).exe