-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (50 loc) · 1.88 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
CC = gcc
CFLAGS = -std=c99 -Wall -Wno-char-subscripts -Wno-unused-result -O3 -DNDEBUG -D_GNU_SOURCE
CFLAGS_DEBUG = $(CFLAGS) -UNDEBUG -O0 -g3
LDFLAGS = -lz -lm
P := bwt_lcp decode_bwt decode_lcp
SUBDIRS := $(addprefix tests/, arrays supportBWT supportLists supportLCP)
TEST_INPUTS := $(addprefix tests/, paper_example.fasta test.fasta.gz test.odd.fasta.gz test.253.fasta.gz test.290.fasta.gz test.7seqs.var.fasta)
TEST_SUMS := $(addsuffix .sums, $(TEST_INPUTS))
# Make must run serially (even if -j N > 1 is given) (GNU make extension)
.NOTPARALLEL:
.PHONY: bin
bin: $(P)
.PHONY: subdirs
subdirs: $(SUBDIRS)
# General rule for building the executables
%: %.c
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
# Additional requirements for bwt_lcp
bwt_lcp: kseq.h dictionary.h dictionary.c streams.h streams.c algorithms.h algorithms.c common_types.h
decode_lcp: common_types.h
$(SUBDIRS):
mkdir -p $@
.PHONY: clean
clean:
@echo "Cleaning..."
rm -rf *.o *.out *.exe *.debug $(P) $(SUBDIRS) tests/BWTbin tests/LCP
.PHONY: test
test: clean subdirs bin $(TEST_INPUTS)
.PHONY: $(TEST_INPUTS)
$(TEST_INPUTS): clean subdirs bin
@echo "Starting test on file $@ (no output)" && \
time -p -o .time ./bwt_lcp $@ > .log 2> .err ; \
diff .log [email protected]; \
diff -y -W 40 .time [email protected]; \
rm -f .time .log .err; \
( test -s $(@) || md5sum -c [email protected]; );
.PHONY: rebuild-test
rebuild-test: clean subdirs bin $(TEST_SUMS)
.PHONY: $(TEST_SUMS)
$(TEST_SUMS): clean subdirs bin
@echo "Rebuilding test $@ (no output)" && \
time -p -o $(basename $(@)).time ./bwt_lcp $(basename $(@)) > $(basename $(@)).log && \
md5sum tests/BWTbin tests/LCP > $(@) || \
true > $(@)
%.debug: %.c
$(CC) $(CFLAGS_DEBUG) $^ -o $@ $(LDFLAGS)
bwt_lcp.debug: kseq.h dictionary.h dictionary.c streams.h streams.c algorithms.h algorithms.c common_types.h
decode_lcp.debug: common_types.h
.PHONY: debug
debug: subdirs bwt_lcp.debug decode_bwt.debug decode_lcp.debug