-
Notifications
You must be signed in to change notification settings - Fork 267
/
Makefile
executable file
·139 lines (104 loc) · 3.34 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
139
NAME := oci-help
PACKAGE_NAME := github.com/lemoex/oci-help
VERSION := $(shell git describe --tags || echo "unknown-version")
COMMIT := $(shell git rev-parse HEAD)
BUILDTIME := $(shell date -u "+%Y-%m-%d %H:%M:%S %Z")
BUILD_DIR := build
VAR_SETTING := -X "$(PACKAGE_NAME)/constant.Version=$(VERSION)" -X "$(PACKAGE_NAME)/constant.Commit=$(COMMIT)" -X "$(PACKAGE_NAME)/constant.BuildTime=$(BUILDTIME)"
GOBUILD = CGO_ENABLED=0 go build -trimpath -ldflags '-s -w -buildid= $(VAR_SETTING)' \
-o $(BUILD_DIR)
PLATFORM_LIST = \
darwin-amd64 \
darwin-arm64 \
linux-amd64 \
linux-arm64 \
windows-amd64 \
windows-arm64
zip_release = $(addsuffix .zip, $(PLATFORM_LIST))
.PHONY: build clean release
normal: clean build
clean:
@rm -rf $(BUILD_DIR)
@echo "Cleaning up."
$(zip_release): %.zip : %
@zip -du $(BUILD_DIR)/$(NAME)-$<-$(VERSION).zip -j -m $(BUILD_DIR)/$</$(NAME)*
@zip -du $(BUILD_DIR)/$(NAME)-$<-$(VERSION).zip *.ini
@echo "✅ $(NAME)-$<-$(VERSION).zip"
all: linux-amd64 darwin-amd64 windows-amd64 # Most used
all-arch: $(PLATFORM_LIST)
release: $(zip_release)
build:
@-mkdir -p $(BUILD_DIR)
$(GOBUILD)/$(NAME)
darwin-amd64:
mkdir -p $(BUILD_DIR)/$@
GOARCH=amd64 GOOS=darwin $(GOBUILD)/$@/$(NAME)
darwin-arm64:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm64 GOOS=darwin $(GOBUILD)/$@/$(NAME)
linux-386:
mkdir -p $(BUILD_DIR)/$@
GOARCH=386 GOOS=linux $(GOBUILD)/$@/$(NAME)
linux-amd64:
mkdir -p $(BUILD_DIR)/$@
GOARCH=amd64 GOOS=linux $(GOBUILD)/$@/$(NAME)
linux-arm:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm GOOS=linux $(GOBUILD)/$@/$(NAME)
linux-armv5:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm GOOS=linux GOARM=5 $(GOBUILD)/$@/$(NAME)
linux-armv6:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm GOOS=linux GOARM=6 $(GOBUILD)/$@/$(NAME)
linux-armv7:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm GOOS=linux GOARM=7 $(GOBUILD)/$@/$(NAME)
linux-arm64:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm64 GOOS=linux $(GOBUILD)/$@/$(NAME)
linux-mips-softfloat:
mkdir -p $(BUILD_DIR)/$@
GOARCH=mips GOMIPS=softfloat GOOS=linux $(GOBUILD)/$@/$(NAME)
linux-mips-hardfloat:
mkdir -p $(BUILD_DIR)/$@
GOARCH=mips GOMIPS=hardfloat GOOS=linux $(GOBUILD)/$@/$(NAME)
linux-mipsle-softfloat:
mkdir -p $(BUILD_DIR)/$@
GOARCH=mipsle GOMIPS=softfloat GOOS=linux $(GOBUILD)/$@/$(NAME)
linux-mipsle-hardfloat:
mkdir -p $(BUILD_DIR)/$@
GOARCH=mipsle GOMIPS=hardfloat GOOS=linux $(GOBUILD)/$@/$(NAME)
linux-mips64:
mkdir -p $(BUILD_DIR)/$@
GOARCH=mips64 GOOS=linux $(GOBUILD)/$@/$(NAME)
linux-mips64le:
mkdir -p $(BUILD_DIR)/$@
GOARCH=mips64le GOOS=linux $(GOBUILD)/$@/$(NAME)
freebsd-386:
mkdir -p $(BUILD_DIR)/$@
GOARCH=386 GOOS=freebsd $(GOBUILD)/$@/$(NAME)
freebsd-amd64:
mkdir -p $(BUILD_DIR)/$@
GOARCH=amd64 GOOS=freebsd $(GOBUILD)/$@/$(NAME)
freebsd-arm64:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm64 GOOS=freebsd $(GOBUILD)/$@/$(NAME)
windows-386:
mkdir -p $(BUILD_DIR)/$@
GOARCH=386 GOOS=windows $(GOBUILD)/$@/$(NAME).exe
windows-amd64:
mkdir -p $(BUILD_DIR)/$@
GOARCH=amd64 GOOS=windows $(GOBUILD)/$@/$(NAME).exe
windows-arm:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm GOOS=windows $(GOBUILD)/$@/$(NAME).exe
windows-armv6:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm GOOS=windows GOARM=6 $(GOBUILD)/$@/$(NAME).exe
windows-armv7:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm GOOS=windows GOARM=7 $(GOBUILD)/$@/$(NAME).exe
windows-arm64:
mkdir -p $(BUILD_DIR)/$@
GOARCH=arm64 GOOS=windows $(GOBUILD)/$@/$(NAME).exe