Files
MXCompiler/Makefile
2024-10-22 12:52:34 +00:00

26 lines
671 B
Makefile
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 定义变量
BUILD_DIR := makebuild # 构建目录
CMAKE_BUILD_TYPE := Release # 构建类型,可以是 Release 或 Debug
BUILTIN_ASM := src/IR/builtin.s # 内置汇编文件
# 默认目标
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
acturalrun:
@cd $(BUILD_DIR) && ./zmxcc /dev/stdin -o /dev/stdout --optimize-all 2>/dev/null
# 运行目标,运行生成的可执行文件
run: acturalrun
@cat $(BUILTIN_ASM) >>/dev/stdout
# 清理目标
clean:
@rm -rf $(BUILD_DIR)
.PHONY: all build run clean