summaryrefslogtreecommitdiff
path: root/Makefile
blob: 3caf84cdd64269b22068b3a627df0db63955ee2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
BLOSSOM_DIR := blossom5-v2.05.src
BLOSSOM_DIRS := $(BLOSSOM_DIR) $(BLOSSOM_DIR)/MinCost $(BLOSSOM_DIR)/GEOM

BLOSSOM_SOURCES := $(filter-out $(BLOSSOM_DIR)/example.cpp, $(foreach dir, $(BLOSSOM_DIRS), $(wildcard $(dir)/*.cpp)))
BLOSSOM_OBJS := $(patsubst %.cpp, %.o, $(BLOSSOM_SOURCES))

OBJS := aztec.o
TARGETS := excitation order uniform free_energy

CFLAGS := -std=c++20 -stdlib=libc++ -flto -fopenmp -O3 -Os -march=native -mtune=native -D_NDEBUG -DPERFECT_MATCHING_DOUBLE
CXX = clang++
LD = ld.lld
LIBS := -lrt

all: $(TARGETS)

$(TARGETS): %: %.cpp $(BLOSSOM_DIR)/blossom5.o ${OBJS} aztec.hpp
	$(CXX) $(CFLAGS) $(BLOSSOM_DIR)/blossom5.o ${OBJS} $@.cpp -o $@

$(OBJS): aztec.cpp aztec.hpp
	$(CXX) $(CFLAGS) $< -c -o $@

$(BLOSSOM_DIR)/blossom5.o: ${BLOSSOM_OBJS}
	$(LD) -r -o $@ ${BLOSSOM_OBJS}

.cpp.o:
	$(CXX) $(CFLAGS) $< -c -o $@

clean:
	rm -f ${BLOSSOM_OBJS} $(BLOSSOM_DIR)/blossom5.o $(TARGETS)