try another compile method

This commit is contained in:
2024-08-12 07:59:33 +00:00
parent bbdf755d83
commit 4beb9585c5
2 changed files with 25 additions and 1 deletions

4
.gitignore vendored
View File

@ -1,7 +1,9 @@
/.devcontainer
/.github
/.vscode
/makebuild
/grammar/.antlr
/build
/.cache
/.clang-format
/.clang-format
/dist

22
Makefile Normal file
View File

@ -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