From 4beb9585c5de6c166f49ae656a6d19ba2ab6da91 Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Mon, 12 Aug 2024 07:59:33 +0000 Subject: [PATCH] try another compile method --- .gitignore | 4 +++- Makefile | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 8915062..88fbd99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ /.devcontainer /.github /.vscode +/makebuild /grammar/.antlr /build /.cache -/.clang-format \ No newline at end of file +/.clang-format +/dist \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f50091d --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +# 定义变量 +BUILD_DIR := makebuild # 构建目录 +CMAKE_BUILD_TYPE := Release # 构建类型,可以是 Release 或 Debug + +# 默认目标 +all: build + +# 构建目标,调用CMake进行构建 +build: + @mkdir -p $(BUILD_DIR) + @cd $(BUILD_DIR) && cmake -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) -Wno-dev .. + @cd $(BUILD_DIR) && $(MAKE) -j4 + +# 运行目标,运行生成的可执行文件 +run: + @cd $(BUILD_DIR) && ./zmxcc /dev/stdin -o /dev/null + +# 清理目标 +clean: + @rm -rf $(BUILD_DIR) + +.PHONY: all build run clean