Makefile 4.63 KB
Newer Older
1
include Makefile.conf
2
3
4
#CXX=clang++ -stdlib=libc++
#CXXARGS=--std=c++11 -Wall -Wno-unused-local-typedefs -DEIGEN_NO_DEPRECATED_WARNING -pthread -DSPELL_UNSAFE_OUTPUT
CXXARGS=--std=c++11 -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
9
10
VERSION_DEFINES=$(shell git tag | sed 's/\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)/-DVERSION_MAJOR=\\\"\1\\\" -DVERSION_MINOR=\\\"\2\\\" -DVERSION_PATCH=\\\"\3\\\"/')

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

11
12
SRC=main.cc cache.cc fast_polynom.cc markov_population.cc ril_properties.cc frag_comp.cc model_manager.cc
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
13
#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
14
15

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

18
19
DEBUG_OPTS=-ggdb -DNDEBUG
#OPT_OPTS=-O3 -DEIGEN_NO_DEBUG -DNDEBUG
20

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

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)
31
C=$(CXX) $(CXXARGS) $(INC) $(OPT_OPTS) $(DEBUG_OPTS) $(VERSION_DEFINES) $(COV_OPTS)
32
33
34
35
36

all: test_suite

include .depend

Damien Leroux's avatar
Damien Leroux committed
37
38
39
PCH=catch.hpp.gch

$(PCH):%.hpp.gch: %.hpp Makefile
40
41
	$C $<

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

45
46
47
test: zerocounters test_suite
	./test_suite
	touch test
48
49
50
51
52

zerocounters:
	lcov --zerocounters --directory .


53
test-coverage: test
54
	lcov --gcov-tool $(COV) --no-checksum --directory . --capture --output-file $(INFO_FILE)
55
56
57
58
59
60
61
62
	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)
63
64
65
66
67
	lcov --remove $(INFO_FILE) "catch.hpp" -o $(INFO_FILE)
	genhtml --highlight --legend --output-directory TestCodeCoverage $(INFO_FILE)


.depend: $(SRC) Makefile
68
	g++-4.9 --std=c++11 $(INC) --depend $(SRC) > $@
69

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

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

clean:
78
	find src -iname '*.o' -exec rm {} \;
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
	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