-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
151 lines (121 loc) · 4.05 KB
/
Copy pathMakefile
File metadata and controls
151 lines (121 loc) · 4.05 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
WALL = -Wall -Werror
FLAGS = $(WALL) -g -DDO_DEBUG -D_FILE_OFFSET_BITS=64 -std=c++0x
# PROF_DIR = PROF <= GCC Bug 47793: relative path turns into absolute
PROF_DIR =
FLAGS_FAST= -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -msse3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
FLAGS_OPT = $(WALL) $(PROF_DIR) $(FLAGS_FAST) -fprofile-use
FLAGS_PROF= $(WALL) $(PROF_DIR) $(FLAGS_FAST) -fprofile-generate
FLAGS_OPT2 = $(WALL) $(PROF_DIR) $(FLAGS_FAST)
# harmless in non-macOS env
export MACOSX_DEPLOYMENT_TARGET=10.14
# ifeq ("$(wildcard ./tmp_samples)","")
ifeq ($(sampdir),)
TEST_FILES = $(wildcard samples/*.fq)
TEST_FILES += $(wildcard samples/*.fastq)
else
TEST_FILES = $(wildcard $(sampdir)/*.fq)
TEST_FILES += $(wildcard $(sampdir)/*.fastq)
endif
all: slimfastq
opt: slimfastq.opt
prof-opt.run:
for l in 1 2 3; do\
for f in $(TEST_FILES) ; do \
echo $$f ... ; \
./slimfastq.prof -f /tmp/mytst -u $$f -O -P -l $$l ; \
./slimfastq.prof -f /tmp/mytst -u /tmp/mytst.copy -O -d ; \
done ; \
done
prof-opt: slimfastq.prof
make prof-opt.run
make opt
make profclean
# find . -name '*.gcda' -delete
profclean:
mkdir -p PROF
find PROF -name '*.gcda' -delete
mv *.gcda PROF/ || true
rm *.prof || true
clean: profclean
find . -name '*.o' -delete
rm slimfastq slimfastq.* test-filer || true
gdb: slimfastq.gdb
SOURCES= $(filter-out utest.cpp one.cpp molder.cpp filer.tst.cpp, $(shell ls *.cpp))
HEADERS= $(shell echo *.hpp)
slimfastq.gdb: $(SOURCES) $(HEADERS)
g++ $(FLAGS) -o $@ $(SOURCES)
valgrind: slimfastq.valgrind
slimfastq.valgrind: $(SOURCES) $(HEADERS)
g++ $(FLAGS) -DHAPPY_VALGRIND -o $@ $(SOURCES)
.PHONY: slimfastq slimfastq.gdb slimfastq.valgrind test-filer
slimfastq:
g++ $(FLAGS_OPT2) -o $@ $(SOURCES)
@ echo "Done."
slimfastq.opt:
mv PROF/*.gcda . || true
g++ $(FLAGS_OPT) -o $@ $(SOURCES)
mv *.gcda PROF || true
slimfastq.prof:
g++ $(FLAGS_PROF) -o $@ $(SOURCES)
prof:
g++ -O3 -fstrict-aliasing -ffast-math -pg -o slimfastq.prof $(SOURCES)
molder: molder.cpp pager.cpp pager.hpp
g++ $(FLAGS) molder.cpp pager.cpp -o $@
tags:
etags $(SOURCES) $(HEADERS)
# UTSRC= $(filter-out one.cpp molder.cpp main.cpp, $(shell ls *.cpp))
# UTHDR= $(shell ls *.hpp)
# slimfastq.utest: $(UTSRC) $(UTHDR)
# g++ $(FLAGS) $(UTSRC) -o $@
#
# utest: slimfastq.utest
# ./slimfastq.utest
# small: all
# ./slimfastq -f ../data/small.fq -u ../data/small.fq -O
# ./slimfastq -f ../data/small.fq -u ../data/small.fq.tst -O -d
# ../data/mydiff.pl ../data/small.fq ../data/small.fq.tst
# time: prof-opt
# time ./slimfastq.opt -f ../data/t -u ../data/s.fastq -O
# time ./slimfastq.opt -f ../data/t -u ../data/s.fastq.tst -O -d
# cmp ../data/s.fastq ../data/s.fastq.tst
test: all
for l in 1 2 3 4; do \
for f in $(TEST_FILES) ; do \
echo $$f $$l... ; \
rm /tmp/mytst.* || true; \
./slimfastq -u $$f -f /tmp/mytst -O -l $$l -q && \
./slimfastq -u /tmp/mytst.fastq -f /tmp/mytst -O -d && \
tools/mydiff.pl $$f /tmp/mytst.fastq || break ; \
done || break ; \
done
tost: all
for l in 1 ; do \
for f in $(TEST_FILES) ; do \
echo $$f $$l... ; \
rm /tmp/mytst.* || true; \
./slimfastq -u $$f -f /tmp/mytst -O -l $$l -q && \
./slimfastq -u /tmp/mytst.fastq -f /tmp/mytst -O -d && \
tools/mydiff.pl $$f /tmp/mytst.fastq || break ; \
done || break ; \
done
test-filer:
g++ $(FLAGS) -o $@ -g filer.tst.cpp
@ ./$@ && echo "Pass!" || echo "Fail"
playground:
@ echo $(filter-out molder.cpp, $(shell echo *.cpp))
install:
ifeq ("$(wildcard ./slimfastq)","")
@echo "Please compile slimfastq first. You can do it by running:";
@echo "% make"
@echo "(optional) %make test"
@echo "% make install"
@echo "(Note that 'make slimfastq install' would not work as expected)"
@false
else
@install -t /usr/local/bin/ ./slimfastq tools/slimfastq.multi 2>/dev/null \
|| cp ./slimfastq tools/slimfastq.multi /usr/local/bin/ \
|| echo "failed to install, please use ./slimfastq and tools/slimfastq.multi in place, or copy them to your lookup path"
@echo "\nAll done!"
endif
uninstall:
rm /usr/local/bin/slimfastq* || /bin/true