Repository navigation
Expand file tree
/
Copy pathmakefile
More file actions
196 lines (160 loc) · 6.97 KB
/
Copy pathmakefile
File metadata and controls
196 lines (160 loc) · 6.97 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
VERSION = 0.1.3
CXX = g++
CXXFLAGS = -std=c++17 -Iinclude -O3
HEADERS = $(shell find include -name "*.hpp")
BUILD_DIR = build
UNIT_BUILD_DIR = $(BUILD_DIR)/unit
INTEGRATION_BUILD_DIR = $(BUILD_DIR)/integration
BENCH_BUILD_DIR = $(BUILD_DIR)/bench
# High-level targets
# - all: build all unit/integration tests + benchmarks + examples
# - test: build unit/integration tests and run them
# - bench: build benchmarks
# - examples: build examples
# - clean: clean build files
# - debug: build with debug symbols
# make help: print this help message
help:
@echo "Usage: make [target]"
@echo "Targets:"
@echo " all: build all unit/integration tests + benchmarks + examples"
@echo " examples: build examples"
@echo " test: build unit/integration tests and run them"
@echo " bench: build benchmarks"
@echo " clean: clean build files"
@echo " debug: build with debug symbols"
UNIT_TESTS = $(UNIT_BUILD_DIR)/packed_vector_test \
$(UNIT_BUILD_DIR)/alphabet_test \
$(UNIT_BUILD_DIR)/columns_test \
$(UNIT_BUILD_DIR)/api_test \
$(UNIT_BUILD_DIR)/common_test \
$(UNIT_BUILD_DIR)/interval_encoding_test \
$(UNIT_BUILD_DIR)/move_table_test \
$(UNIT_BUILD_DIR)/move_splitting_test \
$(UNIT_BUILD_DIR)/move_structure_test \
$(UNIT_BUILD_DIR)/move_test \
$(UNIT_BUILD_DIR)/permutation_test \
$(UNIT_BUILD_DIR)/permutation_random_test \
$(UNIT_BUILD_DIR)/rlbwt_row_test \
$(UNIT_BUILD_DIR)/rlbwt_structure_test \
$(UNIT_BUILD_DIR)/permutation_lf_fl_test \
$(UNIT_BUILD_DIR)/permutation_phi_phi_inv_test \
$(UNIT_BUILD_DIR)/rlbwt_interval_encoding_test
INTEGRATION_TESTS = $(INTEGRATION_BUILD_DIR)/rlbwt_test \
$(INTEGRATION_BUILD_DIR)/move_structure_test \
$(INTEGRATION_BUILD_DIR)/move_test \
$(INTEGRATION_BUILD_DIR)/permutation_test
BENCH_TESTS = $(BENCH_BUILD_DIR)/move_bench \
$(BENCH_BUILD_DIR)/permutation_bench \
$(BENCH_BUILD_DIR)/rlbwt_bench
all: $(UNIT_TESTS) $(INTEGRATION_TESTS) $(BENCH_TESTS) example
example: examples/example.cpp examples/example.hpp $(HEADERS)
$(CXX) $(CXXFLAGS) -o $@ $<
test: $(UNIT_TESTS) $(INTEGRATION_TESTS)
$(UNIT_BUILD_DIR)/packed_vector_test
$(UNIT_BUILD_DIR)/alphabet_test
$(UNIT_BUILD_DIR)/columns_test
$(UNIT_BUILD_DIR)/interval_encoding_test
$(UNIT_BUILD_DIR)/common_test
$(UNIT_BUILD_DIR)/api_test
$(UNIT_BUILD_DIR)/move_table_test
$(UNIT_BUILD_DIR)/move_splitting_test
$(UNIT_BUILD_DIR)/move_structure_test
$(UNIT_BUILD_DIR)/move_test
$(UNIT_BUILD_DIR)/permutation_test
$(UNIT_BUILD_DIR)/permutation_random_test
$(UNIT_BUILD_DIR)/rlbwt_row_test
$(UNIT_BUILD_DIR)/rlbwt_structure_test
$(UNIT_BUILD_DIR)/permutation_lf_fl_test
$(UNIT_BUILD_DIR)/permutation_phi_phi_inv_test
$(UNIT_BUILD_DIR)/rlbwt_interval_encoding_test
$(INTEGRATION_BUILD_DIR)/rlbwt_test
$(INTEGRATION_BUILD_DIR)/move_structure_test
$(INTEGRATION_BUILD_DIR)/move_test
$(INTEGRATION_BUILD_DIR)/permutation_test
@echo "==============================================="
@echo " All unit and integration tests passed"
@echo "==============================================="
bench: $(BENCH_TESTS)
# Unit tests (header-only data structures)
$(UNIT_BUILD_DIR)/packed_vector_test: ./tests/unit/ds/packed_vector_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/alphabet_test: ./tests/unit/ds/alphabet_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/common_test: ./tests/unit/common_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/api_test: ./tests/unit/api_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/columns_test: ./tests/unit/columns_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/interval_encoding_test: ./tests/unit/move/interval_encoding_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/move_table_test: ./tests/unit/move/move_table_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/move_splitting_test: ./tests/unit/move/move_splitting_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/move_structure_test: ./tests/unit/move/move_structure_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/move_test: ./tests/unit/perm/move_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/permutation_test: ./tests/unit/perm/permutation_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/permutation_random_test: ./tests/unit/perm/permutation_random_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/rlbwt_row_test: ./tests/unit/rlbwt/rlbwt_row_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/rlbwt_structure_test: ./tests/unit/rlbwt/rlbwt_structure_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/permutation_lf_fl_test: ./tests/unit/rlbwt/permutation_lf_fl_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/permutation_phi_phi_inv_test: ./tests/unit/rlbwt/permutation_phi_phi_inv_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(UNIT_BUILD_DIR)/rlbwt_interval_encoding_test: ./tests/unit/rlbwt/rlbwt_interval_encoding_test.cpp $(HEADERS)
mkdir -p $(UNIT_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
# Integration-style tests that exercise larger rlbwt/runperm flows
$(INTEGRATION_BUILD_DIR)/rlbwt_test: ./tests/integration/rlbwt_test.cpp $(HEADERS)
mkdir -p $(INTEGRATION_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(INTEGRATION_BUILD_DIR)/move_structure_test: ./tests/integration/move_structure_test.cpp $(HEADERS)
mkdir -p $(INTEGRATION_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(INTEGRATION_BUILD_DIR)/move_test: ./tests/integration/move_test.cpp $(HEADERS)
mkdir -p $(INTEGRATION_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(INTEGRATION_BUILD_DIR)/permutation_test: ./tests/integration/permutation_test.cpp $(HEADERS)
mkdir -p $(INTEGRATION_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
# Benchmarks (not run by default in `make test`)
$(BENCH_BUILD_DIR)/move_bench: ./tests/benchmark/move_bench.cpp $(HEADERS)
mkdir -p $(BENCH_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(BENCH_BUILD_DIR)/permutation_bench: ./tests/benchmark/permutation_bench.cpp $(HEADERS)
mkdir -p $(BENCH_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
$(BENCH_BUILD_DIR)/rlbwt_bench: ./tests/benchmark/rlbwt_bench.cpp $(HEADERS)
mkdir -p $(BENCH_BUILD_DIR)
$(CXX) $(CXXFLAGS) -o $@ $<
.PHONY: debug
debug: CXXFLAGS += -g -O0
debug: all
# Clean up build files
clean:
rm -rf $(BUILD_DIR)
rm -f example