Makefile 1.32 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)
Mikaël Salson's avatar
Mikaël Salson committed
13

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

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

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

26
should: vidjil $(SHOULD_LOG)
Mikaël Salson's avatar
Mikaël Salson committed
27

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

Mikaël Salson's avatar
Mikaël Salson committed
32 33
%.log: %.should_get force
	./should-to-tap.sh $<
34 35
valgrind:
	LAUNCHER='valgrind --tool=memcheck --leak-check=full --show-reachable=yes --undef-value-errors=yes --track-origins=yes --xml=yes --xml-file=$$(mktemp --tmpdir=. --suffix=.valgrind)' make should
Mikaël Salson's avatar
Mikaël Salson committed
36

Mathieu Giraud's avatar
Mathieu Giraud committed
37
$(EXEC): % : %.o $(LIB) 
38
	$(CC) -o $@ $< $(LIB) $(LDLIBS) $(LDFLAGS) $(CXXFLAGS)
Mikaël Salson's avatar
Mikaël Salson committed
39 40 41 42


../core.a: core

43
vidjil:
44
	make -C ../
45

Mikaël Salson's avatar
Mikaël Salson committed
46
core:
47
	make -C ../core
Mikaël Salson's avatar
Mikaël Salson committed
48

Mathieu Giraud's avatar
Mathieu Giraud committed
49
%.o: %.cpp $(OTHER_SRC)
50
	$(CC) -o $@ $(INCLUDE) -c $< $(CXXFLAGS)
Mikaël Salson's avatar
Mikaël Salson committed
51 52

clean:
53
	rm -f *.o $(EXEC) *.tap *.log *.gcda *.gcno *.gcov
54
	rm -rf out/
Mikaël Salson's avatar
Mikaël Salson committed
55 56 57 58

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

Mikaël Salson's avatar
Mikaël Salson committed
59 60
force:

Mikaël Salson's avatar
Mikaël Salson committed
61 62 63 64 65 66 67
DEP=$(wildcard dep.mk)

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