-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
73 lines (57 loc) · 2.1 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
.DEFAULT_GOAL := build
.PHONY: fmt vet build
NAME := $(shell basename $(shell go list -m))
SRCS := $(wildcard *.go) $(wildcard */*.go)
fmt: $(SRCS)
go fmt ./...
vet: $(SRCS) fmt
go vet ./...
build: $(SRCS) vet
go build .
build-all: darwin freebsd illumos linux netbsd openbsd windows
darwin: bin/darwin-arm64/${NAME}
freebsd: bin/freebsd-amd64/${NAME}
illumos: bin/illumos-amd64/${NAME}
linux: bin/linux-amd64/${NAME} bin/linux-arm64/${NAME} bin/linux-armv7/${NAME}
netbsd: bin/netbsd-amd64/${NAME}
openbsd: bin/openbsd-amd64/${NAME}
windows: bin/windows-amd64/${NAME}.exe
bin/darwin-arm64/${NAME}: $(SRCS) vet
@mkdir -p bin/darwin-arm64/
@echo "Building darwin-arm64..."
env GOOS=darwin GOARCH=arm64 go build -o bin/darwin-arm64/${NAME}
bin/freebsd-amd64/${NAME}: $(SRCS) vet
@mkdir -p bin/freebsd-amd64/
@echo "Building freebsd-amd64..."
env GOOS=freebsd GOARCH=amd64 go build -o bin/freebsd-amd64/${NAME}
bin/illumos-amd64/${NAME}: $(SRCS) vet
@mkdir -p bin/illumos-amd64/
@echo "Building illumos-amd64..."
env GOOS=illumos GOARCH=amd64 go build -o bin/illumos-amd64/${NAME}
bin/linux-amd64/${NAME}: $(SRCS) vet
@mkdir -p bin/linux-amd64/
@echo "Building linux-amd64..."
env GOOS=linux GOARCH=amd64 go build -o bin/linux-amd64/${NAME}
bin/linux-arm64/${NAME}: $(SRCS) vet
@mkdir -p bin/linux-arm64/
@echo "Building linux-arm64..."
env GOOS=linux GOARCH=arm64 go build -o bin/linux-arm64/${NAME}
bin/linux-armv7/${NAME}: $(SRCS) vet
@mkdir -p bin/linux-armv7/
@echo "Building linux-armv7..."
env GOOS=linux GOARCH=arm GOARM=7 go build -o bin/linux-armv7/${NAME}
bin/netbsd-amd64/${NAME}: $(SRCS) vet
@mkdir -p bin/netbsd-amd64/
@echo "Building netbsd-amd64..."
env GOOS=netbsd GOARCH=amd64 go build -o bin/netbsd-amd64/${NAME}
bin/openbsd-amd64/${NAME}: $(SRCS) vet
@mkdir -p bin/openbsd-amd64/
@echo "Building openbsd-amd64..."
env GOOS=openbsd GOARCH=amd64 go build -o bin/openbsd-amd64/${NAME}
bin/windows-amd64/${NAME}.exe: $(SRCS) vet
@mkdir -p bin/windows-amd64/
@echo "Building windows-amd64..."
env GOOS=windows GOARCH=amd64 go build -o bin/windows-amd64/${NAME}.exe
clean:
go clean
rm -r bin/