Makefile 2.41 KB
Newer Older
Mikaël Salson's avatar
Mikaël Salson committed
1
CC=g++
2
OPTIM=-O2 -DNDEBUG  $(COVERAGE)
3
CXXFLAGS=-W -Wall $(OPTIM) $(DEBUG) $(CONFIG)
Mathieu Giraud's avatar
Mathieu Giraud committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

## inspired from http://stackoverflow.com/questions/399850/best-compiler-warning-level-for-c-c-compilers/401276
PARANOID= -Wall -Weffc++ -pedantic  \
    -Wextra -Waggregate-return -Wcast-align \
    -Wcast-qual  -Wchar-subscripts  -Wcomment -Wconversion \
    -Wdisabled-optimization \
    -Wfloat-equal  -Wformat  -Wformat=2 \
    -Wformat-nonliteral -Wformat-security  \
    -Wformat-y2k \
    -Wimplicit  -Wimport  -Winit-self  -Winline \
    -Winvalid-pch   -Wlong-long -Wmissing-braces \
    -Wmissing-field-initializers -Wmissing-format-attribute   \
    -Wmissing-include-dirs -Wmissing-noreturn \
    -Wpacked  -Wpadded -Wparentheses  -Wpointer-arith \
    -Wredundant-decls -Wreturn-type \
    -Wsequence-point  -Wshadow -Wsign-compare  -Wstack-protector \
    -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch  -Wswitch-default \
    -Wswitch-enum -Wtrigraphs  -Wuninitialized \
    -Wunknown-pragmas  -Wunreachable-code -Wunused \
    -Wunused-function  -Wunused-label  -Wunused-parameter \
    -Wunused-value  -Wunused-variable  -Wvariadic-macros \
    -Wvolatile-register-var  -Wwrite-strings
26
LDFLAGS=-lm -lz
27
EXEC=vidjil
Mikaël Salson's avatar
Mikaël Salson committed
28
MAINCORE=$(wildcard *.cpp)
29
LIBCORE=core/vidjil.a lib/lib.a
Mikaël Salson's avatar
Mikaël Salson committed
30 31

BINDIR=..
32
CGIDIR=../browser/cgi
Mikaël Salson's avatar
Mikaël Salson committed
33

34
CREATE_VERSION_GIT_H := $(shell test -x ./create-git-version-h.sh && ./create-git-version-h.sh)
35

36
.PHONY: all core lib clean forcedep
37

38
v: vidjil align.cgi
Mikaël Salson's avatar
Mikaël Salson committed
39

40 41
###

Mathieu Giraud's avatar
Mathieu Giraud committed
42 43 44 45 46
paranoid: clean
	make vidjil OPTIM="$(PARANOID)"

###

47 48 49 50 51 52 53 54 55 56
kmers: cleankmers
	make CONFIG="-DDEBUG_KMERS"

nokmers: cleankmers
	make

cleankmers:
	rm -f vidjil.o core/windowExtractor.o core/segment.o

###
Mathieu Giraud's avatar
Mathieu Giraud committed
57 58 59 60 61

spaced: cleanspaced
	make

nospaced: cleanspaced
Mikaël Salson's avatar
Mikaël Salson committed
62
	make CONFIG="-DNO_SPACED_SEEDS"
Mathieu Giraud's avatar
Mathieu Giraud committed
63 64

cleanspaced:
Mikaël Salson's avatar
Mikaël Salson committed
65
	rm -f vidjil.o core/tools.o
Mathieu Giraud's avatar
Mathieu Giraud committed
66

67
###
Mathieu Giraud's avatar
Mathieu Giraud committed
68

Mathieu Giraud's avatar
Mathieu Giraud committed
69
align.cgi: cgi/align.o
Mathieu Giraud's avatar
Mathieu Giraud committed
70
	mkdir -p $(CGIDIR)
71 72 73 74
	make -C core OPTIM="$(OPTIM)"
	$(CC) -o $(CGIDIR)/align.cgi cgi/align.o $(LIBCORE) $(LDFLAGS) $(CXXFLAGS)
###

Mikaël Salson's avatar
Mikaël Salson committed
75 76 77 78 79 80
all: $(EXEC)

debug:
	make clean
	make DEBUG="-ggdb"

81
$(EXEC): %: %.o 
82
	make -C core OPTIM="$(OPTIM)"
83
	make -C lib OPTIM="$(OPTIM)"
84
	$(CC) -o $(BINDIR)/$@ $^ $(LIBCORE) $(LDFLAGS) $(CXXFLAGS)
Mikaël Salson's avatar
Mikaël Salson committed
85 86

clean:
87
	make -C core $@
88
	make -C lib $@
Mathieu Giraud's avatar
Mathieu Giraud committed
89
	rm -f *.o *.gcda *.gcno *.gcov cgi/*.o
Mikaël Salson's avatar
Mikaël Salson committed
90 91 92 93
	cd $(BINDIR) ; rm -f $(EXEC)
	make -C tests $@

forcedep:
94
	g++ -M $(MAINCORE) > dep.mk
95
	make -C core forcedep
96
	make -C lib forcedep
Mikaël Salson's avatar
Mikaël Salson committed
97 98 99 100

DEP=$(wildcard dep.mk)

ifeq (${DEP},)
101
$(shell	g++ -M $(MAINCORE) > dep.mk)
Mikaël Salson's avatar
Mikaël Salson committed
102 103 104
endif
include dep.mk