-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
73 lines (61 loc) · 1.62 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
# 版本号
version = ''
# 编译到 Linux
.PHONY: build-linux
build-linux:
mkdir -p ./build/linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./build/linux/cron-admin ./src/main.go
# 编译到 macOS
# make build-darwin
.PHONY: build-darwin
build-darwin:
mkdir -p ./build/darwin
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./build/darwin/cron-admin ./src/main.go
# 编译到 windows
.PHONY: build-windows
build-windows:
mkdir -p ./build/windows
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./build/windows/cron-admin.exe ./src/main.go
# 编译到 全部平台
# make build
.PHONY: build
build:
make clean
make build-linux
make build-darwin
make build-windows
# 发布linux
.PHONY: release-linux
release-linux:
mkdir -p ./release/linux
cp ./env.example ./release/linux/
cp ./build/linux/cron-admin ./release/linux/
tar -zcvf release/cron-admin-$(version)-linux-amd64.tar.gz -C ./release/linux/ .
# 发布darwin
.PHONY: release-darwin
release-darwin:
mkdir -p ./release/darwin
cp ./env.example ./release/darwin/
cp ./build/darwin/cron-admin ./release/darwin/
tar -zcvf release/cron-admin-$(version)-darwin-amd64.tar.gz -C ./release/darwin/ .
# 发布windows
.PHONY: release-windows
release-windows:
mkdir -p ./release/windows
cp ./env.example ./release/windows/
cp ./build/windows/cron-admin.exe ./release/windows/
zip -j release/cron-admin-$(version)-windows-amd64.zip ./release/windows/*
# 发布全平台
# make release
.PHONY: release
release:
make release-linux
make release-darwin
make release-windows
.PHONY: clean
clean:
rm -rf ./build ./release
.PHONY: dev
dev:
# go run ./src/main.go
air