From edd12ff34784e4176abdc3672f355e4cdec8b3ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=B9=BF?= Date: Thu, 14 Nov 2024 11:35:22 +0800 Subject: [PATCH] adjust make file --- Makefile | 30 ++++++++++++++++++++++++++++++ tunnelserver/Makefile | 4 ++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 Makefile 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