60 lines
907 B
Makefile
60 lines
907 B
Makefile
|
## 编译器
|
||
|
#GO=go
|
||
|
#
|
||
|
## 编译选项
|
||
|
#GOFLAGS=-v
|
||
|
|
||
|
NODE=npm
|
||
|
|
||
|
# 源文件
|
||
|
SRC=main.go
|
||
|
|
||
|
NAME=demo-server
|
||
|
|
||
|
# 目标文件
|
||
|
BIN=bin/$(NAME)
|
||
|
WEB_PATH=gui
|
||
|
WEB_DST=../internal/server/ext/web
|
||
|
|
||
|
################ 构建并启动 ########################
|
||
|
run-web: b-web b-dev run
|
||
|
dev: b-dev run
|
||
|
|
||
|
test: build test-run
|
||
|
|
||
|
################ 构建 #############################
|
||
|
build:
|
||
|
go build -o $(BIN) $(SRC)
|
||
|
|
||
|
b-web:
|
||
|
cd $(WEB_PATH) && $(NODE) install && $(NODE) run build \
|
||
|
&& rm -rf $(WEB_DST) && mv dist $(WEB_DST)
|
||
|
|
||
|
b-dev:
|
||
|
go build -o $(BIN) -tags "web swag" $(SRC)
|
||
|
|
||
|
#### 辅助工具 ######################################
|
||
|
swag-install:
|
||
|
go install github.com/swaggo/swag/cmd/swag@latest
|
||
|
|
||
|
swag:
|
||
|
swag fmt
|
||
|
swag init
|
||
|
|
||
|
############## 启动 #############################
|
||
|
run:
|
||
|
$(BIN) svr
|
||
|
|
||
|
# 测试
|
||
|
test-run:
|
||
|
$(BIN) --conf test/
|
||
|
|
||
|
# 清除
|
||
|
clean:
|
||
|
rm -rf $(BIN)
|
||
|
|
||
|
clean-app:
|
||
|
rm -rf ./app
|
||
|
|
||
|
clean-web:
|
||
|
rm -rf $(WEB_DST)
|