-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
64 lines (53 loc) · 2.47 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
.PHONY: start build
NOW = $(shell date -u '+%Y%m%d%I%M%S')
APP = gin-amis-admin
SERVER_BIN = ./cmd/${APP}/${APP}
RELEASE_ROOT = release
RELEASE_SERVER = release/${APP}
all: start
build:
@go build -ldflags "-w -s" -o $(SERVER_BIN) ./cmd/${APP}
build-darwin:
xgo -go go-1.14.x -targets=darwin/amd64 -pkg=cmd/gin-amis-admin/main.go -dest=cmd/${APP} -out=gin-amis-admin .
build-windows-386:
xgo -go go-1.14.x -targets=windows/386 -pkg=cmd/gin-amis-admin/main.go -dest=cmd/${APP} -out=gin-amis-admin .
build-windows-amd64:
xgo -go go-1.14.x -targets=windows/amd64 -pkg=cmd/gin-amis-admin/main.go -dest=cmd/${APP} -out=gin-amis-admin .
start:
go run cmd/${APP}/main.go web -c ./configs/config.toml -m ./configs/model.conf --menu ./configs/menu.yaml --page ./configs/page_manager.yaml --tpl-mall ./configs/tpl_mall.yaml
swagger:
swag init --generalInfo ./internal/app/swagger.go --output ./internal/app/swagger
wire:
wire gen ./internal/app/injector
test:
@go test -v $(shell go list ./...)
clean:
rm -rf data release $(SERVER_BIN) ./internal/app/test/data ./cmd/${APP}/data
pack: build
mkdir -p $(RELEASE_SERVER)
rm -f $(APP)-linux-adm64.tar.gz
cp -r $(SERVER_BIN) configs web $(RELEASE_SERVER)
cp scripts/pack/* $(RELEASE_SERVER)
cd $(RELEASE_ROOT) && tar -zcvf $(APP)-linux-adm64.tar.gz ${APP} && sudo rm -rf ${APP}
pack-darwin: build-darwin
mkdir -p $(RELEASE_SERVER)
rm -f $(APP)-darwin-amd64.tar.gz
cp -r $(SERVER_BIN)-darwin-10.6-amd64 configs web $(RELEASE_SERVER)
cp scripts/pack/* $(RELEASE_SERVER)
mv $(RELEASE_SERVER)/$(APP)-darwin-10.6-amd64 $(RELEASE_SERVER)/$(APP)
cd $(RELEASE_ROOT) && tar -zcvf $(APP)-darwin-amd64.tar.gz ${APP} && sudo rm -rf ${APP}
pack-windows-386: build-windows-386
mkdir -p $(RELEASE_SERVER)
rm -f $(APP)-windows-4.0-386.tar.gz
cp -r $(SERVER_BIN)-windows-4.0-386.exe configs web $(RELEASE_SERVER)
cp scripts/pack/* $(RELEASE_SERVER)
mv $(RELEASE_SERVER)/$(APP)-windows-4.0-386.exe $(RELEASE_SERVER)/$(APP).exe
cd $(RELEASE_ROOT) && tar -zcvf $(APP)-windows-4.0-386.tar.gz ${APP} && sudo rm -rf ${APP}
pack-windows-amd64: build-windows-amd64
mkdir -p $(RELEASE_SERVER)
rm -f $(APP)-windows-4.0-amd64.tar.gz
cp -r $(SERVER_BIN)-windows-4.0-amd64.exe configs web $(RELEASE_SERVER)
cp scripts/pack/* $(RELEASE_SERVER)
mv $(RELEASE_SERVER)/$(APP)-windows-4.0-amd64.exe $(RELEASE_SERVER)/$(APP).exe
cd $(RELEASE_ROOT) && tar -zcvf $(APP)-windows-4.0-amd64.tar.gz ${APP} && sudo rm -rf ${APP}
pack-all: pack pack-darwin pack-windows-386 pack-windows-amd64