Makefile 4.77 KB
Newer Older
1
include Makefile.conf
2
#CXX=clang++ -stdlib=libc++
3
4
#CXXARGS=--std=c++14 -Wall -Wno-unused-local-typedefs -DEIGEN_NO_DEPRECATED_WARNING -pthread -DSPELL_UNSAFE_OUTPUT
CXXARGS=--std=c++14 -Wall -DEIGEN_NO_DEPRECATED_WARNING -pthread -DSPELL_UNSAFE_OUTPUT
5
LD=$(CXX)
Damien Leroux's avatar
Damien Leroux committed
6
LIBS=-rdynamic -lexpat -ldl
7
8
#VERSION_DEFINES=$(shell git tag | tail -1 | sed 's/\([0-9]*\)[.]\([0-9]*\)[.]\(.*\)/-DVERSION_MAJOR=\\\"\1\\\" -DVERSION_MINOR=\\\"\2\\\" -DVERSION_PATCH=\\\"\3\\\"/')
VERSION_DEFINES='-DVERSION_MAJOR="test" -DVERSION_MINOR="test" -DVERSION_PATCH="2"'
9
10
11

C=$(CXX) $(CXXARGS) $(INC) -DTEST_POLY $(VERSION_DEFINES)

12
13
#SRC=main.cc cache.cc fast_polynom.cc markov_population.cc ril_properties.cc frag_comp.cc model_manager.cc
SRC=main.cc cache.cc frag_comp.cc model_manager.cc
14
EXT_SRC=../src/input/read_map.cc ../src/input/read_mark.cc ../src/input/read_trait.cc ../src/outbred.cc ../src/probapop_dtd.cc ../src/input/invoke_probapop.cc ../src/static_data.cc ../src/input/read_settings.cc ../src/input/xml/xml_design.cc  ../src/input/xml/xml_format.cc  ../src/input/xml/xml_settings.cc ../src/input/ld_matrices.cc ../src/input/pedigree.cc ../src/computations/basic_data.cc ../src/computations/probabilities.cc ../src/computations/model.cc ../src/beta_gamma.cc
Damien Leroux's avatar
Damien Leroux committed
15
#SRC=main.cc fast_polynom.cc ril_properties.cc ../src/input/read_map.cc ../src/outbred.cc ../src/probapop_dtd.cc ../src/input/invoke_probapop.cc ../src/static_data.cc
16
17

OBJ=$(subst .cc,.o,$(SRC))
Damien Leroux's avatar
Damien Leroux committed
18
EXT_OBJ=$(subst ../,,$(subst .cc,.o,$(EXT_SRC)))
19

20
21
DEBUG_OPTS=-ggdb -DNDEBUG
#OPT_OPTS=-O3 -DEIGEN_NO_DEBUG -DNDEBUG
22

Damien Leroux's avatar
Damien Leroux committed
23
#COV_OPTS=-g -fprofile-arcs -ftest-coverage
24
25
COV_OPTS=--coverage
#COV_OPTS=-Xclang -coverage-cfg-checksum -Xclang -coverage-no-function-names-in-data -Xclang -coverage-version='408*'
26
27
28
29
30
31
32

PROF_OPTS=-pg -O

INFO_FILE=test-coverage.info

#C=$(CXX) $(CXXARGS) $(INC) $(DEBUG_OPTS)
C=$(CXX) $(CXXARGS) $(INC) $(DEBUG_OPTS) $(PROF_OPTS) $(VERSION_DEFINES) $(COV_OPTS)
33
C=$(CXX) $(CXXARGS) $(INC) $(OPT_OPTS) $(DEBUG_OPTS) $(VERSION_DEFINES) $(COV_OPTS)
34
35
36
37
38

all: test_suite

include .depend

Damien Leroux's avatar
Damien Leroux committed
39
40
41
PCH=catch.hpp.gch

$(PCH):%.hpp.gch: %.hpp Makefile
42
43
	$C $<

