SpectraRust/synspec/extracted/Makefile
2026-03-19 14:05:33 +08:00

53 lines
1.1 KiB
Makefile
Raw 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.

# Makefile for SYNSPEC extracted modules
# 使用大内存模型支持大型 COMMON 数组
FC = gfortran
FFLAGS = -O3 -fno-automatic -mcmodel=large
# 编译输出目录
BUILD_DIR = build
# 目标可执行文件
MAIN = $(BUILD_DIR)/synspec_extracted
# 所有 .f 源文件
SRCS = $(wildcard *.f)
# 目标文件放在build目录
OBJS = $(patsubst %.f,$(BUILD_DIR)/%.o,$(notdir $(SRCS)))
# 默认目标
all: $(BUILD_DIR) $(MAIN)
@echo "=========================================="
@echo "编译成功: $(MAIN)"
@echo "=========================================="
# 创建build目录
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
# 链接所有目标文件
$(MAIN): $(OBJS)
$(FC) $(FFLAGS) -o $@ $(OBJS)
# 编译规则
$(BUILD_DIR)/%.o: %.f | $(BUILD_DIR)
$(FC) $(FFLAGS) -c $< -o $@
# 清理
clean:
rm -rf $(BUILD_DIR)
# 只编译不链接(检查语法)
compile-only: $(OBJS)
@echo "所有文件编译完成(未链接)"
# 统计信息
stats:
@echo "=== 编译统计 ==="
@echo "源文件数: $(words $(SRCS))"
@echo "目标文件数: $(words $(OBJS))"
@wc -l *.f | tail -1
.PHONY: all clean compile-only stats