diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8d01f9a --- /dev/null +++ b/Makefile @@ -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 \ No newline at end of file diff --git a/tunnelserver/Makefile b/tunnelserver/Makefile index 05cc459..081f179 100644 --- a/tunnelserver/Makefile +++ b/tunnelserver/Makefile @@ -12,8 +12,8 @@ copy: cp -r ./conf.json $(BIN_DIR) clean: - rm -f $(BIN_DIR) + rm -rf $(BIN_DIR) test: go test -v ./... -.PHONY: clean test \ No newline at end of file +.PHONY: clean all \ No newline at end of file