-
Notifications
You must be signed in to change notification settings - Fork 823
/
Makefile
88 lines (69 loc) · 2.92 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
VERSION=$(shell git describe --tags --candidates=1 --dirty)
BUILD_FLAGS=-ldflags="-X main.Version=$(VERSION)" -trimpath
CERT_ID ?= Developer ID Application: 99designs Inc (NRM9HVJ62Z)
SRC=$(shell find . -name '*.go') go.mod
INSTALL_DIR ?= ~/bin
.PHONY: binaries clean release install
ifeq ($(shell uname), Darwin)
aws-vault: $(SRC)
go build -ldflags="-X main.Version=$(VERSION)" -o $@ .
codesign --options runtime --timestamp --sign "$(CERT_ID)" $@
else
aws-vault: $(SRC)
go build -ldflags="-X main.Version=$(VERSION)" -o $@ .
endif
install: aws-vault
mkdir -p $(INSTALL_DIR)
rm -f $(INSTALL_DIR)/aws-vault
cp -a ./aws-vault $(INSTALL_DIR)/aws-vault
binaries: aws-vault-linux-amd64 aws-vault-linux-arm64 aws-vault-linux-ppc64le aws-vault-linux-arm7 aws-vault-darwin-amd64 aws-vault-darwin-arm64 aws-vault-windows-386.exe aws-vault-windows-arm64.exe aws-vault-freebsd-amd64
dmgs: aws-vault-darwin-amd64.dmg aws-vault-darwin-arm64.dmg
clean:
rm -f ./aws-vault ./aws-vault-*-* ./SHA256SUMS
release: binaries dmgs SHA256SUMS
@echo "\nTo create a new release run:\n\n gh release create --title $(VERSION) $(VERSION) \
aws-vault-darwin-amd64.dmg \
aws-vault-darwin-arm64.dmg \
aws-vault-freebsd-amd64 \
aws-vault-linux-amd64 \
aws-vault-linux-arm64 \
aws-vault-linux-arm7 \
aws-vault-linux-ppc64le \
aws-vault-windows-386.exe \
aws-vault-windows-arm64.exe \
SHA256SUMS\n"
@echo "\nTo update homebrew-cask run:\n\n brew bump-cask-pr --version $(shell echo $(VERSION) | sed 's/v\(.*\)/\1/') aws-vault\n"
aws-vault-darwin-amd64: $(SRC)
GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 SDKROOT=$(shell xcrun --sdk macosx --show-sdk-path) go build $(BUILD_FLAGS) -o $@ .
aws-vault-darwin-arm64: $(SRC)
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 SDKROOT=$(shell xcrun --sdk macosx --show-sdk-path) go build $(BUILD_FLAGS) -o $@ .
aws-vault-freebsd-amd64: $(SRC)
GOOS=freebsd GOARCH=amd64 go build $(BUILD_FLAGS) -o $@ .
aws-vault-linux-amd64: $(SRC)
GOOS=linux GOARCH=amd64 go build $(BUILD_FLAGS) -o $@ .
aws-vault-linux-arm64: $(SRC)
GOOS=linux GOARCH=arm64 go build $(BUILD_FLAGS) -o $@ .
aws-vault-linux-ppc64le: $(SRC)
GOOS=linux GOARCH=ppc64le go build $(BUILD_FLAGS) -o $@ .
aws-vault-linux-arm7: $(SRC)
GOOS=linux GOARCH=arm GOARM=7 go build $(BUILD_FLAGS) -o $@ .
aws-vault-windows-386.exe: $(SRC)
GOOS=windows GOARCH=386 go build $(BUILD_FLAGS) -o $@ .
aws-vault-windows-arm64.exe: $(SRC)
GOOS=windows GOARCH=arm64 go build $(BUILD_FLAGS) -o $@ .
aws-vault-darwin-amd64.dmg: aws-vault-darwin-amd64
./bin/create-dmg aws-vault-darwin-amd64 $@
aws-vault-darwin-arm64.dmg: aws-vault-darwin-arm64
./bin/create-dmg aws-vault-darwin-arm64 $@
SHA256SUMS: binaries dmgs
shasum -a 256 \
aws-vault-darwin-amd64.dmg \
aws-vault-darwin-arm64.dmg \
aws-vault-freebsd-amd64 \
aws-vault-linux-amd64 \
aws-vault-linux-arm64 \
aws-vault-linux-arm7 \
aws-vault-linux-ppc64le \
aws-vault-windows-386.exe \
aws-vault-windows-arm64.exe \
> $@