-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
245 lines (192 loc) · 5.54 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
#override export CC=g++-9
#override export CXX=g++-9
#override export AR=gcc-ar
#override export NM=gcc-nm
#override export CC=clang++-16
#override export CXX=clang++-16
#override export AR=llvm-ar-16
#override export NM=llvm-nm-16
export CC=g++
export CXX=g++
ifndef GIGAUNIT
GIGAUNIT := 128L
endif
ifndef _PPS
_PPS := 16384
endif
TARGET_INF=interface
export TARGET_LOWER=posix_memory
export TARGET_ALGO=MiDAS
export TARGET_BM=sequential
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
PPWD=$(pwd)
DEBUGFLAGS=\
-rdynamic\
-Wno-pointer-arith\
-g\
#-fsanitize=address \
# -static-libsan\
export COMMONFLAGS=\
-Wno-write-strings\
-Wno-sign-compare\
-Wno-unused-function\
-DLARGEFILE64_SOURCE\
-D_GNU_SOURCE\
-DSLC\
-D$(TARGET_BM)\
-Wno-unused-but-set-variable -Wno-unused-command-line-argument -Wno-deprecated\
-DGIGAUNIT=$(GIGAUNIT)\
-D_PPS=$(_PPS)\
#-O3\
#-O3 -march=native -mtune=native -flto=20 \
#-DLSM_DEBUG\
#-DDFTL_DEBUG\
COMMONFLAGS+=$(DEBUGFLAGS)\
export CFLAGS_ALGO=\
-fPIC\
-Wall\
-D$(TARGET_LOWER)\
export CFLAGS_LOWER=\
-fPIC\
-lpthread\
-Wall\
-D_FILE_OFFSET_BITS=64\
# -DLOWER_MEM_DEV\
export priority="false"
export ORIGINAL_PATH=$(PPWD)
export kv_flag="true"
#CFLAGS_ALGO+=-DCOMPACTIONLOG\
CFLAGS_ALGO+=$(COMMONFLAGS)\
-D$(TARGET_ALGO)\
CFLAGS_LOWER+=$(COMMONFLAGS)\
-D$(TARGET_ALGO)\
ifeq ($(TARGET_ALGO), lsmtree)
CFLAGS_ALGO+=-DLSM_SKIP
endif
ifeq ($(CC), gcc)
CFLAGS_ALGO+=-Wno-discarded-qualifiers -std=c99
CFLAGS_LOWER+=-Wno-discarded-qualifiers -std=c99
else
CFLAGS_ALGO+= -std=c++11
CFLAGS_LOWER+= -std=c++11
endif
CFLAGS +=\
$(CFLAGS_ALGO)\
-D$(TARGET_LOWER)\
-D$(TARGET_ALGO)\
-D$(TARGET_INF)\
-D_DEFAULT_SOURCE\
-D_BSD_SOURCE\
-DBENCH\
-DCDF\
SRCS +=\
./interface/queue.c\
./interface/interface.c\
./interface/vectored_interface.c\
./include/FS.c\
./include/slab.c\
./include/utils/debug_tools.c\
./include/utils/dl_sync.c\
./include/utils/rwlock.c\
./include/utils/cond_lock.c\
./include/utils/data_checker.c\
./include/utils/crc32.c\
./include/data_struct/hash_kv.c\
./include/data_struct/list.c\
./include/data_struct/redblack.c\
./include/data_struct/heap.c\
./include/data_struct/lru_list.c\
./bench/measurement.c\
./bench/bench.c\
./bench/bench_demand.c\
./bench/bench_transaction.c\
./bench/bench_parsing.c\
./include/utils/thpool.c\
./include/utils/kvssd.c\
./include/utils/sha256.c\
./include/utils/tag_q.c\
./blockmanager/base_block_manager.c\
./blockmanager/bb_checker.c\
TARGETOBJ =\
$(patsubst %.c,%.o,$(SRCS))\
MEMORYOBJ =\
$(patsubst %.c,%_mem.o,$(SRCS))\
DEBUGOBJ =\
$(patsubst %.c,%_d.o,$(SRCS))\
ifeq ($(TARGET_LOWER),bdbm_drv)
ARCH +=./object/libmemio.a
endif
ifeq ($(TARGET_LOWER),AMF)
ARCH +=./object/libAmfManager.a
endif
LIBS +=\
-lpthread\
-lm\
# -ljemalloc\
# -laio\
all: midas
DEBUG: debug_driver
duma_sim: duma_driver
debug_driver: ./interface/main.c libdriver_d.a libart.o
$(CC) $(CFLAGS) -DDEBUG -o $@ $^ $(LIBS)
cheeze_block_driver: ./interface/cheeze_hg_block.c ./interface/mainfiles/cheeze_block_main.c libdriver.a libart.o
$(CC) $(CFLAGS) -o $@ $^ $(ARCH) $(LIBS)
cheeze_trace_block_driver: ./interface/cheeze_hg_block.c ./interface/mainfiles/cheeze_trace_block_main.c libdriver.a libart.o
$(CC) $(CFLAGS) -o $@ $^ $(ARCH) $(LIBS)
driver: ./interface/vectored_main.c libdriver.a libart.o
$(CC) $(CFLAGS) -o $@ $^ $(ARCH) $(LIBS)
midas: ./interface/cheeze_hg_block.c ./interface/mainfiles/jeeyun_block_main.c libdriver.a libart.o
$(CC) $(CFLAGS) -o $@ $^ $(ARCH) $(LIBS)
bd_testcase: ./interface/mainfiles/testcase.c libdriver.a
$(CC) $(CFLAGS) -o $@ $^ $(ARCH) $(LIBS)
kv_driver: ./interface/mainfiles/NET_main.c libdriver.a libfdsock.a
$(CC) $(CFLAGS) -o $@ $^ $(ARCH) $(LIBS)
tc_driver: ./interface/mainfiles/trace_collect_main.c libdriver.a libfdsock.a
$(CC) $(CFLAGS) -o $@ $^ $(ARCH) $(LIBS)
tr_driver: ./interface/mainfiles/Ytest_main.c libdriver.a libfdsock.a
$(CC) $(CFLAGS) -o $@ $^ $(ARCH) $(LIBS)
range_driver: ./interface/range_test_main.c libdriver.a
$(CC) $(CFLAGS) -o $@ $^ $(ARCH) $(LIBS)
duma_driver: ./interface/main.c libdriver.a
$(CC) $(CFLAGS) -o $@ $^ -lduma $(ARCH) $(LIBS)
jni: libdriver.a ./jni/DriverInterface.c
$(CC) -fPIC -o libdriver.so -shared -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux ./object/* $(LIBS)
libart.o:
make -C ./include/data_struct/libart/
mv ./include/data_struct/libart/src/libart.o ./
libfdsock.a:
cd ./include/flash_sock/ && $(MAKE) libfdsock.a && mv ./libfdsock.a ../../ && cd ../../
libdriver.a: $(TARGETOBJ)
mkdir -p object && mkdir -p data
cd ./blockmanager/$(TARGET_BM) && $(MAKE) && cd ../../
cd ./algorithm/$(TARGET_ALGO) && $(MAKE) clean && $(MAKE) && cd ../../
cd ./lower/$(TARGET_LOWER) && $(MAKE) && cd ../../
mv ./include/data_struct/*.o ./object/
mv -f ./blockmanager/*.o ./object/
mv ./include/utils/*.o ./object/
mv ./interface/*.o ./object/ && mv ./bench/*.o ./object/ && mv ./include/*.o ./object/
$(AR) r $(@) ./object/*
%_mem.o: %.c
$(CC) $(CFLAGS) -DLEAKCHECK -c $< -o $@ $(LIBS)
%_d.o: %.c
$(CC) $(CFLAGS) -DDEBUG -c $< -o $@ $(LIBS)
.c.o :
$(CC) $(CFLAGS) -c $< -o $@ $(LIBS)
submodule:libdriver.a
mv libdriver.a ../objects/
clean :
cd ./algorithm/$(TARGET_ALGO) && $(MAKE) clean && cd ../../
cd ./lower/$(TARGET_LOWER) && $(MAKE) clean && cd ../../
@$(RM) ./data/*
@$(RM) ./object/*.o
@$(RM) ./object/*.a
@$(RM) ./libeart.o
@$(RM) *.a
@$(RM) driver_memory_check
@$(RM) debug_driver
@$(RM) duma_driver
@$(RM) range_driver
@$(RM) *driver
@$(RM) bd_testcase
@$(RM) libdriver.so
@$(RM) midas