-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.in
508 lines (416 loc) · 13.4 KB
/
Makefile.in
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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# This file is part of XDD
#
# Description: XDD Makefile
#
#
# Make all the default goal
#
.DEFAULT_GOAL: all
all:
#
# Autoconf provided values
#
VERSION := @PACKAGE_VERSION@
XDD_DIR := @CONFIG_PROJECT_DIR@
BUILD_DIR := @CONFIG_BUILD_DIR@
INSTALL_DIR := @prefix@
XDDCP_ENABLED := @XDDCP_ENABLED@
CC_EXE := @CC@
DEPC_EXE := @DEPC_PATH@
TAR_EXE := @TAR@
PATCH_EXE := @PATCH@
PYTHON_EXE := @PYTHON_BIN@
CP_PRESERVE_OPTS := @CP_PRESERVE_OPTS@
ECDSA_DIST := @ECDSA_DIST@
PYCRYPTO_DIST := @PYCRYPTO_DIST@
#
# Configuration
#
SHELL = /bin/sh
OS = $(shell uname)
HOST = $(shell hostname)
#
# Source locations
#
DOC_DIR = doc
LIB_DIR = lib
SRC_DIR = src
HDR_DIR = include
TESTS_DIR = tests
BASE_DIR = $(SRC_DIR)/base
BX_DIR = $(SRC_DIR)/bx
CLIENT_DIR = $(SRC_DIR)/client
CLIENT_LITE_DIR = $(SRC_DIR)/client/lite
COMMON_DIR = $(SRC_DIR)/common
COMPAT_DIR = $(SRC_DIR)/compat
CONTRIB_DIR = contrib
FS_DIR = $(SRC_DIR)/fs
NET_DIR = $(SRC_DIR)/net
XNET_DIR = $(SRC_DIR)/xnet
PUBLIC_DIR = $(SRC_DIR)/public
TOOLS_DIR = $(SRC_DIR)/tools
TOOLS_PYTHON_DIR = $(SRC_DIR)/tools/python
TOOLS_UTILS_DIR = $(SRC_DIR)/tools/utils
XNI_DIR = $(SRC_DIR)/xni
#
# Tools
#
AR = ar
AUTOCONF = autoconf
CC = $(CC_EXE)
CP = cp
CPR = cp -r $(CP_PRESERVE_OPTS)
DEPC = $(DEPC_EXE)
DEPGEN = $(XDD_DIR)/support/depend.sh
ETAGS = etags
FIND = find
INSTALL = $(XDD_DIR)/support/install-sh
LD = $(CC_EXE)
LN = ln -sf
MKDIR = mkdir -p
MPICC = mpicc
MV = mv -f
PATCH = $(PATCH_EXE)
PYTHON = PYTHONPATH=$(TOOLS_PYTHON_DIR):$(XDD_DIR)/contrib/site-packages:$(PYTHONPATH) $(PYTHON_EXE)
PYC = $(PYTHON_EXE) -m compileall -f
RM = rm -f
RMDIR = rmdir
TAR = $(TAR_EXE)
#
# Include module makefiles
#
include $(BASE_DIR)/module.mk
include $(BX_DIR)/module.mk
include $(CLIENT_DIR)/module.mk
include $(CLIENT_LITE_DIR)/module.mk
include $(COMMON_DIR)/module.mk
include $(COMPAT_DIR)/module.mk
include $(CONTRIB_DIR)/module.mk
include $(FS_DIR)/module.mk
include $(NET_DIR)/module.mk
include $(PUBLIC_DIR)/module.mk
include $(TOOLS_UTILS_DIR)/module.mk
include $(XNI_DIR)/module.mk
include $(XNET_DIR)/module.mk
#
# Construct information from modules
#
XDD_SRC := $(BASE_SRC) $(CLIENT_SRC) $(COMMON_SRC) \
$(COMPAT_SRC) $(FS_SRC) $(NET_SRC) $(PUBLIC_SRC) \
$(XNI_SRC) $(XNET_SRC)
TOOLS_SRC := $(TOOLS_UTILS_SRC)
#
# XDD module build targets
#
XDD_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(XDD_SRC)))
TOOL_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(TOOL_SRC)))
#
# Project executable objects
#
BXT_EXE_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(BXT_EXE_SRC) $(BX_SRC)))
GETTIME_EXE_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(GETTIME_EXE_SRC)))
GETFILESIZE_EXE_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(GETFILESIZE_EXE_SRC)))
GETHOSTIP_EXE_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(GETHOSTIP_EXE_SRC)))
READ_TSDUMPS_EXE_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(READ_TSDUMPS_EXE_SRC)))
TRUNCATE_EXE_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(TRUNCATE_EXE_SRC)))
TS_EXE_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(TS_EXE_SRC)))
XDD_EXE_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(XDD_EXE_SRC)))
XDD_LITE_EXE_OBJS := $(patsubst %.c, %.o, $(filter %.c, $(XDD_LITE_EXE_SRC) $(CLIENT_LITE_SRC)))
#
# All objects
#
ALL_OBJS = \
$(BXT_EXE_OBJS) \
$(XDD_OBJS) \
$(TOOL_OBJS) \
$(CLIENT_EXE_OBJS) \
$(XDD_EXE_OBJS) \
$(XDD_LITE_EXE_OBJS) \
$(GETTIME_EXE_OBJS) \
$(READ_TSDUMPS_EXE_OBJS) \
$(TS_EXE_OBJS)
#
# Source code dependency generation
#
XDD_DEPENDS := $(patsubst %.c, %.d, $(filter %.c, $(XDD_SRC)))
TOOLS_DEPENDS := $(patsubst %.c, %.d, $(filter %.c, $(TOOLS_SRC)))
XDD_EXE_DEPENDS := $(patsubst %.c, %.d, $(filter %.c, $(CLIENT_EXE_SRC)))
XDD_LITE_EXE_DEPENDS := $(patsubst %.c, %.d, $(filter %.c, $(CLIENT_LITE_EXE_SRC)))
BXT_EXE_DEPENDS := $(patsubst %.c, %.d, $(filter %.c, $(BXT_EXE_SRC)))
#
# Default build settings
#
INCLUDES = -I$(BASE_DIR) -I$(CLIENT_DIR) -I$(CLIENT_LITE_DIR) -I$(COMMON_DIR) \
-I$(COMPAT_DIR) -I$(FS_DIR) -I$(NET_DIR) \
-I$(PUBLIC_DIR) -I$(TOOLS_DIR) -I$(XNI_DIR)
ARFLAGS = @CONFIG_ARFLAGS@
CPPFLAGS = @CONFIG_CPPFLAGS@ \
@DEFS@ \
$(CONFIDENCE_ENABLED) \
$(INCLUDES)
CFLAGS = @CONFIG_CFLAGS@
LDFLAGS = @CONFIG_LDFLAGS@
LIBS = @CONFIG_LIBS@
#
# Build rules
#
all: contrib xdd libs tools
bxt: bin/bxt
xdd: bin/xdd
xdd-lite: bin/xdd-lite
.PHONY: all bxt xdd xdd-lite
#
# Build rules for libraries
#
libs: $(LIB_DIR)/libxdd.a
$(LIB_DIR)/libxdd.a: $(XDD_OBJS)
@echo "[AR] $@"
@$(AR) $(ARFLAGS) $@ $^
.PHONY: libs
#
# Build rules for tools
#
tools: xdd-read-tsdumps xdd-getfilesize xdd-gethostip xdd-truncate
xdd-gettime: bin/xdd-gettime
xdd-getfilesize: bin/xdd-getfilesize
xdd-gethostip: bin/xdd-gethostip
xdd-read-tsdumps: bin/xdd-read-tsdumps
xdd-truncate: bin/xdd-truncate
xdd-tserver: bin/xdd-tserver
bin/xdd-tserver: $(COMMON_DIR)/nclk.o $(NET_DIR)/net_utils.o $(TS_EXE_OBJS)
@echo "[LD] $@ ..."
@$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
bin/xdd-gettime: $(COMMON_DIR)/global_time.o $(COMMON_DIR)/nclk.o $(NET_DIR)/net_utils.o $(GETTIME_EXE_OBJS)
@echo "[LD] $@ ..."
@$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
bin/xdd-read-tsdumps: $(READ_TSDUMPS_EXE_OBJS)
@echo "[LD] $@ ..."
@$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
bin/xdd-getfilesize: $(GETFILESIZE_EXE_OBJS)
@echo "[LD] $@ ..."
@$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
bin/xdd-gethostip: $(GETHOSTIP_EXE_OBJS)
@echo "[LD] $@ ..."
@$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
bin/xdd-truncate: $(TRUNCATE_EXE_OBJS)
@echo "[LD] $@ ..."
@$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
.PHONY: tools xdd-read-tsdumps xdd-getfilesize xdd-gethostip xdd-truncate
#
# Build rules for executable targets
#
bin/xdd: $(XDD_OBJS) $(XDD_EXE_OBJS)
@echo "[LD] $@ ..."
@$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
bin/bxt: $(BXT_EXE_OBJS) $(LIB_DIR)/libxdd.a
@echo "[LD] $@ ..."
$(LD) $(LDFLAGS) -L$(LIB_DIR) -o $@ $(BXT_EXE_OBJS) -lxdd $(LIBS)
bin/xdd-lite: $(XDD_LITE_EXE_OBJS) $(LIB_DIR)/libxdd.a
@echo "[LD] $@ ..."
$(LD) $(LDFLAGS) -L$(LIB_DIR) -o $@ $(XDD_LITE_EXE_OBJS) -lxdd $(LIBS)
#
# Build rules for installation
#
install_pre:
$(INSTALL) -d $(INSTALL_DIR)/bin
$(INSTALL) -d $(INSTALL_DIR)/etc
$(INSTALL) -d $(INSTALL_DIR)/lib
$(INSTALL) -d $(INSTALL_DIR)/site-packages
fastinstall: all
$(RM) /sbin/xdd
cp bin/xdd /sbin
$(RM) /sbin/xdd-tserver
cp bin/xdd-tserver /sbin
$(RM) /sbin/xdd-gettime
cp bin/xdd-gettime /sbin
cp bin/xdd-read-tsdumps /sbin
install_libs: install_pre
$(INSTALL) -c -m 755 $(LIB_DIR)/libxdd.a $(INSTALL_DIR)/lib/libxdd.a
install_site_packages: install_pre install_contrib_site-packages
$(CPR) $(TOOLS_DIR)/python/xdd $(INSTALL_DIR)/site-packages
$(INSTALL) -c -m 644 $(TOOLS_DIR)/python/xdd_file_transfer.py $(INSTALL_DIR)/site-packages
$(INSTALL) -c -m 644 $(TOOLS_DIR)/python/xdd_storage_profile.py $(INSTALL_DIR)/site-packages
$(PYC) -q $(INSTALL_DIR)/site-packages
install_tools: install_pre install_site_packages
$(INSTALL) -c -m 755 $(TOOLS_DIR)/xddcp/xddcp $(INSTALL_DIR)/bin/xddcp
$(INSTALL) -c -m 755 $(TOOLS_DIR)/xddft/xddft $(INSTALL_DIR)/bin/xddft
$(INSTALL) -c -m 755 $(TOOLS_DIR)/xddmcp/xddmcp $(INSTALL_DIR)/bin/xddmcp
$(INSTALL) -c -m 755 $(TOOLS_DIR)/xddmcp/xddmcp-server $(INSTALL_DIR)/bin/xddmcp-server
$(INSTALL) -c -m 755 $(TOOLS_DIR)/xddprof/xddprof $(INSTALL_DIR)/bin/xddprof
$(INSTALL) -c -m 755 bin/xdd $(INSTALL_DIR)/bin/xdd
$(INSTALL) -c -m 755 bin/xdd-read-tsdumps $(INSTALL_DIR)/bin/xdd-read-tsdumps
$(INSTALL) -c -m 755 bin/xdd-getfilesize $(INSTALL_DIR)/bin/xdd-getfilesize
$(INSTALL) -c -m 755 bin/xdd-gethostip $(INSTALL_DIR)/bin/xdd-gethostip
$(INSTALL) -c -m 755 bin/xdd-truncate $(INSTALL_DIR)/bin/xdd-truncate
install_xdd: install_pre
$(INSTALL) -c -m 755 bin/xdd $(INSTALL_DIR)/bin/xdd
install: all install_pre install_xdd install_libs install_tools
.PHONY: install install_pre install_libs install_site_packages install_tools install_xdd
#
# Miscellaneous build rules
#
XDDVERSION := $(VERSION)
baseversion:
echo "#define XDD_BASE_VERSION $(XDDVERSION)" > $(BASE_DIR)/xdd_base_version.h
TARPATH := $(shell basename ${PWD})
TARFILE := xdd-$(shell date +%s).tgz
TARFLAGS := --exclude \*.o --exclude \*~ --exclude .DS_STORE --exclude .git
tarball:
@echo "[TAR] $(TARFILE)"
@pushd .; cd .. && $(TAR) $(TARFLAGS) -czf $(TARFILE) $(TARPATH); popd
.PHONY: baseversion dist fulldist tarball
#
# Build rules for documentation
#
doc:
doxygen doc/Doxyfile
cd doc/doxygen/latex && make pdf
TAGS: $(XDD_SRC)
@echo "[TAGS]"
@$(ETAGS) $^
#
# Build and run unit tests
#
bin/basic-ib-test: $(TESTS_DIR)/other/xni/basic-ib-test.c $(LIB_DIR)/libxdd.a
$(CC) $(CPPFLAGS) $(CFLAGS) -L$(LIB_DIR) $< -lxdd $(LIBS) -o $@
bin/basic-xni-test: $(TESTS_DIR)/other/xni/basic-xni-test.c $(LIB_DIR)/libxdd.a
$(CC) $(CPPFLAGS) $(CFLAGS) -L$(LIB_DIR) $< -lxdd $(LIBS) -o $@
check_xni: bin/basic-xni-test bin/basic-ib-test
@# This should somehow run all xni tests
check_tools: contrib xdd
@# This should somehow run all of the tests.
@$(PYTHON) $(TESTS_DIR)/unit/site-packages/paramiko_test.py
@$(PYTHON) $(TESTS_DIR)/unit/site-packages/xdd_file_transfer_test.py
@$(PYTHON) $(TESTS_DIR)/unit/site-packages/xdd_flow_test.py
@$(PYTHON) $(TESTS_DIR)/unit/site-packages/xdd_factory_test.py
@$(PYTHON) $(TESTS_DIR)/unit/site-packages/xdd_naming_test.py
@$(PYTHON) $(TESTS_DIR)/unit/site-packages/xdd_partition_test.py
@$(PYTHON) $(TESTS_DIR)/unit/site-packages/xdd_transfer_manager_test.py
@$(PYTHON) $(TESTS_DIR)/unit/site-packages/xdd_transport_test.py
check: check_tools check_xni
@# This should somehow run all of the tests.
.PHONY: check check_tools check_xni
#
# Build and run acceptance tests (this requires a make install)
#
$(TESTS_DIR)/etc/test_config.$(HOST):
test_config: $(TESTS_DIR)/etc/test_config.$(HOST)
@cp tests/etc/test_config.$(HOST) $@
test_xdd: test_config
@$(TESTS_DIR)/acceptance/test_xdd_datapattern_random.sh
@$(TESTS_DIR)/acceptance/test_xdd_e2e_large_thread_count.sh
test_xddmcp: test_config
@$(TESTS_DIR)/acceptance/test_xddmcp_defaults.sh
@$(TESTS_DIR)/acceptance/test_xddmcp_verbose.sh
@$(TESTS_DIR)/acceptance/test_xddmcp_timestamp.sh
@$(TESTS_DIR)/acceptance/test_xddmcp_single_thread.sh
@$(TESTS_DIR)/acceptance/test_xddmcp_large_thread_count.sh
@$(TESTS_DIR)/acceptance/test_xddmcp_too_large_thread_count.sh
test: install test_xdd test_xddmcp
.INTERMEDIATE: $(TESTS_DIR)/etc/test_config.$(HOST)
.PHONY: test test_xdd test_xddmcp
#
# Build rules for cleaning up derived files
#
testclean:
depclean:
$(info Cleaning the $(OS) dependency files )
@$(RM) $(XDD_DEPENDS) $(TOOLS_DEPENDS)
docclean:
$(info Cleaning the $(OS) documentation files )
@$(RM) -r doc/doxygen
libclean:
$(info Cleaning the $(OS) LIBRARY files )
@$(RM) $(LIB_DIR)/libxdd.*
oclean:
$(info Cleaning the $(OS) OBJECT files )
@$(RM) $(ALL_OBJS)
tclean: clean_contrib
$(info Cleaning the $(OS) TOOLS OBJECT files )
@$(RM) src/tools/*.o
clean: depclean libclean oclean tclean
$(info Cleaning the $(OS) executable files )
@$(RM) bin/xdd \
bin/xdd-lite \
bin/xdd-tserver\
bin/xdd-getfilesize \
bin/xdd-gethostip \
bin/xdd-gettime \
bin/xdd-read-tsdumps \
bin/xdd-truncate \
bin/xdd-read-tsdumps \
bin/bxt \
a.out
.PHONY: testclean depclean docclean libclean oclean clean
#
# Rules for building the distribution
#
DISTCHECK_DIR := $(PWD)/tests/distcheck
CONFIG_FLAGS = $(shell grep "\-\-prefix" config.log | cut -f 5- -d ' ')
xdd-$(XDDVERSION):
git archive --format=tar --prefix=$@/ master | $(TAR) xf -
$(FIND) $@ -name .gitignore -exec rm {} \;
cd $@ && $(AUTOCONF)
xdd-$(XDDVERSION).tar.gz: xdd-$(XDDVERSION)
$(TAR) cfz $@ $<
@$(RM) -r $<
xdd-$(XDDVERSION)+export-control.tar.gz: xdd-$(XDDVERSION)
$(CP) ~/Downloads/ecdsa-0.11.tar.gz $</contrib
$(CP) ~/Downloads/pycrypto-2.6.1.tar.gz $</contrib
$(TAR) cfz $@ $<
$(RM) -r $<
distclean: clean
$(info Cleaning the distribution)
@$(RM) GNUMakefile
@$(RM) Makefile
@$(RM) config.log config.status
@$(RM) -r xdd-$(VERSION)
@$(RM) xdd-$(VERSION).tar.gz
distcheck: dist
$(RM) -r $(DISTCHECK_DIR)
$(MKDIR) $(DISTCHECK_DIR)
$(TAR) -C $(DISTCHECK_DIR) -xzf xdd-$(XDDVERSION).tar.gz
cd $(DISTCHECK_DIR)/xdd-$(XDDVERSION) && ./configure $(CONFIG_FLAGS) --prefix=$(DISTCHECK_DIR)
cd $(DISTCHECK_DIR)/xdd-$(XDDVERSION) && make
cd $(DISTCHECK_DIR)/xdd-$(XDDVERSION) && make check
cd $(DISTCHECK_DIR)/xdd-$(XDDVERSION) && make install
dist: xdd-$(XDDVERSION).tar.gz
dist-usa: xdd-$(XDDVERSION)+export-control.tar.gz
.PHONY: dist dist-usa distcheck distclean
#
# Include dependency makefiles if building source target
#
DEPFILTER_MAKECMDGOALS := $(filter %clean %doc, $(MAKECMDGOALS))
ifeq ($(strip $(DEPFILTER_MAKECMDGOALS)),)
-include $(XDD_DEPENDS)
#-include $(TOOLS_DEPENDS)
endif
#
# Overload default rules so that compilation is prettier
#
%.o: %.c
@echo "[CC] $< . . ."
@$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
#
# Additional rule for building dependencies
#
%.d: %.c
@echo "[DEPC] $< . . ."
@mkdir -p $(shell dirname $@)
@$(DEPGEN) $(shell dirname $<) $(DEPC) -MM $(INCLUDES) $< > $@