-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
175 lines (136 loc) · 5.02 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
UNAME_S := $(shell uname -s)
SRC = src/colord
ifeq ($(UNAME_S),Darwin)
CXX = /usr/local/bin/g++-10
CFLAGS = -Wall -O3 -std=c++17 -static-libgcc -static-libstdc++ -pthread
CLINK = -Wall -O3 -std=c++17 -static-libgcc -static-libstdc++ -lpthread
CFLAGS_KMC = -Wall -O3 -m64 -static-libgcc -static-libstdc++ -fopenmp -pthread -std=c++11
CLINK_KMC = -lm -fopenmp -static-libgcc -static-libstdc++ -O3 -pthread -std=c++11
else
CFLAGS = -Wall -O3 -std=c++17 -static -Wl,--whole-archive -lstdc++fs -lpthread -Wl,--no-whole-archive
CLINK = -Wall -O3 -std=c++17 -static -Wl,--whole-archive -lstdc++fs -lpthread -Wl,--no-whole-archive
CFLAGS_KMC = -Wall -O3 -m64 -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -std=c++11
CLINK_KMC = -lm -static -O3 -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -std=c++11
endif
BIN_DIR = bin
INCLUDE_DIR = include
OBJS = \
$(SRC)/timer.o \
$(SRC)/stats_collector.o \
$(SRC)/reads_sim_graph.o \
$(SRC)/pooled_threads.o \
$(SRC)/main.o \
$(SRC)/in_reads.o \
$(SRC)/filter_kmers.o \
$(SRC)/encoder.o \
$(SRC)/decompression.o \
$(SRC)/info.o \
$(SRC)/count_kmers.o \
$(SRC)/compression.o \
$(SRC)/basic_coder.o \
$(SRC)/arg_parse.o \
$(SRC)/libs/edlib/edlib.o \
$(SRC)/libs/kmc_api/kmc_file.o \
$(SRC)/libs/kmc_api/kmer_api.o \
$(SRC)/libs/kmc_api/mmer.o
#objs for colord and colord_api
OBJS_COMMON = \
$(SRC)/utils.o \
$(SRC)/archive.o \
$(SRC)/decompression_common.o \
$(SRC)/dna_coder.o \
$(SRC)/entr_header.o \
$(SRC)/id_coder.o \
$(SRC)/quality_coder.o \
$(SRC)/quality_coder_impl.o \
$(SRC)/reference_genome.o
COBJS = \
$(SRC)/libs/md5/md5.o
MIMALLOC_OBJ=$(SRC)/libs/mimalloc/mimalloc.o
ifeq ($(UNAME_S),Darwin)
LIB_ZLIB = $(SRC)/../common/libs/zlib/libz.mac.a
LIBS = \
$(SRC)/../common/libs/zlib/libz.mac.a \
$(SRC)/libs/count_kmers/libfiltering_kmc.mac.a \
$(SRC)/libs/count_kmers/libbz2.1.0.5.dylib
LIB_FILTERING_KMC = $(SRC)/libs/count_kmers/libfiltering_kmc.mac.a
else
LIB_ZLIB = $(SRC)/../common/libs/zlib/libz.a
LIBS = \
$(SRC)/../common/libs/zlib/libz.a \
$(SRC)/libs/count_kmers/libfiltering_kmc.a \
$(SRC)/libs/count_kmers/libbz2.a
LIB_FILTERING_KMC = $(SRC)/libs/count_kmers/libfiltering_kmc.a
endif
all: $(BIN_DIR)/colord $(BIN_DIR)/libcolord_api.a $(BIN_DIR)/api_example
$(MIMALLOC_OBJ):
$(CXX) -DMI_MALLOC_OVERRIDE -O3 -DNDEBUG -fPIC -Wall -Wextra -Wno-unknown-pragmas -fvisibility=hidden -ftls-model=initial-exec -fno-builtin-malloc -c -I $(SRC)/libs/mimalloc/include $(SRC)/libs/mimalloc/src/static.c -o $(MIMALLOC_OBJ)
$(BIN_DIR)/colord: $(MIMALLOC_OBJ) $(OBJS) $(COBJS) $(OBJS_COMMON) $(LIB_FILTERING_KMC)
-mkdir -p $(BIN_DIR)
$(CXX) $(CLINK) -o $@ $^ $(LIBS)
$(BIN_DIR)/libcolord_api.a: $(COBJS) $(OBJS_COMMON) $(SRC)/../API/colord_api.o
-mkdir -p $(BIN_DIR)
ar rcs $@ $^
-mkdir -p $(INCLUDE_DIR)
cp src/API/colord_api.h $(INCLUDE_DIR)/colord_api.h
$(OBJS) $(OBJS_COMMON): %.o: %.cpp
$(CXX) $(CFLAGS) -I $(SRC)/../common/libs/zlib -I $(SRC)/libs/kmc_api -I $(SRC)/libs/edlib -I $(SRC)/libs/CLI11 -c $< -o $@
$(COBJS): %.o: %.c
$(CXX) $(CFLAGS) -I $(SRC)/../common/libs/zlib -I $(SRC)/libs/kmc_api -I $(SRC)/libs/edlib -I $(SRC)/libs/CLI11 -c $< -o $@
$(SRC)/../API_example/api_example.o: $(SRC)/../API_example/api_example.cpp
$(CXX) $(CFLAGS) -I $(SRC)/../API -c $< -o $@
$(SRC)/../API/colord_api.o: $(SRC)/../API/colord_api.cpp
$(CXX) $(CFLAGS) -I $(SRC)/../colord -c $< -o $@
$(BIN_DIR)/api_example: $(SRC)/../API_example/api_example.o $(BIN_DIR)/libcolord_api.a
-mkdir -p $(BIN_DIR)
$(CXX) $(CLINK) -o $@ $^ $(LIB_ZLIB)
KMC_MAIN_DIR = src/filtering-KMC
KMC_OBJS = \
$(KMC_MAIN_DIR)/kmer_counter.o \
$(KMC_MAIN_DIR)/mmer.o \
$(KMC_MAIN_DIR)/mem_disk_file.o \
$(KMC_MAIN_DIR)/rev_byte.o \
$(KMC_MAIN_DIR)/bkb_writer.o \
$(KMC_MAIN_DIR)/cpu_info.o \
$(KMC_MAIN_DIR)/bkb_reader.o \
$(KMC_MAIN_DIR)/fastq_reader.o \
$(KMC_MAIN_DIR)/timer.o \
$(KMC_MAIN_DIR)/develop.o \
$(KMC_MAIN_DIR)/kb_completer.o \
$(KMC_MAIN_DIR)/kb_storer.o \
$(KMC_MAIN_DIR)/kmer.o \
$(KMC_MAIN_DIR)/splitter.o \
$(KMC_MAIN_DIR)/kb_collector.o
ifeq ($(UNAME_S),Darwin)
RADULS_OBJS =
else
RADULS_OBJS = \
$(KMC_MAIN_DIR)/raduls_sse2.o \
$(KMC_MAIN_DIR)/raduls_sse41.o \
$(KMC_MAIN_DIR)/raduls_avx2.o \
$(KMC_MAIN_DIR)/raduls_avx.o
endif
$(KMC_OBJS): %.o: %.cpp
$(CXX) $(CFLAGS_KMC) -I $(SRC)/../common/libs/zlib -c $< -o $@
$(KMC_MAIN_DIR)/raduls_sse2.o: $(KMC_MAIN_DIR)/raduls_sse2.cpp
$(CXX) $(CFLAGS_KMC) -msse2 -c $< -o $@
$(KMC_MAIN_DIR)/raduls_sse41.o: $(KMC_MAIN_DIR)/raduls_sse41.cpp
$(CXX) $(CFLAGS_KMC) -msse4.1 -c $< -o $@
$(KMC_MAIN_DIR)/raduls_avx.o: $(KMC_MAIN_DIR)/raduls_avx.cpp
$(CXX) $(CFLAGS_KMC) -mavx -c $< -o $@
$(KMC_MAIN_DIR)/raduls_avx2.o: $(KMC_MAIN_DIR)/raduls_avx2.cpp
$(CXX) $(CFLAGS_KMC) -mavx2 -c $< -o $@
$(LIB_FILTERING_KMC): $(KMC_OBJS) $(RADULS_OBJS)
-mkdir -p $(BIN_DIR)
ar rcs $@ $^
clean:
-rm -f $(SRC)/*.o
-rm -f $(SRC)/libs/edlib/edlib.o
-rm -f $(SRC)/libs/kmc_api/kmc_file.o
-rm -f $(SRC)/libs/kmc_api/kmer_api.o
-rm -f $(SRC)/libs/kmc_api/mmer.o
-rm -f $(SRC)/../api_example/*.o
-rm -f $(KMC_MAIN_DIR)/*.o
-rm -f $(LIB_FILTERING_KMC)
-rm -rf bin
-rm -rf include