-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (64 loc) · 1.95 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
SHELL := bash
.ONESHELL:
VER=$(shell git describe --tags --always --dirty)
GO=$(shell which go)
GOMOD=$(GO) mod
GOFMT=$(GO) fmt
GOBUILD=$(GO) build -trimpath -mod=readonly -ldflags "-X main.version=$(VER:v%=%) -s -w -buildid="
dir:
@if [ ! -d bin ]; then mkdir -p bin; fi
mod:
@$(GOMOD) download
format:
@$(GOFMT) ./...
build/linux/mips64: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=mips64
$(GOBUILD) -o bin/pingflux-linux-$(VER:v%=%)-mips64 cmd/pingflux/main.go
build/linux/armv7: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm
export GOARM=7
$(GOBUILD) -o bin/pingflux-linux-$(VER:v%=%)-armv7 cmd/pingflux/main.go
build/linux/arm64: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm64
$(GOBUILD) -o bin/pingflux-linux-$(VER:v%=%)-arm64 cmd/pingflux/main.go
build/linux/386: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=386
$(GOBUILD) -o bin/pingflux-linux-$(VER:v%=%)-386 cmd/pingflux/main.go
build/linux/amd64: dir mod
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=amd64
$(GOBUILD) -o bin/pingflux-linux-$(VER:v%=%)-amd64 cmd/pingflux/main.go
build/linux: build/linux/mips64 build/linux/armv7 build/linux/arm64 build/linux/386 build/linux/amd64
build/darwin/arm64: dir mod
export CGO_ENABLED=0
export GOOS=darwin
export GOARCH=arm64
$(GOBUILD) -o bin/pingflux-darwin-$(VER:v%=%)-arm64 cmd/pingflux/main.go
build/darwin/amd64: dir mod
export CGO_ENABLED=0
export GOOS=darwin
export GOARCH=amd64
$(GOBUILD) -o bin/pingflux-darwin-$(VER:v%=%)-amd64 cmd/pingflux/main.go
build/darwin: build/darwin/arm64 build/darwin/amd64
build/windows/amd64: dir mod
export CGO_ENABLED=0
export GOOS=windows
export GOARCH=amd64
$(GOBUILD) -o bin/pingflux-windows-$(VER:v%=%)-amd64 cmd/pingflux/main.go
build/windows: build/windows/amd64
build: build/linux build/darwin build/windows
license: dir
cp NOTICE bin/NOTICE
cp LICENSE bin/LICENSE
clean:
@rm -rf bin
all: format build license