Makefile 4.75 KB
Newer Older
1
2
GCC_VERSION=-4.9
CXX=g++$(GCC_VERSION)
3
4
5
6
#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
COV=gcov #llvm-cov-3.4  #gcov #$(GCC_VERSION)
7
INC=-I../include -I../include/input -I/home/damien/include/eigen3 -I/home/damien/include
8
LD=$(CXX)
Damien Leroux's avatar
Damien Leroux committed
9
LIBS=-rdynamic -lexpat -ldl
10
11
12
13
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)

14
15
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
16
#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
17
18

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

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

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

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)
34
C=$(CXX) $(CXXARGS) $(INC) $(OPT_OPTS) $(DEBUG_OPTS) $(VERSION_DEFINES) $(COV_OPTS)
35
36
37
38
39

all: test_suite

include .depend

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

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

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

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

zerocounters:
	lcov --zerocounters --directory .


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


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

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

$(EXT_OBJ):%.o: ../%.cc $(PCH)
77
	-mkdir -p `dirname $@`
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
	$C -c $< -o $@

clean:
	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