-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (79 loc) · 2.78 KB
/
Makefile
File metadata and controls
104 lines (79 loc) · 2.78 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Makefile for Constrained Persistent Perfect Phylogeny
SRC_DIR =src
OBJ_DIR =obj
LIB_DIR =lib
TEST_DIR = tests
BIN_DIR =bin
CC = gcc
P = $(BIN_DIR)/cppp
SRCS := $(wildcard $(SRC_DIR)/*.c)
SOURCES := $(SRCS:$(SRC_DIR)/%=%)
CFLAGS_STD = -g -Wall -march=native -Wno-deprecated -Wno-parentheses -Wno-format
STD_LIBS = bdw-gc
DEBUG_LIBS = #efence
LIBS = $(OBJ_DIR)/cmdline.o
CFLAGS_EXTRA = -m64 -std=c11 -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -fopenmp
CFLAGS_LIBS = `pkg-config --cflags $(STD_LIBS)`
LDLIBS = `pkg-config --libs $(STD_LIBS)`
CFLAGS = $(CFLAGS_STD) $(CFLAGS_EXTRA) $(CFLAGS_LIB)
OBJECTS = $(SOURCES:%.c=$(OBJ_DIR)/%.o) $(LIBS)
CC_FULL = $(CC) $(CFLAGS) -I$(SRC_DIR) -I$(LIB_DIR) $(CFLAGS_LIBS)
dist: CFLAGS += -O3 -DNDEBUG
dist: bin
bin: $(P)
debug: CFLAGS += -DDEBUG -O0
debug: LDLIBS += -lefence
debug: bin
debug-dist: CFLAGS += -DDEBUG -O3
debug-dist: bin
profile: CFLAGS += -O3 -DNDEBUG
profile: dist
rm -f callgrind.*
valgrind -q --tool=callgrind --dump-instr=yes $(P) -o /dev/null $(REG_TESTS_DIR)/input/test-counterexample-recomb-cg-2015.txt
# See the results with kcachegrind
$(P): $(OBJECTS)
@echo 'Linking $@'
@mkdir -p $(BIN_DIR)
$(CC_FULL) -o $@ $^ $(LDLIBS)
all: $(P) doc
echo $(OBJECTS)
${OBJ_DIR}/%.o: $(SRC_DIR)/%.c $(LIBS)
@echo '* Compiling $<'
@mkdir -p $(dir $@)
$(CC_FULL) -MM -MF $(patsubst %.c,%.d,$<) -MT $@ $<
$(CC_FULL) -o $@ -c $<
${LIB_DIR}/%.o: $(LIB_DIR)/%.c
@echo '* Compiling $<'
@mkdir -p $(dir $@)
$(CC_FULL) -MM -MF $(patsubst %.c,%.d,$<) -MT $@ $<
$(CC_FULL) -o $@ -c $<
clean: clean-test
@echo "Cleaning..."
rm -rf ${OBJ_DIR} ${P} $(SRC_DIR)/*.d $(SRC_DIR)/cmdline.[ch] callgrind.out.*
clean-test:
@echo "Cleaning tests..."
rm -rf ${TEST_DIR}/*.o ${TEST_DIR}/*/output/*
# The regression tests directory structure is:
# tests/regression/input : input matrix
# tests/regression/output : actual outputs and diffs
# tests/regression/ok : expected outputs
REG_TESTS_DIR := tests/regression
REG_TESTS_OK := $(wildcard $(REG_TESTS_DIR)/ok/*)
REG_TESTS_DIFF := $(REG_TESTS_OK:$(REG_TESTS_DIR)/ok/%=$(REG_TESTS_DIR)/output/%.diff)
thirdparty/cryptominisat/build/cryptominisat4_simple:
cd thirdparty
test -d cryptominisat || git clone https://github.com/msoos/cryptominisat.git
test -d cryptominisat/build || mkdir -p cryptominisat/build
cd cryptominisat/build && cmake .. && make -j4
tests: test
test: dist $(REG_TESTS_OK)
tests/bin/run-tests.sh
doc: dist docs/latex/refman.pdf
doxygen && cd docs/latex/ && latexmk -recorder -use-make -pdf refman
.PHONY: all clean doc unit-test clean-test regression-test profile
ifneq "$(MAKECMDGOALS)" "clean"
-include ${SOURCES:.c=.d}
-include ${T_SOURCES:.c=.d}
endif
$(SRC_DIR)/cmdline.c $(SRC_DIR)/cmdline.h: cppp.ggo
gengetopt -i $< --output-dir=$(SRC_DIR)