-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile.client
90 lines (75 loc) · 3.04 KB
/
Makefile.client
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
BINARY_NAME = ddns-watchdog-client
CODE_FILE = ./cmd/ddns-watchdog-client/main.go
OUTPUT_PATH = ./build
LDFLAGS = -w -s
.PHONY: all
all: check linux windows darwin
.PHONY: linux
linux: linux-amd64 linux-arm64 linux-armv7
.PHONY: windows
windows: windows-amd64 windows-arm64
.PHONY: darwin
darwin: darwin-amd64 darwin-arm64
.PHONY: check
check:
@mkdir -p $(OUTPUT_PATH)
.PHONY: third-party-upgrade
third-party-upgrade:
@go get -u all
@echo $@ completed.
.PHONY: clean
clean:
@rm -f $(OUTPUT_PATH)/*
@echo $@ completed.
# linux
.PHONY: linux-amd64
linux-amd64:
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)[email protected]
@CGO_ENABLE=0 GOOS=linux GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o $(OUTPUT_PATH)/$(BINARY_NAME) $(CODE_FILE)
@tar -cJf $(OUTPUT_PATH)/$(BINARY_NAME)[email protected] -C $(OUTPUT_PATH) $(BINARY_NAME) >/dev/null
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)
@echo $@ build completed.
.PHONY: linux-arm64
linux-arm64:
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)[email protected]
@CGO_ENABLE=0 GOOS=linux GOARCH=arm64 go build -ldflags '$(LDFLAGS)' -o $(OUTPUT_PATH)/$(BINARY_NAME) $(CODE_FILE)
@tar -cJf $(OUTPUT_PATH)/$(BINARY_NAME)[email protected] -C $(OUTPUT_PATH) $(BINARY_NAME) >/dev/null
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)
@echo $@ build completed.
.PHONY: linux-armv7
linux-armv7:
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)[email protected]
@CGO_ENABLE=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags '$(LDFLAGS)' -o $(OUTPUT_PATH)/$(BINARY_NAME) $(CODE_FILE)
@tar -cJf $(OUTPUT_PATH)/$(BINARY_NAME)[email protected] -C $(OUTPUT_PATH) $(BINARY_NAME) >/dev/null
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)
@echo $@ build completed.
# windows
.PHONY: windows-amd64
windows-amd64:
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)[email protected]
@CGO_ENABLE=0 GOOS=windows GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o $(OUTPUT_PATH)/$(BINARY_NAME).exe $(CODE_FILE)
@tar -cJf $(OUTPUT_PATH)/$(BINARY_NAME)[email protected] -C $(OUTPUT_PATH) $(BINARY_NAME).exe >/dev/null
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME).exe
@echo $@ build completed.
.PHONY: windows-arm64
windows-arm64:
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)[email protected]
@CGO_ENABLE=0 GOOS=windows GOARCH=arm64 go build -ldflags '$(LDFLAGS)' -o $(OUTPUT_PATH)/$(BINARY_NAME).exe $(CODE_FILE)
@tar -cJf $(OUTPUT_PATH)/$(BINARY_NAME)[email protected] -C $(OUTPUT_PATH) $(BINARY_NAME).exe >/dev/null
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME).exe
@echo $@ build completed.
# darwin
.PHONY: darwin-amd64
darwin-amd64:
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)[email protected]
@CGO_ENABLE=0 GOOS=darwin GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o $(OUTPUT_PATH)/$(BINARY_NAME) $(CODE_FILE)
@tar -cJf $(OUTPUT_PATH)/$(BINARY_NAME)[email protected] -C $(OUTPUT_PATH) $(BINARY_NAME) >/dev/null
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)
@echo $@ build completed.
.PHONY: darwin-arm64
darwin-arm64:
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)[email protected]
@CGO_ENABLE=0 GOOS=darwin GOARCH=arm64 go build -ldflags '$(LDFLAGS)' -o $(OUTPUT_PATH)/$(BINARY_NAME) $(CODE_FILE)
@tar -cJf $(OUTPUT_PATH)/$(BINARY_NAME)[email protected] -C $(OUTPUT_PATH) $(BINARY_NAME) >/dev/null
@rm -f $(OUTPUT_PATH)/$(BINARY_NAME)
@echo $@ build completed.