Damien Leroux's avatar
Damien Leroux committed
44
45
test_suite: $(OBJ) $(EXT_OBJ)
	$C $(OBJ) $(EXT_OBJ) -o $@ $(LIBS)
46

47
48
49
test: zerocounters test_suite
	./test_suite
	touch test
50
51
52
53
54

zerocounters:
	lcov --zerocounters --directory .


55
test-coverage: test
56
	lcov --gcov-tool $(COV) --no-checksum --directory . --capture --output-file $(INFO_FILE)
57
58
59
60
61
62
63
64
	lcov --remove $(INFO_FILE) "/*" -o $(INFO_FILE)
	lcov --remove $(INFO_FILE) "Core*" -o $(INFO_FILE)
	lcov --remove $(INFO_FILE) "Jacobi" -o $(INFO_FILE)
	lcov --remove $(INFO_FILE) "SVD" -o $(INFO_FILE)
	lcov --remove $(INFO_FILE) "LU" -o $(INFO_FILE)
	lcov --remove $(INFO_FILE) "QR" -o $(INFO_FILE)
	lcov --remove $(INFO_FILE) "misc" -o $(INFO_FILE)
	lcov --remove $(INFO_FILE) "plugins" -o $(INFO_FILE)
65
66
67
68
69
	lcov --remove $(INFO_FILE) "catch.hpp" -o $(INFO_FILE)
	genhtml --highlight --legend --output-directory TestCodeCoverage $(INFO_FILE)


.depend: $(SRC) Makefile
70
	g++ --std=c++14 $(INC) --depend $(SRC) > $@
71

Damien Leroux's avatar
Damien Leroux committed
72
73
74
75
$(OBJ):%.o: %.cc $(PCH)
	$C -c $< -o $@

$(EXT_OBJ):%.o: ../%.cc $(PCH)
76
	-mkdir -p `dirname $@`
77
78
79
	$C -c $< -o $@

clean:
80
	find src -iname '*.o' -exec rm {} \;
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
	rm -f $(OBJ) *.gcno *.gcda

opt-tests: $(SRC)
	$(CXX) $(CXXARGS) $(INC) $(OPT_OPTS) $(VERSION_DEFINES) $(SRC) $(LIBS) -o $@

#g++-4.9 --std=gnu++0x -Wall -Wno-unused-local-typedefs -I../include -I../include/input -I/usr/local/include/eigen3  -gdwarf-2 -gstrict-dwarf -Winvalid-pch  -DVERSION_MAJOR=\"0\" -DVERSION_MINOR=\"0\" -DVERSION_PATCH=\"0\" main.o fast_polynom.o markov_population.o -o test_suite -lexpat
#markov_population.o: In function `from_argv_outbred(int, char const* const*, double&)':
#/media/Stock/devel/MCQTL/v6/tests/markov_population.cc:110: undefined reference to `read_data::read_map(std::istream&)'
#/media/Stock/devel/MCQTL/v6/tests/markov_population.cc:112: undefined reference to `read_data::read_outbred(std::istream&)'
#markov_population.o: In function `test_segment(int, char const* const*)':
#/media/Stock/devel/MCQTL/v6/tests/markov_population.cc:255: undefined reference to `test_probapop(chromosome const&, marker_data const&, double)'
#markov_population.o: In function `test_segment_outbred(int, char const* const*)':
#/media/Stock/devel/MCQTL/v6/tests/markov_population.cc:328: undefined reference to `test_probapop(chromosome const&, marker_data const&, double)'
#markov_population.o: In function `algebraic_genotype::operator*(algebraic_genotype) const':
#/media/Stock/devel/MCQTL/v6/tests/../include/algebraic_genotype.h:561: undefined reference to `algebraic_genotype::null'
#/media/Stock/devel/MCQTL/v6/tests/../include/algebraic_genotype.h:613: undefined reference to `algebraic_genotype::null'
#/media/Stock/devel/MCQTL/v6/tests/../include/algebraic_genotype.h:657: undefined reference to `algebraic_genotype::null'
#collect2: error: ld returned 1 exit status
#make: *** [test_suite] Error 1