Makefile 3 KB
Newer Older
Damien Leroux's avatar
Damien Leroux committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
include Makefile.conf
#TARGET=spell-qtl.experimental
TARGET=spell-marker



#LD=g++-4.9
#CXX=clang++
COV=gcov$(GCC_VERSION)
LD=$(CXX)
LIBS=-rdynamic -lexpat -ldl
VERSION_PATCH=$(shell git rev-list --count `git rev-list --tags --max-count=1`..HEAD 2>/dev/null || echo 0)
VERSION_DEFINES=$(shell git tag | sed 's/\([0-9]*\)[.]\([0-9]*\)\([.][0-9]*\)\?/-DVERSION_MAJOR=\\\"\1\\\" -DVERSION_MINOR=\\\"\2\\\" -DVERSION_PATCH=\\\"$(VERSION_PATCH)\\\"/')
CXXARGS=-Wextra -Wall -pthread -fPIC -DEIGEN_NO_DEPRECATED_WARNING $(VERSION_DEFINES)
#CXXARGS=-Wextra -Wall -pthread -fPIC -DEIGEN_NO_DEPRECATED_WARNING $(VERSION_DEFINES)

INPUT_SRC=read_mark.cc design.cc xml/xml_design.cc xml/xml_format.cc
MAIN_SRC=static_data.cc
19
BAYES_SRC=main.cc dispatch.cc cli.cc
Damien Leroux's avatar
Damien Leroux committed
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
105
106
107
108
109
110
111

#SRC=malloc.cc $(addprefix input/,$(INPUT_SRC)) $(addprefix computations/,$(COMPUTATIONS_SRC)) $(MAIN_SRC)
SRC=$(addprefix ../input/,$(INPUT_SRC)) $(addprefix ../,$(MAIN_SRC)) $(BAYES_SRC)

OBJ=$(subst .cc,.o,$(SRC))
DEP=$(subst .cc,.d,$(SRC))
COV_OBJ=$(subst .cc,.cov.o,$(SRC))

DEBUG_OPTS=-ggdb
#DEBUG_OPTS=-ggdb -DNDEBUG
#OPT_OPTS=-O3 -DEIGEN_NO_DEBUG -DNDEBUG
#PROF_OPTS=-O2 -DEIGEN_NO_DEBUG -DNDEBUG -g -pg

#DEBUG_OPTS=-ggdb
#OPT_OPTS=-O3 -DNDEBUG
#OPT_OPTS=-O -DEIGEN_NO_DEBUG -DNDEBUG
#OPT_OPTS=-DEIGEN_NO_DEBUG -DNDEBUG
#OPT_OPTS=-O -DNDEBUG
#OPT_OPTS=-DNDEBUG
#OPT_OPTS=-O3 -DNDEBUG
#OPT_OPTS=-O3 -DNDEBUG

#DEBUG_OPTS=-Winvalid-pch -ggdb #-H
#DEBUG_OPTS=-ggdb -DNDEBUG
#EXTRA_OPTS=-g
#EXTRA_OPTS=-fomit-frame-pointer -g
#OPT_OPTS=-O0 -ggdb -DEIGEN_NO_DEBUG -DNDEBUG
#OPT_OPTS=-O2 -DEIGEN_NO_DEBUG -DNDEBUG $(EXTRA_OPTS)
#OPT_OPTS=-O2 -DEIGEN_NO_DEBUG -DNDEBUG -g -fPIE -pie -fsanitize=thread
#OPT_OPTS=-O0 -ggdb -DEIGEN_NO_DEBUG -DNDEBUG -g -fPIE -pie -fsanitize=thread
#COV_OPTS=$(DEBUG_OPTS) --coverage

.header: .FORCE
	@echo "*********************************************************"
	@echo "**  MAKE  ***********************************************"
	@echo "*********************************************************"
	@echo "$(INC)"

-include .header

INFO_FILE=test-coverage.info

C=$(CXX) $(CXXARGS) $(INC) $(OPT_OPTS) $(DEBUG_OPTS) $(PROF_OPTS) $(EXTRA_OPTS)
L=$(LD) $(CXXARGS) $(INC) $(OPT_OPTS) $(DEBUG_OPTS) $(PROF_OPTS) $(EXTRA_OPTS)
		

all: $(TARGET)


include .depend


test: $(OBJ)
	$C $(OBJ) -o $@ $(LIBS)

fast_polynom.o: fast_polynom.cc
	$C $(COV_OPTS) -c $< -o $@

test_fast_polynom: fast_polynom.o
	$C $(COV_OPTS) $< -o $@

test-coverage: test_fast_polynom
	lcov --zerocounters --directory .
	./$< | tail -3
	lcov --gcov-tool $(COV) --no-checksum --directory . --capture --output-file $(INFO_FILE)
	lcov --remove $(INFO_FILE) "/usr*" -o $(INFO_FILE)
	lcov --remove $(INFO_FILE) "catch.hpp" -o $(INFO_FILE)
	genhtml --highlight --legend --output-directory TestCodeCoverage $(INFO_FILE)


#.depend: $(SRC) Makefile
#	$C --depend $(SRC) > $@

.depend: $(DEP)
	cat $(DEP) > $@

$(DEP):%.d: %.cc
	$C -MM $< -MT $@\ $(subst .d,.o,$@) -o $@

clean:
	rm -f $(DEP) .depend
	rm -f $(OBJ)
	rm -f $(TARGET)

.FORCE:

$(TARGET): $(OBJ)
	$L $(OBJ) $(LIBS) -o $@

$(OBJ):%.o: %.cc
	$C -c $< -o $@