Makefile 1.52 KB
Newer Older
Mikaël Salson's avatar
Mikaël Salson committed
1 2
CC=g++
INCLUDE=-I ..
3 4 5
OPTIM=-g -O0 $(COVERAGE)
override CXXFLAGS += -W -Wall $(OPTIM)
LDLIBS=-lz
Mikaël Salson's avatar
Mikaël Salson committed
6 7
SRC= tests.cpp
EXEC=$(SRC:.cpp=)
Mathieu Giraud's avatar
Mathieu Giraud committed
8
OTHER_SRC=$(wildcard *.cpp)
9
LIB=../core/vidjil.a ../lib/lib.a
Mikaël Salson's avatar
Mikaël Salson committed
10 11
SHOULD=$(wildcard *.should_get)
SHOULD_LOG=$(SHOULD:.should_get=.log)
12
SHOULD_VDJ=$(wildcard should-vdj-tests/*.should-vdj.fa)
13 14
REPORTS_PATH := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../../reports
VALGRIND=valgrind -v --tool=memcheck --leak-check=full --show-reachable=yes --undef-value-errors=yes --track-origins=yes --xml=yes --xml-file=\"$$(mktemp "$(REPORTS_PATH)/valgrind.xml.XXXXXX")\"
Mikaël Salson's avatar
Mikaël Salson committed
15

Mikaël Salson's avatar
Mikaël Salson committed
16
.PHONY: all force clean forcedep
Mikaël Salson's avatar
Mikaël Salson committed
17 18 19 20 21 22 23 24 25 26 27

test: all
	@echo
	@echo "*** Launching unit tests..."
	./tests
	cat tests.cpp.tap
	@echo "*** All unit tests passed"

all: core $(EXEC)
	@echo "All tests compiled."

28
should: vidjil $(SHOULD_LOG)
Mikaël Salson's avatar
Mikaël Salson committed
29

30
shouldvdj:
31
	python should-vdj-to-tap.py -2q $(SHOULD_VDJ)
32 33
	python should-vdj-to-tap.py $(SHOULD_VDJ)

Mikaël Salson's avatar
Mikaël Salson committed
34 35
%.log: %.should_get force
	./should-to-tap.sh $<
36 37 38 39
valgrind_should:
	LAUNCHER="$(VALGRIND)" make should
valgrind_tests: vidjil tests
	$(VALGRIND) ./tests
Mikaël Salson's avatar
Mikaël Salson committed
40

Mathieu Giraud's avatar
Mathieu Giraud committed
41
$(EXEC): % : %.o $(LIB) 
42
	$(CC) -o $@ $< $(LIB) $(LDLIBS) $(LDFLAGS) $(CXXFLAGS)
Mikaël Salson's avatar
Mikaël Salson committed
43 44 45 46


../core.a: core

47
vidjil:
48 49
	make -C ../ clean
	make -C ../ OPTIM="$(OPTIM)"
50

Mikaël Salson's avatar
Mikaël Salson committed
51
core:
52
	make -C ../core
Mikaël Salson's avatar
Mikaël Salson committed
53

Mathieu Giraud's avatar
Mathieu Giraud committed
54
%.o: %.cpp $(OTHER_SRC)
55
	$(CC) -o $@ $(INCLUDE) -c $< $(CXXFLAGS)
Mikaël Salson's avatar
Mikaël Salson committed
56 57

clean:
58
	rm -f *.o $(EXEC) *.tap *.log *.gcda *.gcno *.gcov
59
	rm -rf out/
Mikaël Salson's avatar
Mikaël Salson committed
60 61 62 63

forcedep:
	g++ $(INCLUDE) -M $(SRC) > dep.mk

Mikaël Salson's avatar
Mikaël Salson committed
64 65
force:

Mikaël Salson's avatar
Mikaël Salson committed
66 67 68 69 70 71 72
DEP=$(wildcard dep.mk)

ifeq (${DEP},)
$(shell	g++ $(INCLUDE) -M $(SRC) > dep.mk)
endif
include dep.mk