-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
272 lines (188 loc) · 13.5 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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#a) pass LIB_PATH=/usr/local/lib/ to compile on WTCHG cluster3
#b) also set LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
#ifndef CC
CC = gcc
#endif
BIN = bin
TEMP_TEST_DIR = data/tempfiles_can_be_deleted
ifeq ($(MAXK),31)
BITFIELDS = 1
endif
ifeq ($(MAXK),63)
BITFIELDS = 2
endif
ifeq ($(MAXK),95)
BITFIELDS = 3
endif
ifeq ($(MAXK),127)
BITFIELDS = 4
endif
ifeq ($(MAXK),159)
BITFIELDS = 5
endif
ifeq ($(MAXK),191)
BITFIELDS = 6
endif
ifeq ($(MAXK),223)
BITFIELDS = 7
endif
ifeq ($(MAXK),255)
BITFIELDS = 8
endif
ifndef BITFIELDS
BITFIELDS = 1
MAXK = 31
endif
ifndef NUM_COLS
NUM_COLS = 1
endif
##ifeq ($(BITFIELDS),0)
#$(error Invalid value for MAXK - either omit or use 32*x-1)
#endif
# Test if running on a mac
UNAME=$(shell uname)
ifeq ($(UNAME),Darwin)
MAC = 1
endif
# Library paths
IDIR_STRS = libs/string_buffer
IDIR_SEQ = libs/seq_file
IDIR_BAM = libs/htslib/htslib
# Main program includes
IDIR_BASIC = include/basic
IDIR_BASE_ENCODING = ${IDIR_BASIC}/event_encoding/base_encoding
IDIR_COLOUR_ENCODING = ${IDIR_BASIC}/event_encoding/solid_colour_encoding
IDIR_HASH = include/hash_table
IDIR_CORTEX_CON = include/cortex_con
IDIR_CORTEX_VAR = include/cortex_var/many_colours
IDIR_CORTEX_VAR_CORE = include/cortex_var/core
IDIR_CORTEX_VAR_CMD_LINE = include/cortex_var/many_colours
# Test code includes
IDIR_BASIC_TESTS = include/test/basic
IDIR_HASH_TABLE_TESTS = include/test/hash_table
IDIR_CORTEX_CON_TESTS = include/test/graph
IDIR_CORTEX_VAR_TESTS = include/test/cortex_var/many_colours
# Correct for zam's paths for CUNIT
#NOT_ZAM=1
ifdef NOT_ZAM
IDIR_CUNIT = /opt/local/include/CUnit
LDIR_CUNIT = /opt/local/lib
else
IDIR_CUNIT = /home/zam/dev/hg/CUnit/CUnit-2.1-0/CUnit/Headers
ifdef MAC
IDIR_CUNIT = /Users/zam/dev/hg/laptop_local/repos/CUnit/CUnit-2.1-0/CUnit/Headers
else
LDIR_CUNIT = /home/zam/bin/lib
endif
endif
ifdef MAC
MACFLAG = -fnested-functions
endif
ARCH = -m64
ifdef 32_BITS
ARCH =
endif
UNAME_P := $(shell uname -p)
ifneq ($(filter arm%,$(UNAME_P)),)
ARCH =
endif
ifneq ($(filter aarch%,$(UNAME_P)),)
ARCH =
endif
# DEV: Add -DNDEBUG=1 to turn off assert() calls
OPT := $(ARCH) -Wall $(MACFLAG) -DVERSION_STR='"$(VERSION_STR)"' \
-DNUMBER_OF_BITFIELDS_IN_BINARY_KMER=$(BITFIELDS) \
-DNUMBER_OF_COLOURS=$(NUM_COLS)
ifdef DEBUG
OPT := -O0 -g $(OPT)
else
OPT := -O3 $(OPT)
endif
LIBLIST = -lseqfile -lstrbuf -lhts -lpthread -lz -lm
TEST_LIBLIST = -lcunit -lncurses $(LIBLIST)
#TEST_LIBLIST = -lcunit $(LIBLIST)
# Add -L/usr/local/lib/ to satisfy some systems that struggle to link libz
LIBINCS = -L/usr/local/lib -I$(IDIR_BAM) \
-I$(IDIR_SEQ) -I$(IDIR_STRS) \
-L$(IDIR_BAM) -L$(IDIR_SEQ) -L$(IDIR_STRS)
TEST_LIBINCS = -I$(IDIR_CUNIT) -L$(LDIR_CUNIT) $(LIBINCS)
CFLAGS_BASIC = -I$(IDIR_BASIC) -I$(IDIR_BASE_ENCODING) $(LIBINCS)
CFLAGS_GRAPH = -I$(IDIR_BASIC) -I$(IDIR_HASH) -I$(IDIR_CORTEX_CON) -I$(IDIR_BASE_ENCODING) $(LIBINCS)
CFLAGS_CORTEX_VAR = -I$(IDIR_CORTEX_VAR_CORE) -I$(IDIR_BASIC) -I$(IDIR_HASH) -I$(IDIR_CORTEX_VAR) -I$(IDIR_BASE_ENCODING) $(LIBINCS)
CFLAGS_BASIC_TESTS = -I$(IDIR_BASIC_TESTS) -I$(IDIR_BASIC) -I$(IDIR_BASE_ENCODING) $(TEST_LIBINCS)
CFLAGS_HASH_TABLE_TESTS = -I$(IDIR_HASH) -I$(IDIR_HASH_TABLE_TESTS) -I$(IDIR_CUNIT) -I$(IDIR_CORTEX_VAR) $(TEST_LIBINCS)
CFLAGS_GRAPH_TESTS = -I$(IDIR_GRAPH_TESTS) -I$(IDIR_BASIC) -I$(IDIR_BASE_ENCODING) -I$(IDIR_HASH) -I$(IDIR_CORTEX_CON) $(TEST_LIBINCS)
CFLAGS_CORTEX_VAR_TESTS = -I$(IDIR_CORTEX_VAR_TESTS) -I$(IDIR_BASIC) -I$(IDIR_BASE_ENCODING) -I$(IDIR_HASH) -I$(IDIR_CORTEX_VAR) -I$(IDIR_CORTEX_VAR_CORE) $(TEST_LIBINCS)
CFLAGS_CORTEX_VAR_CMD_LINE_TESTS = -I$(IDIR_CORTEX_VAR_TESTS) -I$(IDIR_CORTEX_VAR_CMD_LINE) -I$(IDIR_BASIC) -I$(IDIR_BASE_ENCODING) $(TEST_LIBINCS)
CORTEX_VAR_OBJ = src/obj/cortex_var/many_colours/genotyping_element.o src/obj/cortex_var/many_colours/little_hash_for_genotyping.o src/obj/cortex_var/many_colours/model_info.o src/obj/cortex_var/many_colours/genome_complexity.o src/obj/cortex_var/many_colours/global.o src/obj/cortex_var/many_colours/db_complex_genotyping.o src/obj/cortex_var/many_colours/cortex_var.o src/obj/cortex_var/many_colours/binary_kmer.o src/obj/cortex_var/many_colours/element.o src/obj/cortex_var/many_colours/seq.o src/obj/cortex_var/many_colours/hash_value.o src/obj/cortex_var/many_colours/hash_table.o src/obj/cortex_var/many_colours/dB_graph.o src/obj/cortex_var/many_colours/dB_graph_population.o src/obj/cortex_var/many_colours/dB_graph_supernode.o src/obj/cortex_var/many_colours/db_variants.o src/obj/cortex_var/many_colours/cmd_line.o src/obj/cortex_var/many_colours/event_encoding.o src/obj/cortex_var/many_colours/graph_info.o src/obj/cortex_var/many_colours/db_differentiation.o src/obj/cortex_var/many_colours/model_selection.o src/obj/cortex_var/many_colours/maths.o src/obj/cortex_var/many_colours/seq_error_rate_estimation.o src/obj/cortex_var/many_colours/file_reader.o src/obj/cortex_var/many_colours/error_correction.o
BASIC_TESTS_OBJ = src/obj/basic/binary_kmer.o src/obj/basic/global.o src/obj/basic/seq.o src/obj/test/basic/test_binary_kmer.o src/obj/test/basic/test_seq.o src/obj/test/basic/run_basic_tests.o src/obj/basic/event_encoding.o
HASH_TABLE_TESTS_OBJ = src/obj/basic/global.o src/obj/test/hash_table/run_hash_table_tests.o src/obj/cortex_var/many_colours/element.o src/obj/cortex_var/many_colours/hash_value.o src/obj/cortex_var/many_colours/hash_table.o src/obj/test/hash_table/test_hash.o src/obj/basic/binary_kmer.o src/obj/basic/seq.o src/obj/basic/event_encoding.o
CORTEX_VAR_TESTS_OBJ = src/obj/basic/global.o src/obj/cortex_var/many_colours/genotyping_element.o src/obj/cortex_var/many_colours/little_hash_for_genotyping.o src/obj/cortex_var/many_colours/model_info.o src/obj/test/cortex_var/many_colours/test_genome_complexity.o src/obj/test/cortex_var/many_colours/test_db_variants.o src/obj/test/cortex_var/many_colours/test_model_selection.o src/obj/test/cortex_var/many_colours/test_file_reader.o src/obj/test/cortex_var/many_colours/test_pop_load_and_print.o src/obj/test/cortex_var/many_colours/run_sv_trio_tests.o src/obj/test/cortex_var/many_colours/supernode_cmp.o src/obj/test/cortex_var/many_colours/test_pop_supernode_consensus.o src/obj/test/cortex_var/many_colours/test_pop_element.o src/obj/test/cortex_var/many_colours/test_dB_graph_population.o src/obj/cortex_var/many_colours/binary_kmer.o src/obj/cortex_var/many_colours/element.o src/obj/cortex_var/many_colours/seq.o src/obj/cortex_var/many_colours/hash_value.o src/obj/cortex_var/many_colours/hash_table.o src/obj/cortex_var/many_colours/dB_graph.o src/obj/cortex_var/many_colours/file_reader.o src/obj/cortex_var/many_colours/error_correction.o src/obj/cortex_var/many_colours/dB_graph_population.o src/obj/cortex_var/many_colours/dB_graph_supernode.o src/obj/cortex_var/many_colours/db_variants.o src/obj/cortex_var/many_colours/event_encoding.o src/obj/cortex_var/many_colours/graph_info.o src/obj/cortex_var/many_colours/model_selection.o src/obj/cortex_var/many_colours/maths.o src/obj/cortex_var/many_colours/db_complex_genotyping.o src/obj/cortex_var/many_colours/genome_complexity.o src/obj/cortex_var/many_colours/seq_error_rate_estimation.o src/obj/test/cortex_var/many_colours/test_seq_error_estimation.o src/obj/test/cortex_var/many_colours/test_error_correction.o
CORTEX_VAR_CMD_LINE_TESTS_OBJ = src/obj/basic/global.o src/obj/cortex_var/many_colours/cmd_line.o src/obj/test/cortex_var/many_colours/test_cmd_line.o src/obj/test/cortex_var/many_colours/run_cmd_line_tests.o src/obj/cortex_var/many_colours/binary_kmer.o src/obj/cortex_var/many_colours/element.o src/obj/cortex_var/many_colours/seq.o src/obj/cortex_var/many_colours/hash_value.o src/obj/cortex_var/many_colours/hash_table.o src/obj/cortex_var/many_colours/dB_graph.o src/obj/cortex_var/many_colours/file_reader.o src/obj/cortex_var/many_colours/dB_graph_population.o src/obj/cortex_var/many_colours/db_variants.o src/obj/cortex_var/many_colours/event_encoding.o src/obj/cortex_var/many_colours/graph_info.o src/obj/cortex_var/many_colours/model_selection.o src/obj/cortex_var/many_colours/maths.o
MAXK_AND_TEXT = $(join "", $(MAXK))
NUMCOLS_AND_TEST = $(join "_c", $(NUM_COLS))
CURRENT_DIR = $(shell pwd)
cortex_var : remove_objects $(CORTEX_VAR_OBJ)
mkdir -p $(BIN); $(CC) $(CFLAGS_CORTEX_VAR) $(OPT) $(OPT_COLS) -o $(BIN)/cortex_var_$(join $(MAXK_AND_TEXT),$(NUMCOLS_AND_TEST)) $(CORTEX_VAR_OBJ) $(LIBLIST)
run_basic_tests : remove_objects $(BASIC_TESTS_OBJ)
mkdir -p $(BIN); mkdir -p $(TEMP_TEST_DIR); $(CC) $(CFLAGS_BASIC_TESTS) $(OPT) -o $(BIN)/run_basic_tests_$(MAXK) $(BASIC_TESTS_OBJ) $(TEST_LIBLIST)
run_hash_table_tests : remove_objects $(HASH_TABLE_TESTS_OBJ)
mkdir -p $(BIN); mkdir -p $(TEMP_TEST_DIR); $(CC) $(CFLAGS_HASH_TABLE_TESTS) $(OPT) -o $(BIN)/run_hash_table_tests_$(MAXK) $(HASH_TABLE_TESTS_OBJ) $(TEST_LIBLIST)
run_cortex_var_cmdline_tests : remove_objects $(CORTEX_VAR_CMD_LINE_TESTS_OBJ)
mkdir -p $(BIN); mkdir -p $(TEMP_TEST_DIR); $(CC) $(CFLAGS_CORTEX_VAR_CMD_LINE_TESTS) $(OPT) -o $(BIN)/run_cortex_var_cmdline_tests $(CORTEX_VAR_CMD_LINE_TESTS_OBJ) $(TEST_LIBLIST)
run_cortex_var_tests : remove_objects $(CORTEX_VAR_TESTS_OBJ)
mkdir -p $(BIN); mkdir -p $(TEMP_TEST_DIR); $(CC) $(CFLAGS_CORTEX_VAR_TESTS) $(OPT) -o $(BIN)/run_cortex_var_tests_$(MAXK) $(CORTEX_VAR_TESTS_OBJ) $(TEST_LIBLIST)
.PHONY : clean
clean :
rm -rf $(BIN)/*
rm -rf src/obj
rm -rf $(TEMP_TEST_DIR)/*
remove_objects:
rm -rf src/obj/*
#pattern rules
src/obj/cortex_con/%.o : src/cortex_con/%.c include/cortex_con/%.h
mkdir -p src/obj/cortex_con; $(CC) $(CFLAGS_GRAPH) $(OPT) -c $< -o $@
src/obj/cortex_con/%.o : src/basic/%.c include/basic/%.h
mkdir -p src/obj/cortex_con; $(CC) $(CFLAGS_GRAPH) $(OPT) -c $< -o $@
src/obj/cortex_con/%.o : src/basic/event_encoding/base_encoding/%.c include/basic/event_encoding/base_encoding/%.h
mkdir -p src/obj/cortex_con; $(CC) $(CFLAGS_GRAPH) $(OPT) -c $< -o $@
src/obj/cortex_con/%.o : src/hash_table/hash_key/bob_jenkins/%.c include/hash_table/hash_value.h
mkdir -p src/obj/cortex_con; $(CC) $(CFLAGS_GRAPH) $(OPT) -c $< -o $@
src/obj/cortex_con/%.o : src/hash_table/open_hash/%.c include/hash_table/open_hash/%.h
mkdir -p src/obj/cortex_con; $(CC) $(CFLAGS_GRAPH) $(OPT) -c $< -o $@
src/obj/cortex_con/%.o : src/cortex_con/%.c
mkdir -p src/obj/cortex_con; $(CC) $(CFLAGS_GRAPH) $(OPT) -c $? -o $@
src/obj/cortex_var/many_colours/%.o : src/cortex_var/many_colours/%.c include/cortex_var/many_colours/%.h
mkdir -p src/obj/cortex_var/many_colours; $(CC) $(CFLAGS_CORTEX_VAR) $(OPT) -c $< -o $@
src/obj/basic/%.o : src/basic/%.c include/basic/%.h
mkdir -p src/obj/basic/; $(CC) $(CFLAGS_BASIC) $(OPT) -c $< -o $@
src/obj/basic/%.o : src/basic/event_encoding/base_encoding/%.c include/basic/event_encoding/base_encoding/%.h
mkdir -p src/obj/basic/; $(CC) $(CFLAGS_BASIC) $(OPT) -c $< -o $@
src/obj/test/basic/%.o : src/test/basic/%.c include/test/basic/%.h
mkdir -p src/obj/test/basic; $(CC) $(CFLAGS_BASIC_TESTS) $(OPT) -c $< -o $@
src/obj/test/hash_table/open_hash/%.o : src/hash_table/open_hash/%.c include/hash_table/open_hash/%.h
mkdir -p src/obj/test/hash_table/open_hash; $(CC) $(CFLAGS_HASH_TABLE_TESTS) $(OPT) -c $< -o $@
src/obj/test/hash_table/hash_key/bob_jenkins/%.o : src/hash_table/hash_key/bob_jenkins/%.c include/hash_table/hash_key/bob_jenkins/%.h
mkdir -p src/obj/test/hash_table/hash_key/bob_jenkins; $(CC) $(CFLAGS_HASH_TABLE_TESTS) $(OPT) -c $< -o $@
src/obj/graph/hash_table/open_hash/%.o : src/hash_table/open_hash/%.c include/hash_table/open_hash/%.h
mkdir -p src/obj/graph/hash_table/open_hash; $(CC) $(CFLAGS_GRAPH) $(OPT) -c $< -o $@
src/obj/graph/hash_table/hash_key/bob_jenkins/%.o : src/hash_table/hash_key/bob_jenkins/%.c
mkdir -p src/obj/graph/hash_table/hash_key/bob_jenkins; $(CC) $(CFLAGS_GRAPH) $(OPT) -c $< -o $@
src/obj/test/hash_table/%.o : src/test/hash_table/%.c include/test/hash_table/%.h
mkdir -p src/obj/test/hash_table; $(CC) $(CFLAGS_CORTEX_VAR) $(CFLAGS_HASH_TABLE_TESTS) $(OPT) -c $< -o $@
src/obj/cortex_var/many_colours/%.o : src/basic/event_encoding/base_encoding/%.c include/basic/event_encoding/base_encoding/%.h
mkdir -p src/obj/cortex_var/many_colours; $(CC) $(CFLAGS_CORTEX_VAR) $(OPT) -c $< -o $@
src/obj/cortex_var/many_colours/hash_table/open_hash/%.o : src/hash_table/open_hash/%.c include/hash_table/open_hash/%.h
mkdir -p src/obj/cortex_var/many_colours/hash_table/open_hash; $(CC) $(CFLAGS_CORTEX_VAR) $(OPT) -c $< -o $@
src/obj/cortex_var/many_colours/hash_table/hash_key/bob_jenkins/%.o : src/hash_table/hash_key/bob_jenkins/%.c include/hash_table/hash_key/bob_jenkins/%.h
mkdir -p src/obj/cortex_var/many_colours/hash_table/hash_key/bob_jenkins; $(CC) $(CFLAGS_CORTEX_VAR) $(OPT) -c $< -o $@
src/obj/cortex_var/many_colours/%.o : src/basic/%.c include/basic/%.h
mkdir -p src/obj/cortex_var/many_colours; $(CC) $(CFLAGS_CORTEX_VAR) $(OPT) -c $< -o $@
src/obj/cortex_var/many_colours/%.o : src/hash_table/hash_key/bob_jenkins/%.c include/hash_table/%.h
mkdir -p src/obj/cortex_var/many_colours; $(CC) $(CFLAGS_CORTEX_VAR) $(OPT) -c $< -o $@
src/obj/cortex_var/many_colours/%.o : src/hash_table/open_hash/%.c include/hash_table/open_hash/%.h
mkdir -p src/obj/cortex_var/many_colours; $(CC) $(CFLAGS_CORTEX_VAR) $(OPT) -c $< -o $@
src/obj/cortex_var/many_colours/%.o : src/cortex_var/core/%.c include/cortex_var/core/%.h
mkdir -p src/obj/cortex_var/many_colours; $(CC) $(CFLAGS_CORTEX_VAR) $(OPT) -c $< -o $@
src/obj/test/cortex_var/many_colours/%.o : src/test/cortex_var/many_colours/%.c include/test/cortex_var/many_colours/%.h
mkdir -p src/obj/test/cortex_var/many_colours; $(CC) $(CFLAGS_CORTEX_VAR_TESTS) $(OPT) -c $< -o $@