-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
65 lines (48 loc) · 1.52 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
#modied from htslib makefile
#FLAGS=-O3 -std=c++11
FLAGS=-ggdb -std=c++11
CFLAGS += $(FLAGS)
CXXFLAGS += $(FLAGS)
CSRC = $(wildcard *.c)
CXXSRC = $(wildcard *.cpp)
OBJ = $(CSRC:.c=.o) $(CXXSRC:.cpp=.o)
all: decluster
# Adjust $(HTSSRC) to point to your top-level htslib directory
ifdef HTSSRC
$(info HTSSRC defined)
HTS_INCDIR=$(realpath $(HTSSRC))
HTS_LIBDIR=$(realpath $(HTSSRC))/libhts.a
else
$(info HTSSRC not defined, assuming systemwide installation -lhts)
endif
-include $(OBJ:.o=.d)
ifdef HTSSRC
%.o: %.c
$(CC) -c $(CFLAGS) -I$(HTS_INCDIR) $*.c
$(CC) -MM $(CFLAGS) -I$(HTS_INCDIR) $*.c >$*.d
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) -I$(HTS_INCDIR) $*.cpp
$(CXX) -MM $(CXXFLAGS) -I$(HTS_INCDIR) $*.cpp >$*.d
decluster: $(OBJ)
$(CXX) $(FLAGS) -o decluster *.o $(HTS_LIBDIR) -lz -llzma -lbz2 -lpthread -lcurl -lgsl
else
%.o: %.c
$(CC) -c $(CFLAGS) $*.c
$(CC) -MM $(CFLAGS) $*.c >$*.d
%.o: %.cpp
$(CXX) -c $(CXXFLAGS) $*.cpp
$(CXX) -MM $(CXXFLAGS) $*.cpp >$*.d
decluster: $(OBJ)
$(CXX) $(FLAGS) -o decluster *.o -lz -llzma -lbz2 -lpthread -lcurl -lhts -lgsl
endif
clean:
rm -f decluster *.o *.d
testbams := $(wildcard tests/test*sam)
test: $(testbams)
for bam in $(testbams); do \
./decluster -0 -w $${bam} -o $${bam%.sam}.test 2> $${bam%.sam}.log; \
diff $${bam%.sam}.test.hist.txt $${bam%.sam}.expected.hist.txt; \
bash -v -c "diff <(sed 1d $${bam%.sam}.test.dupstat.txt) <(sed 1d $${bam%.sam}.expected.dupstat.txt)"; \
done
cleantest:
rm -v tests/*.test* tests/*.log tests/*bamin.test* tests/*histin.test*