-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
1166 lines (1019 loc) · 38.3 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
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Top level makefile for pvfs2
###############################################################
# LIST OF TARGETS WHICH MAY BE USED WHEN RUNNING MAKE:
#
# all default rule; builds libs, server, and test programs
# clean cleans up files
# distclean _really_ cleans up; returns to pristine tree
# docs builds documentation in docs subdirectory
# docsclean cleans up documentation files
# publish copy over documents to the PVFS.org web pags
# admintools builds admin tools
# kernapps builds userland helper programs for kernel driver
# cscope generates information for cscope utility
# tags generates tags file for use by editors
# codecheck checks source code for nonconformance to our std.
# kmod builds 2.6.x kernel module
# kmod24 builds 2.4.x kernel module
# kmod_install installs 2.6.x module in default module location
# kmod24_install installs 2.4.x module in default module location
#
# NOTE: you can also specify any single object or executable to
# build by providing its name (including the relative path) as the
# make target
#
###############################################################
# General documentation
#
# This is a single makefile that runs the entire pvfs2 build
# process. There are no makefiles in subdirectories. For a
# general introduction to this approach, please read this document
# by Peter Miller:
#
# http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html
#
# Each subdirectory contains a module.mk file that gets included
# when make is executed. These module.mk files tell make about the
# files in each subdirectory that must be built, including any
# special case rules. Make uses this information to generate a
# sinle dependency graph and orchestrate the build process from this
# top level directory.
#
# We categorize our source depending on what it will be used for.
# For example, there are lists of source files for building the
# server, building the library, building documentation, etc.
#
###############################################################
# Generic makefile setup
# define a few generic variables that we need to use; DESTDIR may
# be overridden on the command line during make install
DESTDIR =
srcdir = @srcdir@
builddir = @BUILD_ABSOLUTE_TOP@
prefix = @prefix@
datarootdir = @datarootdir@
exec_prefix = @exec_prefix@
includedir = $(DESTDIR)@includedir@
mandir = $(DESTDIR)@mandir@
sbindir = $(DESTDIR)@sbindir@
bindir = $(DESTDIR)@bindir@
libdir = $(DESTDIR)@libdir@
VPATH = $(srcdir)
SHELL = @SHELL@
INSTALL = @INSTALL@
# TODO: should probably check for bison and flex in configure
BISON = bison
FLEX = flex
LN_S = ln -snf
BUILD_BMI_TCP = @BUILD_BMI_TCP@
BUILD_BMI_ONLY = @BUILD_BMI_ONLY@
BUILD_GM = @BUILD_GM@
BUILD_MX = @BUILD_MX@
BUILD_IB = @BUILD_IB@
BUILD_OPENIB = @BUILD_OPENIB@
BUILD_PORTALS = @BUILD_PORTALS@
BUILD_VIS = @BUILD_VIS@
BUILD_KARMA = @BUILD_KARMA@
BUILD_FUSE = @BUILD_FUSE@
BUILD_SERVER = @BUILD_SERVER@
BUILD_TAU = @BUILD_TAU@
BUILD_KERNEL = @BUILD_KERNEL@
NEEDS_LIBRT = @NEEDS_LIBRT@
TARGET_OS_DARWIN = @TARGET_OS_DARWIN@
TARGET_OS_LINUX = @TARGET_OS_LINUX@
GNUC = @GNUC@
INTELC = @INTELC@
# configure default is silent, unless --enable-verbose-build in
# which case QUIET_COMPILE will _not_ be defined. Further allow
# silence to be overriden with "make V=1".
QUIET_COMPILE = @QUIET_COMPILE@
ifdef V
QUIET_COMPILE = 0
endif
LINUX_KERNEL_SRC = @LINUX_KERNEL_SRC@
LINUX24_KERNEL_SRC = @LINUX24_KERNEL_SRC@
ifeq ($(QUIET_COMPILE),1)
# say a one-line description of the action, do not echo the command
Q=@echo
E=@
else
# do not say the short Q lines, but do echo the entire command
Q=@echo >/dev/null
E=
endif
# build which client libs
build_shared = @build_shared@
build_static = @build_static@
# Eliminate all default suffixes. We want explicit control.
.SUFFIXES:
# PHONEY targets are targets that do not result in the generation
# of a file that has the same name as the target. Listing them
# here keeps make from accidentally doing too much work (see GNU
# make manual).
.PHONY: all clean dist distclean docs docsclean publish cscope tags codecheck admintools kernapps
################################################################
# Find project subdirectories
# MODULES is a list of subdirectories that we wish to operate on.
# They are identified by the presence of module.mk files (makefile
# includes).
MODULES := $(shell find . -name "*.mk" | sed -e 's/^.\///;s/module.mk//')
# List of directories to search for headers.
ifdef BUILD_BMI_ONLY
BUILD_SERVER=""
INCLUDES := \
include \
src/io/bmi \
src/common/misc \
src/common/quickhash \
src/common/quicklist \
src/common/id-generator \
src/common/gossip \
src/common/gen-locks \
src/common/events
GENINCLUDES := \
include
else
INCLUDES := \
src/client/sysint \
src/common/misc \
src/common/quickhash \
src/common/quicklist \
src/common/id-generator \
src/common/gossip \
src/common/gen-locks \
src/common/events \
src/io/trove \
src/io/bmi \
src/io/description \
src/io/buffer \
src/io/job \
src/io/dev \
src/proto \
src/common/mgmt
GENINCLUDES := \
include
endif
#################################################################
# Setup global flags
# These should all be self explanatory; they are standard flags
# for compiling and linking unless otherwise noted
CC = @CC@
LD = @CC@
BUILD_CC = @BUILD_CC@
BUILD_LD = @BUILD_CC@
BUILD_CFLAGS = @BUILD_CFLAGS@
BUILD_LDFLAGS = @BUILD_LDFLAGS@
# make sure the srcdir include gets included first
CFLAGS = -I$(srcdir)/include @CFLAGS@ @CPPFLAGS@
LDFLAGS = -L@BUILD_ABSOLUTE_TOP@/lib
LDFLAGS += @LDFLAGS@
SERVER_LDFLAGS = -L@BUILD_ABSOLUTE_TOP@/lib
SERVER_LDFLAGS += @SERVER_LDFLAGS@
DB_CFLAGS = @DB_CFLAGS@
LDSHARED = $(CC) -shared
PICFLAGS = -fPIC
LIBS += -lpvfs2 -lm -lgsl -lgslcblas @LIBS@
LIBS_THREADED += -lpvfs2-threaded @LIBS@
# need to include external dependency libs when building shared libraries
DEPLIBS := @LIBS@
MMAP_RA_CACHE = @MMAP_RA_CACHE@
TRUSTED_CONNECTIONS = @TRUSTED_CONNECTIONS@
REDHAT_RELEASE = @REDHAT_RELEASE@
NPTL_WORKAROUND = @NPTL_WORKAROUND@
STRICT_CFLAGS = @STRICT_CFLAGS@
SO_VER = @PVFS2_VERSION_MAJOR@
SO_MINOR = @PVFS2_VERSION_MINOR@
SO_RELEASE = @PVFS2_VERSION_SUB@
SO_FULLVER = $(SO_VER).$(SO_MINOR).$(SO_RELEASE)
# for Solaris:
# LIBS += -lsocket -lnsl
# enable Flow debugging protocol
#CFLAGS += -D__STATIC_FLOWPROTO_DUMP_OFFSETS__
# enable new style Flow BMI/Trove protocol
CFLAGS += -D__STATIC_FLOWPROTO_MULTIQUEUE__
# turn on large file support by default
CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
# include current directory (for pvfs2-config.h)
CFLAGS += -I .
# include toplevel source dir
CFLAGS += -I $(srcdir)
# add selected include directories
CFLAGS += $(patsubst %,-I$(srcdir)/%,$(INCLUDES))
CFLAGS += $(patsubst %,-I$(builddir)/%,$(GENINCLUDES))
# add package version information
CFLAGS += -DPVFS2_VERSION="\"@PVFS2_VERSION@\""
# always want these gcc flags
GCC_CFLAGS := -pipe -Wall -Wstrict-prototypes
ifneq (,$(STRICT_CFLAGS))
GCC_CFLAGS += -Wcast-align -Wbad-function-cast
GCC_CFLAGS += -Wmissing-prototypes -Wmissing-declarations
GCC_CFLAGS += -Wundef -Wpointer-arith
GCC_CFLAGS += -Wnested-externs
GCC_CFLAGS += -Wredundant-decls
# These are very noisy, and probably too strict.
#GCC_CFLAGS += -W -Wno-unused -Wno-sign-compare
#GCC_CFLAGS += -Wcast-qual
#GCC_CFLAGS += -Wshadow
#GCC_CFLAGS += -Wwrite-strings
endif
# Intel cc options, enable all warnings, then disable some
INTEL_CFLAGS := -Wall
# #279: controlling expression is constant
# shows up in ifdefs such as "do { ... } while (0)" construct
INTEL_CFLAGS += -wd279
# #424: extra ";" ignored e.g. in endecode_fields_2(); usage
INTEL_CFLAGS += -wd424
# #188: enumerated type mixed with another type, like flag |= ENUM_VALUE;
# bogus compiler warning
INTEL_CFLAGS += -wd188
# #981: operands are evaluated in unspecified order, like printf that
# uses functions to get some values; unimportant.
INTEL_CFLAGS += -wd981
# do not disable these if strict, i.e. enable some more warnings
ifeq (,$(STRICT_CFLAGS))
# #1419: external declaration in primary source file; would be good
# to get rid of these someday
INTEL_CFLAGS += -wd1419
# #1419: external definition with no prior declaration; most of these
# want to be static
INTEL_CFLAGS += -wd1418
# #181: argument is incompatible with corresponding format string
# conversion; investigate someday.
INTEL_CFLAGS += -wd181
# #869: parameter .. was never referenced, like -Wunused
INTEL_CFLAGS += -wd869
# #810: conversion from .. to .. may lose significant bits; investigate
# but probably harmless
INTEL_CFLAGS += -wd810
endif
################################################################
# Setup component specific flags
# the server can use a threaded trove and job configuration.
# Working combinations of trove/job thread configurations
# are as follows:
#
# NOTE: __PVFS2_TROVE_SUPPORT__, and __GEN_POSIX_LOCKING__
# are required for all server configurations
#
# config 1)
# =========
# __PVFS2_TROVE_THREADED__
# __PVFS2_JOB_THREADED__
# __PVFS2_TROVE_AIO_THREADED__ (auto detected MISC_TROVE_FLAGS)
# e.g.
#
#SERVERCFLAGS = -D__GEN_POSIX_LOCKING__ -D__PVFS2_JOB_THREADED__ \
#-D__PVFS2_TROVE_THREADED__ @MISC_TROVE_FLAGS@ \
#-D__PVFS2_TROVE_SUPPORT__
#
# config 2)
# =========
# __PVFS2_TROVE_THREADED__
# __PVFS2_JOB_THREADED__
# e.g.
#
#SERVERCFLAGS = -D__GEN_POSIX_LOCKING__ -D__PVFS2_JOB_THREADED__ \
#-D__PVFS2_TROVE_THREADED__ -D__PVFS2_TROVE_SUPPORT__
#
# config 3)
# =========
# none (non-threaded)
# e.g.
#
#SERVERCFLAGS = -D__GEN_POSIX_LOCKING__ -D__PVFS2_TROVE_SUPPORT__
SERVERCFLAGS = @CFLAGS@ -D__GEN_POSIX_LOCKING__ -D__PVFS2_JOB_THREADED__ \
-D__PVFS2_TROVE_THREADED__ @MISC_TROVE_FLAGS@ @DB_CFLAGS@ \
-D__PVFS2_TROVE_SUPPORT__ -D__PVFS2_SERVER__
# server side flow protocol connecting BMI with NCAC cache
SERVERCFLAGS += -D__STATIC_FLOWPROTO_BMI_CACHE__
SERVERLIBS = -lpvfs2-server -lm -lgsl -lgslcblas @LIBS@ @DB_LIB@ -lpthread
ifdef NEEDS_LIBRT
SERVERLIBS += -lrt
endif
# you can optionally disable thread safety support in the client
# though it's not recommended unless *required*.
#
# run ./configure --help for information on how to do this cleanly.
LIBCFLAGS=@LIBCFLAGS@ -D__PVFS2_CLIENT__
LIBTHREADEDCFLAGS=-D__GEN_POSIX_LOCKING__ -D__PVFS2_JOB_THREADED__ -D__PVFS2_CLIENT__
LIBS += @THREAD_LIB@
DEPLIBS += @THREAD_LIB@
LIBS_THREADED += @THREAD_LIB@
################################################################
# build BMI TCP?
ifdef BUILD_BMI_TCP
CFLAGS += -D__STATIC_METHOD_BMI_TCP__
endif
################################################################
# enable GM if configure detected it
ifdef BUILD_GM
# other settings in bmi_gm/module.mk.in
CFLAGS += -D__STATIC_METHOD_BMI_GM__
GMLIBS := -L@GM_LIBDIR@ -lgm
LIBS += $(GMLIBS)
DEPLIBS += $(GMLIBS)
LIBS_THREADED += $(GMLIBS)
SERVERLIBS += $(GMLIBS)
endif
################################################################
# enable MX if configure detected it
ifdef BUILD_MX
# other settings in bmi_mx/module.mk.in
CFLAGS += -D__STATIC_METHOD_BMI_MX__
MXLIBS := -L@MX_LIBDIR@ -lmyriexpress -lpthread
LIBS += $(MXLIBS)
DEPLIBS += $(MXLIBS)
LIBS_THREADED += $(MXLIBS)
SERVERLIBS += $(MXLIBS)
endif
#####################################
# enable IB if configure requested it
ifdef BUILD_IB
# other settings in bmi_ib/module.mk.in
CFLAGS += -D__STATIC_METHOD_BMI_IB__
IBLIBS := -L@IB_LIBDIR@ \
-lvapi -lmtl_common -lmosal -lmpga -lpthread -ldl
LIBS += $(IBLIBS)
DEPLIBS += $(IBLIBS)
LIBS_THREADED += $(IBLIBS)
SERVERLIBS += $(IBLIBS)
endif
ifdef BUILD_OPENIB
ifndef BUILD_IB
CFLAGS += -D__STATIC_METHOD_BMI_IB__
endif
OPENIBLIBS := -L@OPENIB_LIBDIR@ -libverbs
LIBS += $(OPENIBLIBS)
DEPLIBS += $(OPENIBLIBS)
LIBS_THREADED += $(OPENIBLIBS)
SERVERLIBS += $(OPENIBLIBS)
endif
# Portals
ifdef BUILD_PORTALS
CFLAGS += -D__STATIC_METHOD_BMI_PORTALS__
ifneq (,@PORTALS_LIBS@)
PORTALS_LIBS := @PORTALS_LIBS@
LIBS += $(PORTALS_LIBS)
DEPLIBS += $(PORTALS_LIBS)
LIBS_THREADED += $(PORTALS_LIBS)
SERVERLIBS += $(PORTALS_LIBS)
endif
endif
# enable mmap-readahead cache (unless disabled by configure)
ifdef MMAP_RA_CACHE
CFLAGS += @MMAP_RA_CACHE@
endif
# enable trusted connections (unless disabled by configure)
ifdef TRUSTED_CONNECTIONS
CFLAGS += @TRUSTED_CONNECTIONS@
endif
# enable redhat-release patches (if detected and if any)
ifdef REDHAT_RELEASE
CFLAGS += @REDHAT_RELEASE@
endif
# Add gcc-specific flags if we know it is a gnu compiler.
ifdef GNUC
CFLAGS += $(GCC_CFLAGS)
endif
ifdef INTELC
CFLAGS += $(INTEL_CFLAGS)
endif
#################################################################
# Starter variables
# NOTES: These variables are used to categorize the various source
# files. We let the makefile includes append to them so that we
# gradually build up a list of source files without having to
# list them all at the top level.
# ADMINSRC is source code for administrative programs
ADMINSRC :=
# ADMINSRC_SERVER special version of ADMINSRC for tools that need server
# library
ADMINSRC_SERVER :=
# LIBSRC is source code for libpvfs2
LIBSRC :=
# SERVERSRC is souce code for the pvfs2 server
SERVERSRC :=
ifdef BUILD_BMI_ONLY
# LIBBMISRC is source code for libbmi
LIBBMISRC :=
endif
# SERVERBINSRC is source files that don't get added to the server library but must be added to the server binary
SERVERBINSRC :=
# DOCSRC is source code for documentation
DOCSRC :=
# VISSRC is the source code for visualization tools
VISSRC :=
# VISMISCSRC is a collection of sources that must be built into objects for
# visualization tools
VISMISCSRC :=
# KARMASRC is source for the karma gui
KARMASRC :=
# FUSESRC is source for the FUSE interface daemon
FUSESRC :=
# userland helper programs for kernel drivers
KERNAPPSRC :=
KERNAPPTHRSRC :=
# MISCSRC are sources that don't fall into the other categories
MISCSRC :=
# c files generated from state machines
SMCGEN :=
################################################################
# Top level (default) targets
ifdef BUILD_SERVER
# SERVER_STUB is a wrapper script that export the LD_ASSUME_KERNEL variable for
# systems with buggy NPTL/Pthread implementations, such as early RedHat
# EL 3 distributions
SERVER_STUB := src/server/pvfs2-server-stub
# SERVER is the pvfs2 server
SERVER := src/server/pvfs2-server
endif
# LIBRARIES is a list of the pvfs2 client libraries that will be installed
LIBRARIES :=
ifdef BUILD_BMI_ONLY
BMILIBRARIES :=
endif
LIBRARIES_THREADED :=
ifeq ($(build_shared),yes)
ifdef BUILD_BMI_ONLY
BMILIBRARIES := lib/libbmi.so
endif
LIBRARIES_SHARED = lib/libpvfs2.so
LIBRARIES += $(LIBRARIES_SHARED)
LIBRARIES_THREADED_SHARED += lib/libpvfs2-threaded.so
LIBRARIES_THREADED += $(LIBRARIES_THREADED_SHARED)
endif
ifeq ($(build_static),yes)
ifdef BUILD_BMI_ONLY
BMILIBRARIES += lib/libbmi.a
endif
LIBRARIES_STATIC = lib/libpvfs2.a
LIBRARIES += $(LIBRARIES_STATIC)
LIBRARIES_THREADED_STATIC += lib/libpvfs2-threaded.a
LIBRARIES_THREADED += $(LIBRARIES_THREADED_STATIC)
endif
################################################################
# Default target forward pointer, to avoid other targets in make stubs
all::
################################################################
# Makefile includes
# this is how we pull build information from all of the project
# subdirectories, make sure to catch top level module.mk as well
include module.mk
include $(patsubst %, %/module.mk, $(MODULES))
################################################################
# Derived file lists
# NOTES: At this point, the subdirectory makefile includes have informed
# us what the source files are. Now we want to generate some
# other lists (such as objects, executables, and dependency files)
# by manipulating the lists of source files
# LIBOBJS is a list of objects to put in the client lib
LIBOBJS := $(patsubst %.c,%.o, $(filter %.c,$(LIBSRC)))
# LIBPICOBJS are the same, but compiled for use in a shared library
LIBPICOBJS := $(patsubst %.c,%.po, $(filter %.c,$(LIBSRC)))
# LIBDEPENDS is a list of dependency files for the client lib
LIBDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(LIBSRC)))
ifdef BUILD_BMI_ONLY
# LIBBMIOBJS is a list of objects to put in the bmi lib
LIBBMIOBJS := $(patsubst %.c,%.o, $(filter %.c,$(LIBBMISRC)))
# LIBBMIPICOBJS are the same, but compiled for use in a shared library
LIBBMIPICOBJS := $(patsubst %.c,%.po, $(filter %.c,$(LIBBMISRC)))
# LIBBMIDEPENDS is a list of dependency files for the bmi lib
LIBBMIDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(LIBBMISRC)))
endif
# LIBTHREADEDOBJS is a list of objects to put in the multithreaded client lib
LIBTHREADEDOBJS := $(patsubst %.c,%-threaded.o, $(filter %.c,$(LIBSRC)))
# LIBTHREADEDPICOBJS are the same, but compiled for use in a shared library
LIBTHREADEDPICOBJS := $(patsubst %.c,%-threaded.po, $(filter %.c,$(LIBSRC)))
# LIBTHREADEDDEPENDS is a list of dependency files for the multithreaded client lib
LIBTHREADEDDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(LIBSRC)))
# ADMINOBJS is a list of admin program objects
ADMINOBJS := $(patsubst %.c,%.o, $(filter %.c,$(ADMINSRC)))
# ADMINTOOLS is a list of admin program executables
ADMINTOOLS := $(patsubst %.c,%, $(filter %.c, $(ADMINSRC)))
# ADMINDEPENDS is a list of dependency files for admin programs
ADMINDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(ADMINSRC)))
ifdef BUILD_SERVER
ADMINOBJS_SERVER := $(patsubst %.c,%.o, $(filter %.c,$(ADMINSRC_SERVER)))
ADMINTOOLS_SERVER := $(patsubst %.c,%, $(filter %.c, $(ADMINSRC_SERVER)))
ADMINDEPENDS_SERVER := $(patsubst %.c,%.d, $(filter %.c,$(ADMINSRC_SERVER)))
# SERVEROBJS is a list of objects to put into the server
SERVEROBJS := $(patsubst %.c,%-server.o, $(filter %.c,$(SERVERSRC)))
# SERVERDEPENDS is a list of dependency files for the server
SERVERDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(SERVERSRC)))
# SERVERBINOBJS is a list of objects not in SERVEROBJS to put into the server
SERVERBINOBJS := $(patsubst %.c,%-server.o, $(filter %.c,$(SERVERBINSRC)))
SERVERBINDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(SERVERBINSRC)))
endif
# MISCOBJS is a list of misc. objects not in the above categories
MISCOBJS := $(patsubst %.c,%.o, $(filter %.c,$(MISCSRC)))
# MISCDEPENDS is a list of dependency files for misc. objects
MISCDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(MISCSRC)))
# KERNAPPOBJS is a list of kernel driver userland objects
KERNAPPOBJS := $(patsubst %.c,%.o, $(filter %.c,$(KERNAPPSRC))) \
$(patsubst %.c,%-threaded.o, $(filter %.c,$(KERNAPPTHRSRC)))
# KERNAPPS is a list of kernel driver userland executables
KERNAPPS := $(patsubst %.c,%, $(filter %.c, $(KERNAPPSRC)))
KERNAPPSTHR := $(patsubst %.c,%, $(filter %.c, $(KERNAPPTHRSRC)))
# KERNAPPDEPENDS is a list of dependency files for kernel driver userland
# objects
KERNAPPDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(KERNAPPSRC) $(KERNAPPTHRSRC)))
# Be sure to build/install the threaded lib too; just pick the shared
# one if configure asked for both.
ifneq (,$(KERNAPPSTHR))
ifeq (,$(filter $(firstword $(LIBRARIES_THREADED)),$(LIBRARIES)))
LIBRARIES += $(firstword $(LIBRARIES_THREADED))
endif
endif
# VISOBJS is a list of visualization program objects
VISOBJS := $(patsubst %.c,%.o, $(filter %.c,$(VISSRC)))
# VISS is a list of visualization program executables
VISS := $(patsubst %.c,%, $(filter %.c, $(VISSRC)))
# VISDEPENDS is a list of dependency files for visualization programs
VISDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(VISSRC)))
# VISMISCOBJS is a list of misc. vis objects not in the above categories
VISMISCOBJS := $(patsubst %.c,%.o, $(filter %.c,$(VISMISCSRC)))
# VISMISCDEPENDS is a list of dependency files for vis misc. objects
VISMISCDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(VISMISCSRC)))
# KARMAOBJS, KARMADEPENDS for the karma gui (requires gtk2.0)
KARMAOBJS := $(patsubst %.c,%.o, $(filter %.c,$(KARMASRC)))
KARMADEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(KARMASRC)))
# FUSEOBJS
FUSEOBJS := $(patsubst %.c,%.o, $(filter %.c,$(FUSESRC)))
FUSEDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(FUSESRC)))
# state machine generation tool, built for the build machine, not the
# host machine, in the case of cross-compilation
STATECOMPOBJS := $(patsubst %.c,%.o,$(STATECOMPSRC))
STATECOMPDEPS := $(patsubst %.c,%.d,$(STATECOMPSRC))
# DOCSPDF, DOCSPS, and DOCSHTML are lists of documentation files generated
# from latex
DOCSPDF := $(patsubst %.tex,%.pdf, $(filter %.tex,$(DOCSRC)))
DOCSPS := $(patsubst %.tex,%.ps, $(filter %.tex,$(DOCSRC)))
DOCSHTML := $(patsubst %.tex,%.html, $(filter %.tex,$(DOCSRC)))
# DOCSCRUFT is a list of intermediate files generated by latex
DOCSCRUFT := $(patsubst %.tex,%.aux, $(filter %.tex,$(DOCSRC)))
DOCSCRUFT += $(patsubst %.tex,%.dvi, $(filter %.tex,$(DOCSRC)))
DOCSCRUFT += $(patsubst %.tex,%.log, $(filter %.tex,$(DOCSRC)))
DOCSCRUFT += $(patsubst %.tex,%.toc, $(filter %.tex,$(DOCSRC)))
# DEPENDS is a global list of all of our dependency files.
# NOTE: sort is just a trick to remove duplicates; the order
# doesn't matter at all.
ifdef BUILD_BMI_ONLY
DEPENDS := $(sort $(LIBBMIDEPENDS))
else
DEPENDS := $(sort $(LIBDEPENDS) $(SERVERDEPENDS) $(SERVERBINDEPENDS) \
$(MISCDEPENDS) \
$(ADMINDEPENDS) $(ADMINDEPENDS_SERVER) $(KERNAPPDEPENDS) $(VISDEPENDS) \
$(VISMISCDEPENDS) $(KARMADEPENDS) $(STATECOMPDEPS) $(FUSEDEPENDS))
endif
####################################################################
# Rules and dependencies
# default rule builds server, library, and applications
ifdef BUILD_BMI_ONLY
all:: $(BMILIBRARIES)
else
all:: $(SERVER) $(KARMA) $(LIBRARIES) admintools $(VISS) $(KARMA) $(FUSE)
endif
# target for building admin tools
admintools: $(ADMINTOOLS) $(ADMINTOOLS_SERVER)
# target for building kernel driver userland programs
kernapps: $(KERNAPPS) $(KERNAPPSTHR)
# this is needed for the make dist
statecompgen: $(STATECOMPGEN)
# Build linux-2.6 kernel module if requested.
# Can't use the actual file target since we don't know how to figure out
# dependencies---only the kernel source tree can do that.
ifneq (,$(LINUX_KERNEL_SRC))
.PHONY: kmod
kmod: just_kmod kernapps
just_kmod:
@$(MAKE) --no-print-directory -C src/kernel/linux-2.6
endif
# Build linux-2.4 kernel module if requested.
ifneq (,$(LINUX24_KERNEL_SRC))
.PHONY: kmod24
kmod24: just_kmod24 kernapps
just_kmod24:
@$(MAKE) --no-print-directory -C src/kernel/linux-2.4
endif
# Just like dir, but strip the slash off the end, to be pretty.
dirname = $(patsubst %/,%,$(dir $(1)))
# Generate the canonical in-tree location of a file, given a possibly
# out-of-tree reference.
canonname = $(patsubst $(srcdir)/%,%,$(call dirname,$(1)))
# Grab any CFLAGS defined by the make stub for a particular file, and
# for the directory in which the source resides.
# Always add the source directory in question for "local" includes.
# Similar for ldflags.
modcflags = $(MODCFLAGS_$(call canonname,$(1))) \
$(MODCFLAGS_$(patsubst $(srcdir)/%,%,$(1))) \
-I$(srcdir)/$(call dirname,$(1))
modldflags = $(MODLDFLAGS_$(call canonname,$(1))) \
$(MODLDFLAGS_$(patsubst $(srcdir)/%,%,$(1)))
# note: this will look better if you use two tabs instead of spaces between
# SHORT_NAME and the object
# rule for building the pvfs2 server
$(SERVER): $(SERVERBINOBJS) lib/libpvfs2-server.a
$(Q) " LD $@"
$(E)$(LD) $^ -o $@ $(SERVER_LDFLAGS) $(SERVERLIBS)
# special rules for admin tool objects which also require server components
$(ADMINOBJS_SERVER): %.o: %.c
$(Q) " CC $@"
$(E) $(CC) $(CFLAGS) $(SERVERCFLAGS) $(call modcflags,$<) $< -c -o $@
# special rules for admin tools which also require server components
$(ADMINTOOLS_SERVER): %: %.o
$(Q) " LD $@"
$(E)$(LD) $< $(LDFLAGS) $(SERVER_LDFLAGS) $(SERVERLIBS) -o $@
ifdef BUILD_BMI_ONLY
# rule for building the bmi library
lib/libbmi.a: $(LIBBMIOBJS)
$(Q) " RANLIB $@"
$(E)$(INSTALL) -d lib
$(E)ar rcs $@ $(LIBBMIOBJS)
# rule for building the shared bmi library
lib/libbmi.so: $(LIBBMIPICOBJS)
$(Q) " LDSO $@"
$(E)$(INSTALL) -d lib
$(E)$(LDSHARED) -Wl,-soname,libbmi.so -o $@ $(LIBBMIPICOBJS) $(DEPLIBS)
endif
# rule for building the pvfs2 library
lib/libpvfs2.a: $(LIBOBJS)
$(Q) " RANLIB $@"
$(E)$(INSTALL) -d lib
$(E)ar rcs $@ $(LIBOBJS)
# rule for building the _multithreaded_ pvfs2 library
lib/libpvfs2-threaded.a: $(LIBTHREADEDOBJS)
$(Q) " RANLIBTHREADED $@"
$(E)$(INSTALL) -d lib
$(E)ar rcs $@ $(LIBTHREADEDOBJS)
# rule for building the pvfs2 library
lib/libpvfs2.so: $(LIBPICOBJS)
$(Q) " LDSO $@"
$(E)$(INSTALL) -d lib
$(E)$(LDSHARED) -Wl,-soname,libpvfs2.so -o $@ $(LIBPICOBJS) $(DEPLIBS)
# rule for building the pvfs2 _multithreaded_ library
lib/libpvfs2-threaded.so: $(LIBTHREADEDPICOBJS)
$(Q) " LDSO $@"
$(E)$(INSTALL) -d lib
$(E)$(LDSHARED) -Wl,-soname,libpvfs2-threaded.so -o $@ $(LIBTHREADEDPICOBJS) $(DEPLIBS)
# rule for building the pvfs2 server library
lib/libpvfs2-server.a: $(SERVEROBJS)
$(Q) " RANLIB $@"
$(E)$(INSTALL) -d lib
$(E)ar rcs $@ $(SERVEROBJS)
# rule for building karma gui and its objects
$(KARMA): $(KARMAOBJS) $(LIBRARIES)
$(Q) " LD $@"
$(E)$(LD) -o $@ $(LDFLAGS) $(KARMAOBJS) $(LIBS) $(call modldflags,$<)
# fule for building FUSE interface and its objects
$(FUSE): $(FUSEOBJS) $(LIBRARIES)
$(Q) " LD $@"
$(E)$(LD) -o $@ $(LDFLAGS) $(FUSEOBJS) $(LIBS) $(call modldflags,$<)
# rule for building vis executables from object files
$(VISS): %: %.o $(VISMISCOBJS) $(LIBRARIES)
$(Q) " LD $@"
$(E)$(LD) -o $@ $(LDFLAGS) $< $(VISMISCOBJS) $(LIBS) $(call modldflags,$<)
# default rule for building executables from object files
%: %.o $(LIBRARIES)
$(Q) " LD $@"
$(E)$(LD) -o $@ $(LDFLAGS) $< $(LIBS) $(call modldflags,$<)
%-threaded: %.o $(LIBRARIES)
$(Q) " LD $@"
$(E)$(LD) -o $@ $(LDFLAGS) $< $(LIBS_THREADED) $(call modldflags,$<)
# rule for building server objects
%-server.o: %.c
$(Q) " CC $@"
$(E)$(CC) $(CFLAGS) $(SERVERCFLAGS) $(call modcflags,$<) $< -c -o $@
# default rule for building objects for threaded library
%-threaded.o: %.c
$(Q) " CC $@"
$(E)$(CC) $(LIBTHREADEDCFLAGS) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -c -o $@
# rule for building shared objects for threaded library
%-threaded.po: %.c
$(Q) " CCPIC $@"
$(E)$(CC) $(LIBTHREADEDCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
# default rule for building objects
%.o: %.c
$(Q) " CC $@"
$(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -c -o $@
# rule for building shared objects
%.po: %.c
$(Q) " CCPIC $@"
$(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
# c++ rule for building server objects
%-server.o: %.cpp
$(Q) " CC $@"
$(E)$(CC) $(CFLAGS) $(SERVERCFLAGS) $(call modcflags,$<) $< -c -o $@
# c++ default rule for building objects for threaded library
%-threaded.o: %.cpp
$(Q) " CC $@"
$(E)$(CC) $(LIBTHREADEDCFLAGS) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -c -o $@
# c++ rule for building shared objects for threaded library
%-threaded.po: %.cpp
$(Q) " CCPIC $@"
$(E)$(CC) $(LIBTHREADEDCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
# c++ default rule for building objects
%.o: %.cpp
$(Q) " CC $@"
$(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -c -o $@
# c++ rule for building shared objects
%.po: %.cpp
$(Q) " CCPIC $@"
$(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
# bison and yacc
%.c: %.y
$(Q) " BISON $@"
$(E)$(BISON) -d $< -o $@
%.c: %.l
$(Q) " FLEX $@"
$(E)$(FLEX) -o$@ $<
# handy rule to generate cpp-output file, for debugging
.PHONY: FORCE
%-server.i: %.c FORCE
$(Q) " CPP $@"
$(E)$(CC) $(CFLAGS) $(SERVERCFLAGS) $(call modcflags,$<) $< -E -o $@
%.i: %.c FORCE
$(Q) " CPP $@"
$(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -E -o $@
%-threaded.i: %.c FORCE
$(Q) " CPP $@"
$(E)$(CC) $(LIBTHREADEDCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -E -o $@
# all applications depend on the pvfs2 library
$(ADMINTOOLS): %: %.o $(LIBRARIES)
$(ADMINTOOLS_SERVER): %: %.o $(LIBRARIES) lib/libpvfs2-server.a
$(KERNAPPS): %: %.o $(LIBRARIES)
$(KERNAPPSTHR): %: %.o $(LIBRARIES_THREADED)
$(Q) " LD $@"
$(E)$(LD) -o $@ $(LDFLAGS) $< $(LIBS_THREADED) $(call modldflags,$<)
# special rules to build state machine compiler using build host compiler
$(STATECOMPOBJS): %.o: %.c
$(Q) " BUILD_CC $@"
$(E)$(BUILD_CC) $(BUILD_CFLAGS) $< -c -o $@ $(call modcflags,$<)
$(STATECOMP): $(STATECOMPOBJS)
$(Q) " BUILD_LD $@"
$(E)$(BUILD_LD) -o $@ $(BUILD_LDFLAGS) $(STATECOMPOBJS) $(call modldflags,$<)
# rule for generating cscope information
cscope:
find @SRC_ABSOLUTE_TOP@ -iname "*.[ch]" -o -iname "*.sm" \
> $(srcdir)/cscope.files
( cd @SRC_ABSOLUTE_TOP@; cscope -be -i @SRC_ABSOLUTE_TOP@/cscope.files )
# Build editor tags file over all source files *.[ch] *.sm and
# some known scripts. Grab the config files from the build dir.
# Ignore all generated C files by echoing them and trusting uniq to
# throw away the duplicates. Echo them twice so they do not survive
# uniq for out-of-tree builds.
tags:
( find $(addprefix $(srcdir)/,$(MODULES)) $(srcdir)/include \
$(srcdir)/src/kernel/linux-2.6 \
-maxdepth 1 -name '*.[ch]' -o -name '*.sm' ;\
find . -maxdepth 1 -name pvfs2-config.h ;\
echo $(srcdir)/src/apps/admin/pvfs2-genconfig ;\
echo $(patsubst %,./%,$(SMCGEN) $(SMCGEN)) | tr ' ' '\012' ;\
) | sort | uniq -u | ctags -L- --excmd=pattern -B --extra=+f \
--langmap=c:+.sm -I __hidden,DOTCONF_CB,nested,machine=struct
# rule for running code check
codecheck:
find $(srcdir) -iname "*.[ch]" | xargs -n 1 $(srcdir)/maint/pvfs2codecheck.pl
# target for building documentation
docs: $(DOCSPS) $(DOCSPDF) $(DOCSHTML)
publish: docs
$(srcdir)/maint/pvfs2-publish-pages `pwd`/doc
# rule for cleaning up documentation
# latex2html puts all its output in a directory
# don't get rid of generated files in dist releases
docsclean:
rm -f $(DOCSCRUFT)
ifndef DIST_RELEASE
rm -f $(DOCSPS) $(DOCSPDF)
rm -rf $(basename $(DOCSHTML))
endif
# top rule for cleaning up tree
clean::
$(Q) " CLEAN"
$(E)rm -f $(LIBOBJS) $(LIBTHREADEDOBJS) \
$(SERVEROBJS) $(SERVERBINOBJS) $(MISCOBJS) \
$(LIBRARIES) $(LIBRARIES_THREADED) $(DEPENDS) $(SERVER) \
$(ADMINOBJS) $(ADMINOBJS_SERVER) $(ADMINTOOLS)\
$(ADMINTOOLS_SERVER) lib/libpvfs2-server.a\
$(KERNAPPOBJS) $(KERNAPPS) $(KERNAPPSTHR) \
$(VISS) $(VISMISCOBJS) $(VISOBJS) $(VISDEPENDS)\
$(VISMISCDEPENDS) $(KARMAOBJS) $(LIBPICOBJS) \
$(STATECOMP) $(STATECOMPOBJS) $(LIBBMIOBJS) $(BMILIBRARIES) $(FUSEOBJS) \
$(VISMISCDEPENDS) $(KARMAOBJS) $(LIBPICOBJS)\
$(STATECOMP) $(STATECOMPOBJS) \
src/server/pvfs2-server-server.o \
src/apps/karma/karma src/apps/fuse/pvfs2fuse
ifndef DIST_RELEASE
$(E)rm -f $(STATECOMPGEN)
endif
ifneq (,$(LINUX_KERNEL_SRC))
clean::
@$(MAKE) --no-print-directory -C src/kernel/linux-2.6 clean
endif
ifneq (,$(LINUX24_KERNEL_SRC))
clean::
@$(MAKE) --no-print-directory -C src/kernel/linux-2.4 clean
endif
# builds a tarball of the source tree suitable for distribution
dist: $(SMCGEN) cleaner
@sh $(srcdir)/maint/make-dist.sh $(srcdir) @PVFS2_VERSION@
ifdef BUILD_BMI_ONLY
# builds a tarball of the BMI source tree suitable for distribution
bmidist: cleaner
@sh $(srcdir)/maint/make-bmi-dist.sh $(srcdir) $(builddir) @PVFS2_VERSION@
if test -f $(builddir)/config.save; then cp -u $(builddir)/config.save $(builddir)/config.status; fi
endif
# some stuff that is cleaned in both distclean and dist targets
cleaner: clean
rm -f tags
rm -f src/kernel/linux-2.6/Makefile
rm -f src/kernel/linux-2.4/Makefile
rm -f maint/mpi-depend.sh
rm -f examples/pvfs2-server.rc
rm -f doc/doxygen/pvfs2-doxygen.conf
rm -f examples/fs.conf
rm -rf autom4te*.cache
rm -f pvfs2-config.h.in~
rm -f $(srcdir)/cscope.out $(srcdir)/cscope.files
if test -f config.status; then cp -p config.status config.save; fi
rm -f config.log config.status config.cache
rm -f pvfs-@[email protected]
# _really_ clean the tree; should go back to pristine state
# except, don't remove generated .c files if this is a distributed release
distclean: cleaner docsclean
find . -name "module.mk" -exec rm \{\} \;
rm -f Makefile pvfs2-config.h
rm -f src/server/simple.conf
rm -f src/apps/admin/pvfs2-config
ifndef DIST_RELEASE
rm -f $(SMCGEN)
endif
# this is where we include all of our automatic dependencies.
# NOTE: we wrap this in ifneq's in order to prevent the
# dependencies from being generated for special targets that don't
# require them
ifeq (,$(filter clean distclean dist docs cscope tags nodep,$(MAKECMDGOALS)))
-include $(DEPENDS)
endif
# add this as a make goal to disable rebuilding dependencies
.PHONY: nodep
nodep:; @:
# default rule for generating dependency files
%.d: %.c
$(Q) " DEP $@"
$(E)CC="$(CC)" $(srcdir)/maint/depend.sh $(call dirname,$*) $(CFLAGS) $(DB_CFLAGS) $(call modcflags,$<) $< > $@
# default rules for building documents in .tex format:
# TODO: these documentation rules are a big hack!
%.dvi: %.tex
$(srcdir)/maint/pvfs2latexwrapper.pl -i $< -o $@
%.ps: %.dvi
( cd $(@D); dvips -t letter $(<F) -o $(@F) )
%.pdf: %.dvi
( cd $(@D); dvipdf $(<F) $(@F) )
%.html: %.tex
$(srcdir)/maint/pvfs2latexwrapper.pl -html -i $(basename $<).tex -o $@