2023-03-26 19:15:17 +08:00
|
|
|
# 定义源文件列表
|
2023-03-28 08:45:04 +00:00
|
|
|
SOURCES := $(shell find ./src -type f -name "*.cpp")
|
2023-03-26 19:15:17 +08:00
|
|
|
|
|
|
|
# 将源文件列表转换为目标文件列表
|
|
|
|
OBJECTS := $(addprefix build/,$(SOURCES:%=%.o))
|
|
|
|
|
|
|
|
# 声明编译器和编译选项
|
2023-03-29 07:12:33 +00:00
|
|
|
CXX := mpicxx
|
2023-04-20 14:49:05 +08:00
|
|
|
CXXFLAGS := -std=c++17 -O3 -Wall -Wextra -MMD -MP -march=native -mtune=native -g
|
2023-03-26 19:15:17 +08:00
|
|
|
|
2023-03-29 07:12:33 +00:00
|
|
|
LIBS := -Wl,-Bstatic -lkissat -L kissat-inc/build -I kissat-inc/ \
|
2023-05-10 19:55:40 +08:00
|
|
|
-lmapleCOMSPS -L mapleCOMSPS/build/release/lib -I mapleCOMSPS/mapleCOMSPS/ \
|
|
|
|
-lm4ri -L mapleCOMSPS/m4ri-20140914/.libs -I mapleCOMSPS/m4ri-20140914/ \
|
2023-03-29 07:12:33 +00:00
|
|
|
-pthread -lz -lm -lboost_thread -lboost_date_time -lboost_system \
|
|
|
|
-Wl,-Bdynamic -lmpi_cxx -lmpi
|
2023-03-26 19:15:17 +08:00
|
|
|
|
|
|
|
# 默认目标,编译所有目标文件
|
2023-03-28 08:45:04 +00:00
|
|
|
light: $(OBJECTS)
|
2023-03-26 19:15:17 +08:00
|
|
|
$(CXX) $(CXXFLAGS) $^ -o $@ $(LIBS)
|
|
|
|
|
|
|
|
build/%.o: % | build
|
|
|
|
$(CXX) $(CXXFLAGS) -c $< -o $@ $(LIBS)
|
|
|
|
|
|
|
|
# 包含依赖文件
|
|
|
|
-include $(OBJECTS:.o=.d)
|
|
|
|
|
|
|
|
# 如果需要,则递归创建源文件的目录结构
|
|
|
|
build:
|
|
|
|
mkdir -p $(sort $(dir $(OBJECTS)))
|
|
|
|
|
|
|
|
# 清除所有目标文件和build目录
|
|
|
|
clean:
|
|
|
|
rm -rf build $(OBJECTS)
|
|
|
|
|
|
|
|
.PHONY: clean all
|