-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (64 loc) · 2.25 KB
/
Makefile
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
.PHONY: all lib clean check check-valgrind check-python
.PHONY: unittest unittest-valgrind python-ctypesgen
CC = cc
CFLAGS += -std=c99
CFLAGS += -O3
#CFLAGS += -O2 -ggdb3
CFLAGS += -pedantic -Wall -Wextra -Wshadow
CFLAGS += -Werror
CFLAGS += -Wno-unused-parameter -Wno-unused-variable -Wno-absolute-value
CFLAGS += -Wstrict-prototypes
# CFLAGS += -Wmissing-prototypes
CPPFLAGS += -I.
#CFLAGS += -DNDEBUG
LDFLAGS = -lm
LDFLAGS_GSL = -lgsl -lgslcblas -lm
PROGS_OPT = opt-md opt-sd eval-score eval-dGdp
PROGS_MISC = eval-useq eval-pseq random-seq random-vienna
PROGS_GSL = opt-sd-gsl
ALLPROGS = $(PROGS_OPT) $(PROGS_MISC) $(PROGS_GSL)
OBJS_COMMON = na.o nn_param.o $(OBJS_CTOOLS)
OBJS_OPT = opt.o nj_param.o dss.o helpers-for-main.o helpers-for-main-opt.o $(OBJS_MD)
OBJS_CTOOLS = ctools/dary.o ctools/libctools.o ctools/num_utils.o ctools/random.o
OBJS_MD = md/md.o
ALLOBJS = $(OBJS_COMMON) $(OBJS_OPT) $(OBJS_CTOOLS) $(OBJS_MD)
LIB_FILE_EXT = so
LIBDSSOPT = libdssopt.$(LIB_FILE_EXT)
ALLOBJS_SRC := $(subst .o,.c, $(ALLOBJS))
all: $(ALLPROGS) lib
lib: $(LIBDSSOPT)
clean:
rm -f $(ALLPROGS) $(ALLOBJS) $(LIBDSSOPT)
make -C unittest clean
check: all unittest
@echo "#######################"
@echo "# Running program tests"
@echo "#######################"
./tests/test-executables.bash
check-valgrind: all unittest-valgrind
@echo "#####################################"
@echo "# Running program tests with valgrind"
@echo "#####################################"
./tests/test-executables.bash --valgrind
check-python: python-ctypesgen
. ./python/venv/bin/activate && \
pip install ./python/[test] && \
pytest
python-ctypesgen:
python3 python/setup.py ctypesgen
unittest: lib
make -C unittest check
unittest-valgrind: lib
make -C unittest check-valgrind
$(PROGS_MISC): %: main-%.c $(OBJS_COMMON)
@echo -n "[LINK ] "
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(PROGS_OPT): %: main-%.c $(OBJS_COMMON) $(OBJS_OPT)
@echo -n "[LINK ] "
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS)
$(PROGS_GSL): %: main-%.c $(OBJS_COMMON) $(OBJS_OPT)
@echo -n "[LINK ] "
$(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS_GSL)
$(LIBDSSOPT): $(ALLOBJS_SRC)
@echo -n "[SHAREDLIB] "
$(CC) -shared -fPIC $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS)