Makefile 3.94 KB
Newer Older
1
2
GCC_VERSION=-4.9
CXX=g++$(GCC_VERSION)
Damien Leroux's avatar
Damien Leroux committed
3
CXXARGS=--std=gnu++0x -Wall -Wno-unused-local-typedefs -DEIGEN_NO_DEPRECATED_WARNING -pthread
4
5
6
COV=gcov$(GCC_VERSION)
INC=-I../include -I../include/input -I/usr/local/include/eigen3
LD=$(CXX)
Damien Leroux's avatar
Damien Leroux committed
7
LIBS=-rdynamic -lexpat -ldl
8
9
10
11
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)

Damien Leroux's avatar
Damien Leroux committed
12
SRC=main.cc cache.cc fast_polynom.cc markov_population.cc ril_properties.cc frag_comp.cc
Damien Leroux's avatar
Damien Leroux committed
13
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=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
15
16

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

Damien Leroux's avatar
Damien Leroux committed
19
DEBUG_OPTS=-ggdb
20
21
OPT_OPTS=-O3 -DEIGEN_NO_DEBUG -DNDEBUG

Damien Leroux's avatar
Damien Leroux committed
22
#COV_OPTS=-g -fprofile-arcs -ftest-coverage
23
24
25
26
27
28
29
30
COV_OPTS=$(DEBUG_OPTS) --coverage

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)
Damien Leroux's avatar
Damien Leroux committed
31
C=$(CXX) $(CXXARGS) $(INC) $(OPT_OPTS) $(DEBUG_OPTS) $(VERSION_DEFINES)
32
33
34
35
36

all: test_suite

include .depend

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

39
40
pch: $(PCH)

Damien Leroux's avatar
Damien Leroux committed
41
$(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
50
51
52
53
54
55
56
57
58
59
60
61
62
63

test: test_suite
	./$<

zerocounters:
	lcov --zerocounters --directory .


test-coverage: zerocounters test
	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) > $@

Damien Leroux's avatar
Damien Leroux committed
64
65
66
67
$(OBJ):%.o: %.cc $(PCH)
	$C -c $< -o $@

$(EXT_OBJ):%.o: ../%.cc $(PCH)
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	$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