-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (33 loc) · 1.18 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
SOURCE = ./cmd/piece
BUILD = build
all: binary
binary: $(BUILD) binary-linux binary-macos binary-windows
$(BUILD):
-mkdir $(BUILD)
binary-linux: $(BUILD)/linux/piece $(BUILD)/linux/piece-386 $(BUILD)/linux/piece-arm $(BUILD)/linux/piece-arm64
$(BUILD)/linux: $(BUILD)
-mkdir $@
$(BUILD)/linux/piece $(BUILD)/linux/piece%: $(BUILD)/linux
GOOS=linux GOARCH=$(patsubst %/piece,amd64,$(patsubst build/linux/piece-%,%,$@)) \
go build -v \
-ldflags "-s -w" \
-o $(patsubst %-amd64,%,$@) \
$(SOURCE)
binary-macos: $(BUILD)/macos/piece $(BUILD)/macos/piece-386
$(BUILD)/macos: $(BUILD)
-mkdir $@
$(BUILD)/macos/piece $(BUILD)/macos/piece%: $(BUILD)/macos
GOOS=darwin GOARCH=$(patsubst %/piece,amd64,$(patsubst build/macos/piece-%,%,$@)) \
go build -v \
-ldflags "-s -w" \
-o $(patsubst %-amd64,%,$@) \
$(SOURCE)
binary-windows: $(BUILD)/windows/piece.exe $(BUILD)/windows/piece-386.exe
$(BUILD)/windows: $(BUILD)
-mkdir $@
$(BUILD)/windows/piece.exe $(BUILD)/windows/piece%.exe: $(BUILD)/windows
GOOS=windows GOARCH=$(patsubst %/piece.exe,amd64,$(patsubst build/windows/piece-%.exe,%,$@)) \
go build -v \
-ldflags "-s -w" \
-o $(patsubst %-amd64.exe,%.exe,$@) \
$(SOURCE)