-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
75 lines (60 loc) · 2.35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.PHONY: all
all: bin/gvcfgenotyper bin/test_gvcfgenotyper
# hard-coded version
VERSION_MAJOR=2019.02.26
# if we are in a git repo and if git binary is available, add git hash + branch info
GIT_HASH = $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null)_$(shell git describe --always 2> /dev/null)
ifneq "$(GIT_HASH)" "_"
VERSION= -DGG_VERSION=\"$(VERSION_MAJOR)_$(GIT_HASH)\"
else
VERSION= -DGG_VERSION=\"$(VERSION_MAJOR)\"
endif
CC=gcc
CXX=g++
CXXFLAGS= -std=c++11 -O2 $(VERSION)
CFLAGS = -O2 $(VERSION)
IFLAGS = -Isrc/cpp/lib/ -Isrc/c/
LFLAGS = -lz -lm -lpthread -llzma -lbz2
#testing stuff
TESTFLAGS = -I./external/googletest-release-1.8.0//googletest/include/
include external/googletest-release-1.8.0//googletest/make/Makefile
#htslib stuff
HTSDIR=external/htslib-1.9
include $(HTSDIR)/htslib.mk
HTSLIB = $(HTSDIR)/libhts.a
IFLAGS += -I$(HTSDIR)
# spdlog
SPDLOGDIR=external/spdlog
IFLAGS += -I$(SPDLOGDIR)
#special builds for debugging and profiling
debug: CXXFLAGS = -std=c++11 -g -O1 -Wall $(VERSION)
debug: CFLAGS = -g -O1 $(VERSION)
debug: all
profile: CXXFLAGS = -std=c++11 -pg $(VERSION)
profile: CFLAGS = -pg $(VERSION)
profile: all
OBJS=$(shell for i in src/cpp/lib/*.cpp;do echo build/$$(basename $${i%cpp})o;done)
OBJS+=$(shell for i in src/c/*.c;do echo build/$$(basename $${i%c})o;done)
TESTOBJS=$(shell for i in src/cpp/test/*.cpp;do echo build/$$(basename $${i%cpp})o;done)
-include $(addsuffix .d,$(OBJS) )
-include $(addsuffix .d,$(TESTOBJS) )
build/%.o: src/cpp/test/%.cpp
$(CXX) $(CXXFLAGS) $(IFLAGS) $(TESTFLAGS) -c -o $@ $<
$(CXX) -MT $@ -MM $(CXXFLAGS) $(IFLAGS) $(TESTFLAGS) $< -o [email protected]
build/%.o: src/cpp/lib/%.cpp
$(CXX) $(CXXFLAGS) $(IFLAGS) -c -o $@ $<
$(CXX) -MT $@ -MM $(CXXFLAGS) $(IFLAGS) $< -o [email protected]
build/%.o: src/c/%.c
$(CC) $(CFLAGS) $(IFLAGS) -c -o $@ $<
$(CC) -MT $@ -MM $(CFLAGS) $(IFLAGS) $< -o [email protected]
bin/gvcfgenotyper: src/cpp/gvcfgenotyper.cpp $(OBJS) $(HTSLIB)
$(CXX) $(CXXFLAGS) -o $@ src/cpp/gvcfgenotyper.cpp $(OBJS) $(HTSLIB) $(IFLAGS) $(LFLAGS)
bin/test_gvcfgenotyper: $(OBJS) $(TESTOBJS) $(HTSLIB) build/gtest.a build/gtest_main.a
$(CXX) $(CXXFLAGS) $(TESTFLAGS) -o $@ $(TESTOBJS) $(OBJS) $(IFLAGS) $(HTSLIB) $(LFLAGS) build/gtest.a build/gtest_main.a
.PHONY: test
test: bin/test_gvcfgenotyper bin/gvcfgenotyper
bin/test_gvcfgenotyper
bash -e src/bash/run_regression_tests.sh
.PHONY: clean
clean:
rm -rf build/* bin/*