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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
#
# until autoconf is set up, here are the options i understand:
#
# darwin=yes -- build on darwin
# fuse=no -- don't build anything requiring FUSE
# mpi=no -- don't build newsyn (require MPI)
# use_ccpp=yes -- use Common C++ for buffer.h reference counting
# want_bdb=yes -- build berkelydb objectstore
#
# mpicxx must be on your path to build newsyn.
# on googoo, this means that /usr/local/mpich2-1.0.2/bin must be on your path.
# on issdm, it's /usr/local/mpich2/bin.
# Hook for extra -I options, etc.
EXTRA_CFLAGS = #-I${HOME}/include -L${HOME}/lib
EXTRA_CFLAGS += -g
EXTRA_CFLAGS += -pg
#EXTRA_CFLAGS += -O3
# base
CFLAGS = -Wall -I. -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_THREAD_SAFE ${EXTRA_CFLAGS}
LDINC = ld -i -o
CXX = g++
CC = gcc
LIBS = -pthread
# darwin?
ifeq ($(target),darwin)
CFLAGS += -DDARWIN -D__FreeBSD__=10
LDINC = ar -rc
endif
# use Common C++ (for buffer.h)?
ifeq ($(use_ccpp),yes)
CFLAGS += -D_GNU_SOURCE -DBUFFER_USE_CCPP
LIBS += -lccgnu2 -ldl
endif
#for normal mpich2 machines
MPICC = mpicxx
MPICFLAGS = -DMPICH_IGNORE_CXX_SEEK ${CFLAGS}
MPILIBS = ${LIBS}
#for LLNL boxes without mpicxx
#MPICC = g++
#MPICFLAGS = ${CFLAGS} -I/usr/lib/mpi/mpi_gnu/include -L/usr/lib/mpi/mpi_gnu/lib
#MPILIBS = ${LIBS} -lelan -lmpi
EBOFS_OBJS= \
ebofs/BlockDevice.o\
ebofs/BufferCache.o\
ebofs/Ebofs.o\
ebofs/Allocator.o\
ebofs/FileJournal.o
MDS_OBJS= \
mds/MDS.o\
mds/journal.o\
mds/Server.o\
mds/MDCache.o\
mds/Locker.o\
mds/Migrator.o\
mds/MDBalancer.o\
mds/CDentry.o\
mds/CDir.o\
mds/CInode.o\
mds/AnchorTable.o\
mds/AnchorClient.o\
mds/LogEvent.o\
mds/IdAllocator.o\
mds/SessionMap.o\
mds/MDLog.o
OSD_OBJS= \
osd/PG.o\
osd/ReplicatedPG.o\
osd/RAID4PG.o\
osd/Ager.o\
osd/FakeStore.o\
osd/OSD.o
OSDC_OBJS= \
osdc/Objecter.o\
osdc/ObjectCacher.o\
osdc/Filer.o\
osdc/Journaler.o
MON_OBJS= \
mon/Monitor.o\
mon/Paxos.o\
mon/PaxosService.o\
mon/OSDMonitor.o\
mon/MDSMonitor.o\
mon/ClientMonitor.o\
mon/PGMonitor.o\
mon/Elector.o\
mon/MonitorStore.o
COMMON_OBJS= \
msg/Message.o\
common/Logger.o\
common/Clock.o\
common/Timer.o\
mon/MonMap.o\
config.o
CLIENT_OBJS= \
client/FileCache.o\
client/Client.o\
client/SyntheticClient.o\
client/Trace.o
# bdbstore?
ifeq ($(want_bdb),yes)
CFLAGS += -DUSE_OSBDB
LIBS = -ldb_cxx
OSD_OBJS += osbdb/OSBDB.o
OSBDB_OBJS = \
osbdb/OSBDB.o
endif
# targets
TARGETS = cmon cosd cmds csyn mkmonmap cmonctl fakesyn dupstore
SRCS=*.cc */*.cc *.h */*.h */*/*.h
ifneq ($(fuse),no)
TARGETS += cfuse fakefuse
endif
ifneq ($(mpi),no)
TARGETS += newsyn
endif
all: depend ${TARGETS}
# real bits
mkmonmap: mkmonmap.cc common.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
extractosdmaps: extractosdmaps.cc common.o osd.o mon.o ebofs.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
cmon: cmon.o mon.o msg/SimpleMessenger.o common.o crush.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
cmonctl: cmonctl.cc msg/SimpleMessenger.o common.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
cosd: cosd.o osd.o ebofs.o msg/SimpleMessenger.o common.o crush.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
cmds: cmds.o mds.o osdc.o msg/SimpleMessenger.o common.o crush.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
csyn: csyn.o client.o osdc.o msg/SimpleMessenger.o common.o crush.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
cfuse: cfuse.o client.o osdc.o client/fuse.o client/fuse_ll.o msg/SimpleMessenger.o common.o crush.o
${CXX} ${CFLAGS} ${LIBS} -lfuse $^ -o $@
# code shipping experiments
activemaster: active/activemaster.cc client.o osdc.o msg/SimpleMessenger.o common.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
activeslave: active/activeslave.cc client.o osdc.o msg/SimpleMessenger.o common.o
${CXX} -ldl ${CFLAGS} ${LIBS} $^ -o $@
echotestclient: active/echotestclient.cc
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
msgtestclient: active/msgtestclient.o client.o osdc.o msg/SimpleMessenger.o common.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
#libtrivialtask.so: active/trivial_task.cc client.o osdc.o msg/SimpleMessenger.o common.o
# ${CXX} -fPIC -shared -Wl,-soname,$@.1 ${CFLAGS} ${LIBS} $^ -o $@
libtrivialtask.so: active/trivial_task_ipc.cc ceph_ipc/ipc_client.o
${CXX} -fPIC -shared -Wl,-soname,$@.1 ${CFLAGS} ${LIBS} $^ -o $@
libgreptask.so: active/grep_task.cc ceph_ipc/ipc_client.o
${CXX} -fPIC -shared -Wl,-soname,$@.1 ${CFLAGS} ${LIBS} $^ -o $@
#libhadoopcephfs.so: client/hadoop/CephFSInterface.cc client.o osdc.o msg/SimpleMessenger.o common.o
# ${CXX} -fPIC -shared -Wl,-soname,$@.1 ${CFLAGS} ${LIBS} $^ -o $@
# IPC interface
ipc_server: ceph_ipc/ipc_server.cc client.o osdc.o msg/SimpleMessenger.o common.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
ipc_testclient: ceph_ipc/ipc_testclient.cc ceph_ipc/ipc_client.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
# fake*
fakefuse: fakefuse.o mon.o mds.o client.o osd.o osdc.o ebofs.o client/fuse.o client/fuse_ll.o msg/FakeMessenger.o common.o crush.o
${CXX} ${CFLAGS} ${LIBS} -lfuse $^ -o $@
fakesyn: fakesyn.o mon.o mds.o client.o osd.o ebofs.o osdc.o msg/FakeMessenger.o common.o crush.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
# mpi startup
newsyn: newsyn.cc mon.o mds.o client.o osd.o ebofs.o osdc.o msg/SimpleMessenger.o common.o crush.o
${MPICC} ${MPICFLAGS} ${MPILIBS} $^ -o $@
# ebofs
mkfs.ebofs: ebofs/mkfs.ebofs.cc config.cc common/Clock.o ebofs.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
test.ebofs: ebofs/test.ebofs.cc config.cc common/Clock.o ebofs.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
streamtest.ebofs: ebofs/streamtest.cc config.cc common/Clock.o ebofs.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
dupstore: dupstore.cc config.cc ebofs.o common/Clock.o common/Timer.o osd/FakeStore.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
allebofs: mkfs.ebofs test.ebofs streamtest.ebofs dupstore
# hadoop
libhadoopcephfs.so: client/hadoop/CephFSInterface.cc client.o osdc.o msg/SimpleMessenger.o common.o
${CXX} -fPIC -shared -Wl,-soname,$@.1 ${CFLAGS} -I/usr/local/java/include -I/usr/local/java/include/linux ${LIBS} $^ -o $@
# libceph
libceph.o: client/ldceph.o client/Client.o msg/SimpleMessenger.o ${COMMON_OBJS} ${SYN_OBJS} ${OSDC_OBJS}
${LDINC} $^ -o $@
ldceph.so: libceph.o msg/SimpleMessenger.o
${CXX} -shared -fPIC ${CFLAGS} $< -o $@
# some benchmarking tools
bench/mdtest/mdtest.o: bench/mdtest/mdtest.c
mpicc -c $^ -o $@
mdtest: bench/mdtest/mdtest.o
${MPICC} ${MPICFLAGS} ${MPILIBS} $^ -o $@
mdtest.ceph: bench/mdtest/mdtest.o libceph.o
${MPICC} ${MPICFLAGS} ${MPILIBS} $^ -o $@
testos: test/testos.o ebofs.o osbdb.o common.o
${CXX} ${CFLAGS} ${LIBS} ${OSBDB_LIBS} -o $@ $^
# misc
gprof-helper.so: test/gprof-helper.c
gcc -shared -fPIC test/gprof-helper.c -o gprof-helper.so -lpthread -ldl
test_disk_bw: test/test_disk_bw.cc common.o
${CXX} ${CFLAGS} ${LIBS} $^ -o $@
# crush
# lameness: use .co extension for .c files
%.co: %.c
${CC} ${CFLAGS} -c $< -o $@
crush.o: crush/builder.co crush/mapper.co crush/crush.co
${LDINC} $@ $^
# bits
common.o: ${COMMON_OBJS}
${LDINC} $@ $^
ebofs.o: ${EBOFS_OBJS}
${LDINC} $@ $^
client.o: ${CLIENT_OBJS}
${LDINC} $@ $^
osd.o: ${OSD_OBJS}
${LDINC} $@ $^
osdc.o: ${OSDC_OBJS}
${LDINC} $@ $^
mds.o: ${MDS_OBJS}
${LDINC} $@ $^
mon.o: ${MON_OBJS}
${LDINC} $@ $^
osbdb.o: ${OSBDB_OBJS}
${LDINC} $@ $^
# generic rules
%.so: %.cc
${CXX} -shared -fPIC ${CFLAGS} $< -o $@
%.o: %.cc
${CXX} ${CFLAGS} -c $< -o $@
%.po: %.cc
${CXX} -fPIC ${CFLAGS} -c $< -o $@
# handy
clean:
rm -f *.o */*.o crush/*.co ${TARGETS}
count:
cat ${SRCS} | wc -l
cat ${SRCS} | grep -c \;
TAGS:
etags `find . -name "*.[h|c|cc]"|grep -v '\.\#'`
tags:
ctags `find . -name "*.[h|c|cc]"|grep -v '\.\#'`
.depend:
touch .depend
depend:
$(RM) .depend
makedepend -f- -- $(CFLAGS) -- $(SRCS) > .depend 2>/dev/null
# for f in $(SRCS) ; do cpp -MM $(CFLAGS) $$f 2> /dev/null >> .depend ; done
# now add a line to include the dependency list.
include .depend
# DO NOT DELETE
|