-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
138 lines (109 loc) · 3.47 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
SHELL := bash
.ONESHELL:
VER=$(shell git describe --tags --always --dirty)
GO=$(shell which go)
GOOPTS=-trimpath -mod=readonly -ldflags "-X main.version=$(VER:v%=%) -s -w -buildid="
GOMOD=$(GO) mod
GOFMT=$(GO) fmt
GOBUILD=$(GO) build $(GOOPTS)
dir:
@if [ ! -d bin ]; then mkdir -p bin; fi
mod:
@$(GOMOD) download
format:
@$(GOFMT) ./...
build/linux/armv7: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm
export GOARM=7
$(GOBUILD) -o bin/concheck-linux-$(VER:v%=%)-armv7 cmd/concheck/*.go
build/linux/arm64: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm64
$(GOBUILD) -o bin/concheck-linux-$(VER:v%=%)-arm64 cmd/concheck/*.go
build/linux/386: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=386
$(GOBUILD) -o bin/concheck-linux-$(VER:v%=%)-386 cmd/concheck/*.go
build/linux/amd64: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=amd64
$(GOBUILD) -o bin/concheck-linux-$(VER:v%=%)-amd64 cmd/concheck/*.go
build/linux: build/linux/armv7 build/linux/arm64 build/linux/386 build/linux/amd64
build/freebsd/armv7: dir mod
export CGO_ENABLED=0
export GOOS=freebsd
export GOARCH=arm
export GOARM=7
$(GOBUILD) -o bin/concheck-freebsd-$(VER:v%=%)-armv7 cmd/concheck/*.go
build/freebsd/arm64: dir mod
export CGO_ENABLED=0
export GOOS=freebsd
export GOARCH=arm64
$(GOBUILD) -o bin/concheck-freebsd-$(VER:v%=%)-arm64 cmd/concheck/*.go
build/freebsd/386: dir mod
export CGO_ENABLED=0
export GOOS=freebsd
export GOARCH=386
$(GOBUILD) -o bin/concheck-freebsd-$(VER:v%=%)-386 cmd/concheck/*.go
build/freebsd/amd64: dir mod
export CGO_ENABLED=0
export GOOS=freebsd
export GOARCH=amd64
$(GOBUILD) -o bin/concheck-freebsd-$(VER:v%=%)-amd64 cmd/concheck/*.go
build/freebsd: build/freebsd/armv7 build/freebsd/arm64 build/freebsd/386 build/freebsd/amd64
build/openbsd/armv7: dir mod
export CGO_ENABLED=0
export GOOS=openbsd
export GOARCH=arm
export GOARM=7
$(GOBUILD) -o bin/concheck-openbsd-$(VER:v%=%)-armv7 cmd/concheck/*.go
build/openbsd/arm64: dir mod
export CGO_ENABLED=0
export GOOS=openbsd
export GOARCH=arm64
$(GOBUILD) -o bin/concheck-openbsd-$(VER:v%=%)-arm64 cmd/concheck/*.go
build/openbsd/386: dir mod
export CGO_ENABLED=0
export GOOS=openbsd
export GOARCH=386
$(GOBUILD) -o bin/concheck-openbsd-$(VER:v%=%)-386 cmd/concheck/*.go
build/openbsd/amd64: dir mod
export CGO_ENABLED=0
export GOOS=openbsd
export GOARCH=amd64
$(GOBUILD) -o bin/concheck-openbsd-$(VER:v%=%)-amd64 cmd/concheck/*.go
build/openbsd: build/openbsd/armv7 build/openbsd/arm64 build/openbsd/386 build/openbsd/amd64
build/darwin/arm64: dir mod
export CGO_ENABLED=0
export GOOS=darwin
export GOARCH=arm64
$(GOBUILD) -o bin/concheck-darwin-$(VER:v%=%)-arm64 cmd/concheck/*.go
build/darwin/amd64: dir mod
export CGO_ENABLED=0
export GOOS=darwin
export GOARCH=amd64
$(GOBUILD) -o bin/concheck-darwin-$(VER:v%=%)-amd64 cmd/concheck/*.go
build/darwin: build/darwin/arm64 build/darwin/amd64
build/windows/386: dir mod
export CGO_ENABLED=0
export GOOS=windows
export GOARCH=386
$(GOBUILD) -o bin/concheck-windows-$(VER:v%=%)-386 cmd/concheck/*.go
build/windows/amd64: dir mod
export CGO_ENABLED=0
export GOOS=windows
export GOARCH=amd64
$(GOBUILD) -o bin/concheck-windows-$(VER:v%=%)-amd64 cmd/concheck/*.go
build/windows: build/windows/386 build/windows/amd64
build: build/linux build/freebsd build/openbsd build/darwin build/windows
clean:
@rm -rf bin
license: dir
cp NOTICE bin/NOTICE
cp LICENSE bin/LICENSE
all: format build license