adjust make file

This commit is contained in:
程广 2024-11-14 11:35:22 +08:00
parent bf00c0c14c
commit edd12ff347
2 changed files with 32 additions and 2 deletions

30
Makefile Normal file
View File

@ -0,0 +1,30 @@
# 定义项目路径
PROJECT_DIR := $(shell pwd)
# 定义输出二进制文件的路径
BIN_DIR := dist
# 定义应用程序的名称
APPS := tunnelserver
# 创建输出目录
$(BIN_DIR):
mkdir -p $(BIN_DIR)
# 构建所有应用程序
build: $(BIN_DIR)
$(foreach app,$(APPS),$(MAKE) -C $(app);)
# 清理构建文件
clean:
$(foreach app,$(APPS),$(MAKE) -C $(app) clean;)
rm -rf $(BIN_DIR)
# 运行测试
test:
$(foreach app,$(APPS),$(MAKE) -C $(app) test;)
# 运行所有任务
all: clean build
.PHONY: build clean test all

View File

@ -12,8 +12,8 @@ copy:
cp -r ./conf.json $(BIN_DIR) cp -r ./conf.json $(BIN_DIR)
clean: clean:
rm -f $(BIN_DIR) rm -rf $(BIN_DIR)
test: test:
go test -v ./... go test -v ./...
.PHONY: clean test .PHONY: clean all