root/branches/asyncio/Makefile.in @ 9319

Revision 9319, 44.7 KB (checked in by sdsnyde, 12 months ago)

fixed bad merge

Line 
1# Top level makefile for pvfs2
2
3###############################################################
4# LIST OF TARGETS WHICH MAY BE USED WHEN RUNNING MAKE:
5#
6# all            default rule; builds libs, server, and test programs
7# clean          cleans up files
8# develtools     builds development related tools
9# distclean      _really_ cleans up; returns to pristine tree
10# docs           builds documentation in docs subdirectory
11# docsclean      cleans up documentation files
12# publish        copy over documents to the PVFS.org web pags
13# admintools     builds admin tools
14# usertools          builds user tools
15# ucachedtools   builds ucached tools
16# kernapps       builds userland helper programs for kernel driver
17# cscope         generates information for cscope utility
18# tags           generates tags file for use by editors
19# codecheck      checks source code for nonconformance to our std.
20# kmod           builds 2.6.x kernel module
21# kmod24         builds 2.4.x kernel module
22# kmod_install   installs 2.6.x module in default module location
23# kmod24_install installs 2.4.x module in default module location
24#
25# NOTE: you can also specify any single object or executable to
26#    build by providing its name (including the relative path) as the
27#    make target
28#
29
30###############################################################
31# General documentation
32#
33# This is a single makefile that runs the entire pvfs2 build
34# process.  There are no makefiles in subdirectories.  For a
35# general introduction to this approach, please read this document
36# by Peter Miller:
37#
38# http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html
39#
40# Each subdirectory contains a module.mk file that gets included
41# when make is executed.  These module.mk files tell make about the
42# files in each subdirectory that must be built, including any
43# special case rules.  Make uses this information to generate a
44# sinle dependency graph and orchestrate the build process from this
45# top level directory.
46#
47# We categorize our source depending on what it will be used for.
48# For example, there are lists of source files for building the
49# server, building the library, building documentation, etc.
50#
51
52###############################################################
53# Generic makefile setup
54
55# define a few generic variables that we need to use; DESTDIR may
56# be overridden on the command line during make install
57DESTDIR =
58srcdir = @srcdir@
59builddir = @BUILD_ABSOLUTE_TOP@
60prefix = @prefix@
61datarootdir = @datarootdir@
62exec_prefix = @exec_prefix@
63includedir = $(DESTDIR)@includedir@
64mandir = $(DESTDIR)@mandir@
65sbindir = $(DESTDIR)@sbindir@
66bindir = $(DESTDIR)@bindir@
67libdir = $(DESTDIR)@libdir@
68sysconfdir = $(DESTDIR)@sysconfdir@
69
70VPATH = $(srcdir)
71SHELL = @SHELL@
72INSTALL = @INSTALL@
73# TODO: should probably check for bison and flex in configure
74BISON = bison
75FLEX = flex
76LN_S = ln -snf
77BUILD_BMI_TCP = @BUILD_BMI_TCP@
78BUILD_BMI_ONLY = @BUILD_BMI_ONLY@
79BUILD_GM = @BUILD_GM@
80BUILD_MX = @BUILD_MX@
81BUILD_IB = @BUILD_IB@
82BUILD_OPENIB = @BUILD_OPENIB@
83BUILD_PORTALS = @BUILD_PORTALS@
84BUILD_ZOID = @BUILD_ZOID@
85BUILD_VIS = @BUILD_VIS@
86BUILD_KARMA = @BUILD_KARMA@
87BUILD_USRINT = @BUILD_USRINT@
88BUILD_UCACHE = @BUILD_UCACHE@
89BUILD_FUSE = @BUILD_FUSE@
90BUILD_SERVER = @BUILD_SERVER@
91BUILD_TAU = @BUILD_TAU@
92BUILD_KERNEL = @BUILD_KERNEL@
93ENABLE_SECURITY = @ENABLE_SECURITY@
94NEEDS_LIBRT = @NEEDS_LIBRT@
95TARGET_OS_DARWIN = @TARGET_OS_DARWIN@
96TARGET_OS_LINUX = @TARGET_OS_LINUX@
97GNUC = @GNUC@
98INTELC = @INTELC@
99# configure default is silent, unless --enable-verbose-build in
100# which case QUIET_COMPILE will _not_ be defined.  Further allow
101# silence to be overriden with "make V=1".
102QUIET_COMPILE = @QUIET_COMPILE@
103ifdef V
104    QUIET_COMPILE = 0
105endif
106LINUX_KERNEL_SRC = @LINUX_KERNEL_SRC@
107LINUX24_KERNEL_SRC = @LINUX24_KERNEL_SRC@
108
109ifeq ($(QUIET_COMPILE),1)
110  # say a one-line description of the action, do not echo the command
111  Q=@echo
112  E=@
113else
114  # do not say the short Q lines, but do echo the entire command
115  Q=@echo >/dev/null
116  E=
117endif
118
119# build which client libs
120build_shared = @build_shared@
121build_static = @build_static@
122
123# Eliminate all default suffixes.  We want explicit control.
124.SUFFIXES:
125
126# PHONEY targets are targets that do not result in the generation
127#    of a file that has the same name as the target.  Listing them
128#    here keeps make from accidentally doing too much work (see GNU
129#    make manual).
130.PHONY: all clean develtools dist distclean docs docsclean publish cscope tags codecheck admintools kernapps usertools ucachedtools
131
132################################################################
133# Find project subdirectories
134
135# MODULES is a list of subdirectories that we wish to operate on.
136#    They are identified by the presence of module.mk files (makefile
137#    includes).
138MODULES := $(shell find . -name "*.mk" | sed -e 's/^.\///;s/module.mk//')
139
140# List of directories to search for headers.
141ifdef BUILD_BMI_ONLY
142BUILD_SERVER=""
143INCLUDES := \
144        include \
145    src/io/bmi \
146    src/common/misc \
147    src/common/quickhash \
148    src/common/quicklist \
149    src/common/id-generator \
150    src/common/gossip \
151    src/common/gen-locks \
152    src/common/events \
153    src/client/usrint
154GENINCLUDES := \
155        include
156else
157INCLUDES := \
158    src/client/sysint \
159    src/common/misc \
160    src/common/quickhash \
161    src/common/quicklist \
162    src/common/id-generator \
163    src/common/gossip \
164    src/common/gen-locks \
165    src/common/events \
166    src/common/security \
167    src/client/usrint \
168    src/io/trove \
169    src/io/bmi \
170    src/io/description \
171    src/io/buffer \
172    src/io/job \
173    src/io/dev \
174    src/proto \
175    src/common/mgmt
176GENINCLUDES := \
177        include
178endif
179
180#################################################################
181# Setup global flags
182
183# These should all be self explanatory; they are standard flags
184# for compiling and linking unless otherwise noted
185CC = @CC@
186LD = @CC@
187BUILD_CC = @BUILD_CC@
188BUILD_LD = @BUILD_CC@
189BUILD_CFLAGS = @BUILD_CFLAGS@
190BUILD_LDFLAGS = @BUILD_LDFLAGS@
191# make sure the srcdir include gets included first
192CFLAGS = -I$(srcdir)/include @CFLAGS@ @CPPFLAGS@
193LDFLAGS = -L@BUILD_ABSOLUTE_TOP@/lib
194LDFLAGS += @LDFLAGS@
195SERVER_LDFLAGS = -L@BUILD_ABSOLUTE_TOP@/lib
196SERVER_LDFLAGS += @SERVER_LDFLAGS@ @OPENSSL_LDFLAGS@
197DB_CFLAGS = @DB_CFLAGS@
198LDSHARED = $(CC) -shared -L@BUILD_ABSOLUTE_TOP@/lib
199PICFLAGS = -fPIC
200LIBS += -lpvfs2 @LIBS@
201LIBS_THREADED += -lpvfs2-threaded @LIBS@
202# need to include external dependency libs when building shared libraries
203DEPLIBS := @LIBS@
204ULIBDEPLIBS := -lpvfs2
205MMAP_RA_CACHE = @MMAP_RA_CACHE@
206TRUSTED_CONNECTIONS = @TRUSTED_CONNECTIONS@
207REDHAT_RELEASE = @REDHAT_RELEASE@
208NPTL_WORKAROUND = @NPTL_WORKAROUND@
209STRICT_CFLAGS = @STRICT_CFLAGS@
210SO_VER = @PVFS2_VERSION_MAJOR@
211SO_MINOR = @PVFS2_VERSION_MINOR@
212SO_RELEASE = @PVFS2_VERSION_SUB@
213SO_FULLVER = $(SO_VER).$(SO_MINOR).$(SO_RELEASE)
214# for Solaris:
215# LIBS += -lsocket -lnsl
216
217  # enable Flow debugging protocol
218#CFLAGS += -D__STATIC_FLOWPROTO_DUMP_OFFSETS__
219  # enable new style Flow BMI/Trove protocol
220CFLAGS += -D__STATIC_FLOWPROTO_MULTIQUEUE__
221  # turn on large file support by default
222CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
223  # define __GNU_SOURCE in includes to replace incorrect usage of __USE_GNU
224CFLAGS += -D_GNU_SOURCE
225  # include current directory (for pvfs2-config.h)
226CFLAGS += -I .
227  # include toplevel source dir
228CFLAGS += -I $(srcdir)
229  # add selected include directories
230CFLAGS += $(patsubst %,-I$(srcdir)/%,$(INCLUDES))
231CFLAGS += $(patsubst %,-I$(builddir)/%,$(GENINCLUDES))
232
233  # add package version information
234CFLAGS += -DPVFS2_VERSION="\"@PVFS2_VERSION@\""
235
236  # make bindir and sysconfdir available to source files
237CFLAGS += -DBINDIR='"$(bindir)"' -DSYSCONFDIR='"$(sysconfdir)"'
238
239  # OpenSLL support
240CFLAGS += @OPENSSL_CPPFLAGS@
241
242# always want these gcc flags
243GCC_CFLAGS := -pipe -Wall -Wstrict-prototypes
244
245ifneq (,$(STRICT_CFLAGS))
246    GCC_CFLAGS += -Wcast-align -Wbad-function-cast
247    GCC_CFLAGS += -Wmissing-prototypes -Wmissing-declarations
248    GCC_CFLAGS += -Wundef -Wpointer-arith
249    GCC_CFLAGS += -Wnested-externs
250    GCC_CFLAGS += -Wredundant-decls
251    # These are very noisy, and probably too strict.
252    #GCC_CFLAGS += -W -Wno-unused -Wno-sign-compare
253    #GCC_CFLAGS += -Wcast-qual
254    #GCC_CFLAGS += -Wshadow
255    #GCC_CFLAGS += -Wwrite-strings
256else
257    # these are noisy but come with Wall
258    # use strict if you want them on
259    #GCC_CFLAGS += -Wno-unused-value
260    #GCC_CFLAGS += -Wno-unused-result
261    #GCC_CFLAGS += -Wno-unused-but-set-variable
262    #GCC_CFLAGS += -Wno-unused-but-set-parameter
263endif
264
265# Intel cc options, enable all warnings, then disable some
266INTEL_CFLAGS := -Wall
267# #279: controlling expression is constant
268# shows up in ifdefs such as "do { ... } while (0)" construct
269INTEL_CFLAGS += -wd279
270# #424: extra ";" ignored e.g. in endecode_fields_2(); usage
271INTEL_CFLAGS += -wd424
272# #188: enumerated type mixed with another type, like flag |= ENUM_VALUE;
273# bogus compiler warning
274INTEL_CFLAGS += -wd188
275# #981: operands are evaluated in unspecified order, like printf that
276# uses functions to get some values; unimportant.
277INTEL_CFLAGS += -wd981
278
279# do not disable these if strict, i.e. enable some more warnings
280ifeq (,$(STRICT_CFLAGS))
281    # #1419: external declaration in primary source file; would be good
282    # to get rid of these someday
283    INTEL_CFLAGS += -wd1419
284    # #1419: external definition with no prior declaration; most of these
285    # want to be static
286    INTEL_CFLAGS += -wd1418
287    # #181: argument is incompatible with corresponding format string
288    # conversion; investigate someday.
289    INTEL_CFLAGS += -wd181
290    # #869: parameter .. was never referenced, like -Wunused
291    INTEL_CFLAGS += -wd869
292    # #810: conversion from .. to .. may lose significant bits; investigate
293    # but probably harmless
294    INTEL_CFLAGS += -wd810
295endif
296
297################################################################
298# Setup component specific flags
299
300# the server can use a threaded trove and job configuration.
301# Working combinations of trove/job thread configurations
302# are as follows:
303#
304# NOTE: __PVFS2_TROVE_SUPPORT__, and __GEN_POSIX_LOCKING__
305# are required for all server configurations
306#
307# config 1)
308# =========
309# __PVFS2_TROVE_THREADED__
310# __PVFS2_JOB_THREADED__
311# __PVFS2_TROVE_AIO_THREADED__ (auto detected MISC_TROVE_FLAGS)
312# e.g.
313#
314#SERVERCFLAGS = -D__GEN_POSIX_LOCKING__ -D__PVFS2_JOB_THREADED__ \
315#-D__PVFS2_TROVE_THREADED__ @MISC_TROVE_FLAGS@ \
316#-D__PVFS2_TROVE_SUPPORT__
317#
318# config 2)
319# =========
320# __PVFS2_TROVE_THREADED__
321# __PVFS2_JOB_THREADED__
322# e.g.
323#
324#SERVERCFLAGS = -D__GEN_POSIX_LOCKING__ -D__PVFS2_JOB_THREADED__ \
325#-D__PVFS2_TROVE_THREADED__ -D__PVFS2_TROVE_SUPPORT__
326#
327# config 3)
328# =========
329# none (non-threaded)
330# e.g.
331#
332#SERVERCFLAGS = -D__GEN_POSIX_LOCKING__ -D__PVFS2_TROVE_SUPPORT__
333
334SERVERCFLAGS = @CFLAGS@ -D__GEN_POSIX_LOCKING__ -D__PVFS2_JOB_THREADED__ \
335-D__PVFS2_TROVE_THREADED__ @MISC_TROVE_FLAGS@ @DB_CFLAGS@ \
336-D__PVFS2_TROVE_SUPPORT__ -D__PVFS2_SERVER__
337
338# server side flow protocol connecting BMI with NCAC cache
339SERVERCFLAGS += -D__STATIC_FLOWPROTO_BMI_CACHE__
340
341# OpenSSL support
342SERVERCFLAGS += @OPENSSL_CPPFLAGS@
343
344SERVERLIBS = -lpvfs2-server @LIBS@ @DB_LIB@ @OPENSSL_LIB@ -lpthread
345
346ifdef NEEDS_LIBRT
347        SERVERLIBS += -lrt
348endif
349
350# you can optionally disable thread safety support in the client
351# though it's not recommended unless *required*.
352#
353# run ./configure --help for information on how to do this cleanly.
354LIBCFLAGS=@LIBCFLAGS@ @OPENSSL_CPPFLAGS@ -D__PVFS2_CLIENT__
355LIBTHREADEDCFLAGS=-D__GEN_POSIX_LOCKING__ -D__PVFS2_JOB_THREADED__ -D__PVFS2_CLIENT__
356LIBS += @THREAD_LIB@ @OPENSSL_LIB@
357DEPLIBS += @THREAD_LIB@ @OPENSSL_LIB@
358LIBS_THREADED += @THREAD_LIB@ @OPENSSL_LIB@
359
360################################################################
361# build BMI TCP?
362
363ifdef BUILD_BMI_TCP
364        CFLAGS += -D__STATIC_METHOD_BMI_TCP__
365endif
366
367
368################################################################
369# enable GM if configure detected it
370
371ifdef BUILD_GM
372    # other settings in bmi_gm/module.mk.in
373    CFLAGS += -D__STATIC_METHOD_BMI_GM__
374    GMLIBS := -L@GM_LIBDIR@ -lgm
375    LIBS += $(GMLIBS)
376    DEPLIBS += $(GMLIBS)
377    LIBS_THREADED += $(GMLIBS)
378    SERVERLIBS += $(GMLIBS)
379endif
380
381################################################################
382# enable MX if configure detected it
383
384ifdef BUILD_MX
385    # other settings in bmi_mx/module.mk.in
386    CFLAGS += -D__STATIC_METHOD_BMI_MX__
387    MXLIBS := -L@MX_LIBDIR@ -lmyriexpress -lpthread
388    LIBS += $(MXLIBS)
389    DEPLIBS += $(MXLIBS)
390    LIBS_THREADED += $(MXLIBS)
391    SERVERLIBS += $(MXLIBS)
392endif
393
394#####################################
395# enable IB if configure requested it
396
397ifdef BUILD_IB
398    # other settings in bmi_ib/module.mk.in
399    CFLAGS += -D__STATIC_METHOD_BMI_IB__
400    IBLIBS := -L@IB_LIBDIR@ \
401              -lvapi -lmtl_common -lmosal -lmpga -lpthread -ldl
402    LIBS += $(IBLIBS)
403    DEPLIBS += $(IBLIBS)
404    LIBS_THREADED += $(IBLIBS)
405    SERVERLIBS += $(IBLIBS)
406endif
407
408ifdef BUILD_OPENIB
409ifndef BUILD_IB
410    CFLAGS += -D__STATIC_METHOD_BMI_IB__
411endif
412    OPENIBLIBS := -L@OPENIB_LIBDIR@ -libverbs
413    LIBS += $(OPENIBLIBS)
414    DEPLIBS += $(OPENIBLIBS)
415    LIBS_THREADED += $(OPENIBLIBS)
416    SERVERLIBS += $(OPENIBLIBS)
417endif
418
419# Portals
420ifdef BUILD_PORTALS
421    CFLAGS += -D__STATIC_METHOD_BMI_PORTALS__
422ifneq (,@PORTALS_LIBS@)
423    PORTALS_LIBS := @PORTALS_LIBS@
424    LIBS += $(PORTALS_LIBS)
425    DEPLIBS += $(PORTALS_LIBS)
426    LIBS_THREADED += $(PORTALS_LIBS)
427    SERVERLIBS += $(PORTALS_LIBS)
428endif
429endif
430
431ifdef BUILD_ZOID
432    CFLAGS += -D__STATIC_METHOD_BMI_ZOID__
433endif
434
435# enable mmap-readahead cache (unless disabled by configure)
436ifdef MMAP_RA_CACHE
437CFLAGS += @MMAP_RA_CACHE@
438endif
439
440# enable trusted connections (unless disabled by configure)
441ifdef TRUSTED_CONNECTIONS
442CFLAGS += @TRUSTED_CONNECTIONS@
443endif
444
445# enable redhat-release patches (if detected and if any)
446ifdef REDHAT_RELEASE
447CFLAGS += @REDHAT_RELEASE@
448endif
449
450# Add gcc-specific flags if we know it is a gnu compiler.
451ifdef GNUC
452CFLAGS += $(GCC_CFLAGS)
453endif
454ifdef INTELC
455CFLAGS += $(INTEL_CFLAGS)
456endif
457
458#################################################################
459# Starter variables
460
461# NOTES: These variables are used to categorize the various source
462#    files.  We let the makefile includes append to them so that we
463#    gradually build up a list of source files without having to
464#    list them all at the top level.
465
466# ADMINSRC is source code for administrative programs
467ADMINSRC :=
468# ADMINSRC_SERVER special version of ADMINSRC for tools that need server
469# library
470ADMINSRC_SERVER :=
471# usRSRC is source code for userland programs
472USERSRC :=
473# LIBSRC is source code for libpvfs2
474LIBSRC :=
475# ULIBSRC is source code for libofs
476ULIBSRC :=
477# UCACHEDSRC is source code for ucached programs
478UCACHEDSRC :=
479# SERVERSRC is souce code for the pvfs2 server
480SERVERSRC :=
481ifdef BUILD_BMI_ONLY
482# LIBBMISRC is source code for libbmi
483LIBBMISRC :=
484endif
485# SERVERBINSRC is source files that don't get added to the server library but must be added to the server binary
486SERVERBINSRC :=
487# DOCSRC is source code for documentation
488DOCSRC :=
489# VISSRC is the source code for visualization tools
490VISSRC :=
491# VISMISCSRC is a collection of sources that must be built into objects for
492#    visualization tools
493VISMISCSRC :=
494# KARMASRC is source for the karma gui
495KARMASRC :=
496# FUSESRC is source for the FUSE interface daemon
497FUSESRC :=
498# userland helper programs for kernel drivers
499KERNAPPSRC :=
500KERNAPPTHRSRC :=
501# MISCSRC are sources that don't fall into the other categories
502MISCSRC :=
503# c files generated from state machines
504SMCGEN :=
505# DEVELSRC is source for development related tools
506DEVELSRC :=
507
508################################################################
509# Top level (default) targets
510
511ifdef BUILD_SERVER
512# SERVER_STUB is a wrapper script that export the LD_ASSUME_KERNEL variable for
513#    systems with buggy NPTL/Pthread implementations, such as early RedHat
514#    EL 3 distributions
515SERVER_STUB := src/server/pvfs2-server-stub
516# SERVER is the pvfs2 server
517SERVER := src/server/pvfs2-server
518endif
519
520# LIBRARIES is a list of the pvfs2 client libraries that will be installed
521LIBRARIES_STATIC := lib/libpvfs2.a lib/liborange.a
522LIBRARIES_SHARED := lib/libpvfs2.so lib/liborange.so
523LIBRARIES_THREADED_STATIC := lib/libpvfs2-threaded.a
524LIBRARIES_THREADED_SHARED := lib/libpvfs2-threaded.so
525
526ifdef BUILD_BMI_ONLY
527LIBRARIES_STATIC += lib/libbmi.a
528LIBRARIES_SHARED += lib/libbmi.so
529BMILIBRARIES := lib/libbmi.a lib/libbmi.so
530endif
531
532ifdef BUILD_USRINT
533LIBRARIES_STATIC += lib/libofs.a lib/liborangepre.a
534LIBRARIES_SHARED += lib/libofs.so lib/liborangepre.so
535LIBRARIES_THREADED_STATIC += lib/libofs-threaded.a
536LIBRARIES_THREADED_SHARED += lib/libofs-threaded.so
537endif
538
539ifneq ($(build_static),yes)
540LIBRARIES_STATIC :=
541LIBRARIES_THREADED_STATIC :=
542endif
543
544ifneq ($(build_shared),yes)
545LIBRARIES_SHARED :=
546LIBRARIES_THREADED_SHARED :=
547endif
548
549LIBRARIES_THREADED := $(LIBRARIES_THREADED_STATIC) $(LIBRARIES_THREADED_SHARED)
550LIBRARIES := $(LIBRARIES_SHARED) $(LIBRARIES_STATIC) $(LIBRARIES_THREADED)
551
552
553################################################################
554# Default target forward pointer, to avoid other targets in make stubs
555all::
556
557################################################################
558# Makefile includes
559
560# this is how we pull build information from all of the project
561#    subdirectories, make sure to catch top level module.mk as well
562include module.mk
563include $(patsubst %, %/module.mk, $(MODULES))
564
565################################################################
566# Derived file lists
567
568# NOTES: At this point, the subdirectory makefile includes have informed
569#    us what the source files are.  Now we want to generate some
570#    other lists (such as objects, executables, and dependency files)
571#    by manipulating the lists of source files
572
573# LIBOBJS is a list of objects to put in the client lib
574LIBOBJS := $(patsubst %.c,%.o, $(filter %.c,$(LIBSRC)))
575# ULIBOBJS is a list of objects to put in the ofs lib
576ULIBOBJS := $(patsubst %.c,%.o, $(filter %.c,$(ULIBSRC)))
577# LIBPICOBJS are the same, but compiled for use in a shared library
578LIBPICOBJS := $(patsubst %.c,%.po, $(filter %.c,$(LIBSRC)))
579# ULIBPICOBJS are the same, but compiled for use in a shared library
580ULIBPICOBJS := $(patsubst %.c,%.po, $(filter %.c,$(ULIBSRC)))
581# LIBDEPENDS is a list of dependency files for the client lib
582LIBDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(LIBSRC)))
583# ULIBDEPENDS is a list of dependency files for the client lib
584ULIBDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(ULIBSRC)))
585
586ifdef BUILD_BMI_ONLY
587# LIBBMIOBJS is a list of objects to put in the bmi lib
588LIBBMIOBJS := $(patsubst %.c,%.o, $(filter %.c,$(LIBBMISRC)))
589# LIBBMIPICOBJS are the same, but compiled for use in a shared library
590LIBBMIPICOBJS := $(patsubst %.c,%.po, $(filter %.c,$(LIBBMISRC)))
591# LIBBMIDEPENDS is a list of dependency files for the bmi lib
592LIBBMIDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(LIBBMISRC)))
593endif
594
595# LIBTHREADEDOBJS is a list of objects to put in the multithreaded client lib
596LIBTHREADEDOBJS := $(patsubst %.c,%-threaded.o, $(filter %.c,$(LIBSRC)))
597# ULIBTHREADEDOBJS is a list of objects to put in the multithreaded ofs lib
598ULIBTHREADEDOBJS := $(patsubst %.c,%-threaded.o, $(filter %.c,$(ULIBSRC)))
599
600# LIBTHREADEDPICOBJS are the same, but compiled for use in a shared library
601LIBTHREADEDPICOBJS := $(patsubst %.c,%-threaded.po, $(filter %.c,$(LIBSRC)))
602# ULIBTHREADEDPICOBJS are the same, but compiled for use in a shared ofs library
603ULIBTHREADEDPICOBJS := $(patsubst %.c,%-threaded.po, $(filter %.c,$(ULIBSRC)))
604
605# LIBTHREADEDDEPENDS is a list of dependency files for the multithreaded client lib
606LIBTHREADEDDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(LIBSRC)))
607# ULIBTHREADEDDEPENDS is a list of dependency files for the # multithreaded ofs lib
608ULIBTHREADEDDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(ULIBSRC)))
609
610# ADMINOBJS is a list of admin program objects
611ADMINOBJS := $(patsubst %.c,%.o, $(filter %.c,$(ADMINSRC)))
612# ADMINTOOLS is a list of admin program executables
613ADMINTOOLS := $(patsubst %.c,%, $(filter %.c, $(ADMINSRC)))
614# ADMINDEPENDS is a list of dependency files for admin programs
615ADMINDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(ADMINSRC)))
616#
617# USEROBJS is a list of user program objects
618USEROBJS := $(patsubst %.c,%.o, $(filter %.c,$(USERSRC)))
619# USERTOOLS is a list of user program executables
620USERTOOLS := $(patsubst %.c,%, $(filter %.c, $(USERSRC)))
621# USERDEPENDS is a list of dependency files for user programs
622USERDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(USERSRC)))
623
624# UCACHEDOBJS is a list of ucached program objects
625UCACHEDOBJS := $(patsubst %.c,%.o, $(filter %.c,$(UCACHEDSRC)))
626# UCACHEDTOOLS is a list of ucached program executables
627UCACHEDTOOLS := $(patsubst %.c,%, $(filter %.c, $(UCACHEDSRC)))
628# UCACHEDDEPENDS is a list of dependency files for ucached programs
629UCACHEDDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(UCACHEDSRC)))
630
631ifdef BUILD_SERVER
632    ADMINOBJS_SERVER := $(patsubst %.c,%.o, $(filter %.c,$(ADMINSRC_SERVER)))
633    ADMINTOOLS_SERVER := $(patsubst %.c,%, $(filter %.c, $(ADMINSRC_SERVER)))
634    ADMINDEPENDS_SERVER := $(patsubst %.c,%.d, $(filter %.c,$(ADMINSRC_SERVER)))
635    # SERVEROBJS is a list of objects to put into the server
636    SERVEROBJS := $(patsubst %.c,%-server.o, $(filter %.c,$(SERVERSRC)))
637    # SERVERDEPENDS is a list of dependency files for the server
638    SERVERDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(SERVERSRC)))
639    # SERVERBINOBJS is a list of objects not in SERVEROBJS to put into the server
640    SERVERBINOBJS := $(patsubst %.c,%-server.o, $(filter %.c,$(SERVERBINSRC)))
641    SERVERBINDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(SERVERBINSRC)))
642endif
643
644# MISCOBJS is a list of misc. objects not in the above categories
645MISCOBJS := $(patsubst %.c,%.o, $(filter %.c,$(MISCSRC)))
646# MISCDEPENDS is a list of dependency files for misc. objects
647MISCDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(MISCSRC)))
648
649# KERNAPPOBJS is a list of kernel driver userland objects
650KERNAPPOBJS := $(patsubst %.c,%.o, $(filter %.c,$(KERNAPPSRC))) \
651               $(patsubst %.c,%-threaded.o, $(filter %.c,$(KERNAPPTHRSRC)))
652# KERNAPPS is a list of kernel driver userland executables
653KERNAPPS := $(patsubst %.c,%, $(filter %.c, $(KERNAPPSRC)))
654KERNAPPSTHR := $(patsubst %.c,%, $(filter %.c, $(KERNAPPTHRSRC)))
655# KERNAPPDEPENDS is a list of dependency files for kernel driver userland
656# objects
657KERNAPPDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(KERNAPPSRC) $(KERNAPPTHRSRC)))
658# Be sure to build/install the threaded lib too; just pick the shared
659# one if configure asked for both.
660ifneq (,$(KERNAPPSTHR))
661ifeq (,$(filter $(firstword $(LIBRARIES_THREADED)),$(LIBRARIES)))
662LIBRARIES += $(firstword $(LIBRARIES_THREADED))
663endif
664endif
665
666# VISOBJS is a list of visualization program objects
667VISOBJS := $(patsubst %.c,%.o, $(filter %.c,$(VISSRC)))
668# VISS is a list of visualization program executables
669VISS := $(patsubst %.c,%, $(filter %.c, $(VISSRC)))
670# VISDEPENDS is a list of dependency files for visualization programs
671VISDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(VISSRC)))
672# VISMISCOBJS is a list of misc. vis objects not in the above categories
673VISMISCOBJS := $(patsubst %.c,%.o, $(filter %.c,$(VISMISCSRC)))
674# VISMISCDEPENDS is a list of dependency files for vis misc. objects
675VISMISCDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(VISMISCSRC)))
676
677# KARMAOBJS, KARMADEPENDS for the karma gui (requires gtk2.0)
678KARMAOBJS := $(patsubst %.c,%.o, $(filter %.c,$(KARMASRC)))
679KARMADEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(KARMASRC)))
680
681# FUSEOBJS
682FUSEOBJS := $(patsubst %.c,%.o, $(filter %.c,$(FUSESRC)))
683FUSEDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(FUSESRC)))
684
685# state machine generation tool, built for the build machine, not the
686# host machine, in the case of cross-compilation
687STATECOMPOBJS := $(patsubst %.c,%.o,$(STATECOMPSRC))
688STATECOMPDEPS := $(patsubst %.c,%.d,$(STATECOMPSRC))
689
690# DOCSPDF, DOCSPS, and DOCSHTML are lists of documentation files generated
691#   from latex
692DOCSPDF := $(patsubst %.tex,%.pdf, $(filter %.tex,$(DOCSRC)))
693DOCSPS := $(patsubst %.tex,%.ps, $(filter %.tex,$(DOCSRC)))
694DOCSHTML := $(patsubst %.tex,%.html, $(filter %.tex,$(DOCSRC)))
695
696# DOCSCRUFT is a list of intermediate files generated by latex
697DOCSCRUFT := $(patsubst %.tex,%.aux, $(filter %.tex,$(DOCSRC)))
698DOCSCRUFT += $(patsubst %.tex,%.dvi, $(filter %.tex,$(DOCSRC)))
699DOCSCRUFT += $(patsubst %.tex,%.log, $(filter %.tex,$(DOCSRC)))
700DOCSCRUFT += $(patsubst %.tex,%.toc, $(filter %.tex,$(DOCSRC)))
701
702# DEVELOBJS is a list of development program objects
703DEVELOBJS := $(patsubst %.c,%.o, $(filter %.c,$(DEVELSRC)))
704# DEVELTOOLS is a list of development program executables
705DEVELTOOLS := $(patsubst %.c,%, $(filter %.c, $(DEVELSRC)))
706# DEVELDEPENDS is a list of dependency files for development programs
707DEVELDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(DEVELSRC)))
708
709# DEPENDS is a global list of all of our dependency files. 
710# NOTE: sort is just a trick to remove duplicates; the order
711#   doesn't matter at all.
712ifdef BUILD_BMI_ONLY
713DEPENDS := $(sort $(LIBBMIDEPENDS))
714else
715DEPENDS := $(sort $(LIBDEPENDS) $(SERVERDEPENDS) \
716    $(SERVERBINDEPENDS) $(MISCDEPENDS) $(USERDEPENDS) \
717    $(ADMINDEPENDS) $(ADMINDEPENDS_SERVER) $(KERNAPPDEPENDS) \
718    $(VISDEPENDS) $(VISMISCDEPENDS) $(KARMADEPENDS) \
719    $(STATECOMPDEPS) $(FUSEDEPENDS) $(UCACHEDDEPENDS) )
720endif
721
722####################################################################
723# Rules and dependencies
724
725# default rule builds server, library, and applications
726ifdef BUILD_BMI_ONLY
727all:: $(BMILIBRARIES)
728else
729all:: $(SERVER) $(KARMA) $(LIBRARIES) admintools usertools ucachedtools $(VISS) $(KARMA) $(FUSE)
730endif
731
732# target for building admin tools
733admintools: $(ADMINTOOLS) $(ADMINTOOLS_SERVER)
734
735#target for building user tools
736usertools: $(USERTOOLS)
737
738# target for building ucached tools
739ucachedtools: $(UCACHEDTOOLS)
740
741# target for building kernel driver userland programs
742kernapps: $(KERNAPPS) $(KERNAPPSTHR)
743
744# this is needed for the make dist
745statecompgen: $(STATECOMPGEN)
746
747# target for builging development tools
748develtools: $(DEVELTOOLS)
749
750# Build linux-2.6 kernel module if requested.
751# Can't use the actual file target since we don't know how to figure out
752# dependencies---only the kernel source tree can do that.
753ifneq (,$(LINUX_KERNEL_SRC))
754.PHONY: kmod
755kmod: just_kmod kernapps
756just_kmod:
757        @$(MAKE) --no-print-directory -C src/kernel/linux-2.6
758endif
759
760# Build linux-2.4 kernel module if requested.
761ifneq (,$(LINUX24_KERNEL_SRC))
762.PHONY: kmod24
763kmod24: just_kmod24 kernapps
764just_kmod24:
765        @$(MAKE) --no-print-directory -C src/kernel/linux-2.4
766endif
767
768# Just like dir, but strip the slash off the end, to be pretty.
769dirname = $(patsubst %/,%,$(dir $(1)))
770
771# Generate the canonical in-tree location of a file, given a possibly
772# out-of-tree reference.
773canonname = $(patsubst $(srcdir)/%,%,$(call dirname,$(1)))
774
775# Grab any CFLAGS defined by the make stub for a particular file, and
776# for the directory in which the source resides.
777# Always add the source directory in question for "local" includes.
778# Similar for ldflags.
779modcflags = $(MODCFLAGS_$(call canonname,$(1))) \
780            $(MODCFLAGS_$(patsubst $(srcdir)/%,%,$(1))) \
781            -I$(srcdir)/$(call dirname,$(1))
782modldflags = $(MODLDFLAGS_$(call canonname,$(1))) \
783             $(MODLDFLAGS_$(patsubst $(srcdir)/%,%,$(1)))
784
785# note: this will look better if you use two tabs instead of spaces between
786# SHORT_NAME and the object
787
788# rule for building the pvfs2 server
789$(SERVER): $(SERVERBINOBJS) lib/libpvfs2-server.a
790        $(Q) "  LD              $@"
791        $(E)$(LD) $^ -o $@ $(SERVER_LDFLAGS) $(SERVERLIBS)
792
793# special rules for admin tool objects which also require server components
794$(ADMINOBJS_SERVER): %.o: %.c
795        $(Q) "  CC              $@"
796        $(E) $(CC) $(CFLAGS) $(SERVERCFLAGS) $(call modcflags,$<) $< -c -o $@
797
798# special rules for admin tools which also require server components
799$(ADMINTOOLS_SERVER): %: %.o
800        $(Q) "  LD              $@"
801        $(E)$(LD) $< $(LDFLAGS) $(SERVER_LDFLAGS) $(SERVERLIBS) -o $@
802
803ifdef BUILD_BMI_ONLY
804# rule for building the bmi library
805lib/libbmi.a: $(LIBBMIOBJS)
806        $(Q) "  RANLIB  $@"
807        $(E)$(INSTALL) -d lib
808        $(E)ar rcs $@ $(LIBBMIOBJS)
809
810# rule for building the shared bmi library
811lib/libbmi.so: $(LIBBMIPICOBJS)
812        $(Q) "  LDSO            $@"
813        $(E)$(INSTALL) -d lib
814        $(E)$(LDSHARED) -Wl,-soname,libbmi.so -o $@ $(LIBBMIPICOBJS) $(DEPLIBS)
815endif
816
817# rule for building the pvfs2 library
818lib/libpvfs2.a: $(LIBOBJS)
819        $(Q) "  RANLIB  $@"
820        $(E)$(INSTALL) -d lib
821        $(E)ar rcs $@ $(LIBOBJS)
822
823# rule for building the _multithreaded_ pvfs2 library
824lib/libpvfs2-threaded.a: $(LIBTHREADEDOBJS)
825        $(Q) "  RANLIBTHREADED  $@"
826        $(E)$(INSTALL) -d lib
827        $(E)ar rcs $@ $(LIBTHREADEDOBJS)
828
829# rule for building the shared pvfs2 library
830lib/libpvfs2.so: $(LIBPICOBJS)
831        $(Q) "  LDSO            $@"
832        $(E)$(INSTALL) -d lib
833        $(E)$(LDSHARED) -Wl,-soname,libpvfs2.so -o $@ $(LIBPICOBJS) $(DEPLIBS)
834
835# rule for building the shared pvfs2 _multithreaded_ library
836lib/libpvfs2-threaded.so: $(LIBTHREADEDPICOBJS)
837        $(Q) "  LDSO            $@"
838        $(E)$(INSTALL) -d lib
839        $(E)$(LDSHARED) -Wl,-soname,libpvfs2-threaded.so -o $@ $(LIBTHREADEDPICOBJS) $(DEPLIBS)
840
841# rule for building the ofs library
842lib/libofs.a: $(ULIBOBJS)
843        $(Q) "  RANLIB  $@"
844        $(E)$(INSTALL) -d lib
845        $(E)ar rcs $@ $(ULIBOBJS)
846
847# rule for building the _multithreaded_ ofs library
848lib/libofs-threaded.a: $(ULIBTHREADEDOBJS)
849        $(Q) "  RANLIBTHREADED  $@"
850        $(E)$(INSTALL) -d lib
851        $(E)ar rcs $@ $(ULIBTHREADEDOBJS)
852
853# rule for building the shared ofs library
854lib/libofs.so: $(ULIBPICOBJS)
855        $(Q) "  LDSO            $@"
856        $(E)$(INSTALL) -d lib
857        $(E)$(LDSHARED) -Wl,-soname,libofs.so -o $@ $(ULIBPICOBJS) $(ULIBDEPLIBS) $(DEPLIBS)
858
859# rule for building the shared ofs _multithreaded_ library
860lib/libofs-threaded.so: $(ULIBTHREADEDPICOBJS)
861        $(Q) "  LDSO            $@"
862        $(E)$(INSTALL) -d lib
863        $(E)$(LDSHARED) -Wl,-soname,libofs-threaded.so -o $@ $(ULIBTHREADEDPICOBJS) $(ULIBDEPLIBS) $(DEPLIBS)
864
865# rules for building virtual libraries
866lib/liborange.a: lib/libpvfs2.a
867        $(Q) "  VLIB            $@"
868        $(E)printf "GROUP ( -rdynamic $(LIBS) )\n" > lib/liborange.a
869
870lib/liborange.so: lib/libpvfs2.so
871        $(Q) "  VLIB            $@"
872        $(E)printf "GROUP ( -rdynamic $(LIBS) )\n" > lib/liborange.so
873
874lib/liborangepre.a: lib/libpvfs2.a
875        $(Q) "  VLIB            $@"
876        $(E)printf "GROUP ( -lofs -rdynamic $(LIBS) )\n" > lib/liborangepre.a
877
878lib/liborangepre.so: lib/libpvfs2.so
879        $(Q) "  VLIB            $@"
880        $(E)printf "GROUP ( -lofs -rdynamic $(LIBS) )\n" > lib/liborangepre.so
881
882# rule for building the pvfs2 server library
883lib/libpvfs2-server.a: $(SERVEROBJS)
884        $(Q) "  RANLIB  $@"
885        $(E)$(INSTALL) -d lib
886        $(E)ar rcs $@ $(SERVEROBJS)
887
888# rule for building karma gui and its objects
889$(KARMA): $(KARMAOBJS) $(LIBRARIES)
890        $(Q) "  LD              $@"
891        $(E)$(LD) -o $@ $(LDFLAGS) $(KARMAOBJS) $(LIBS) $(call modldflags,$<)
892
893# fule for building FUSE interface and its objects
894$(FUSE): $(FUSEOBJS) $(LIBRARIES)
895        $(Q) " LD               $@"
896        $(E)$(LD) -o $@ $(LDFLAGS) $(FUSEOBJS) $(LIBS) $(call modldflags,$<)
897
898# rule for building vis executables from object files
899$(VISS): %: %.o $(VISMISCOBJS) $(LIBRARIES)
900        $(Q) "  LD              $@"
901        $(E)$(LD) -o $@ $(LDFLAGS) $< $(VISMISCOBJS) $(LIBS) $(call modldflags,$<)
902
903# rule for building development tools and its objects. don't know why db isn't
904# already in libs.
905$(DEVELTOOLS): $(DEVELOBJS) $(LIBRARIES)
906        $(Q) "  LD              $@"
907        $(E)$(LD) -o $@ $(LDFLAGS) $(DEVELOBJS) $(LIBS) -ldb $(call modldflags,$<)
908
909# default rule for building executables from object files
910%: %.o $(LIBRARIES)
911        $(Q) "  LD              $@"
912        $(E)$(LD) -o $@ $(LDFLAGS) $< $(LIBS) $(call modldflags,$<)
913
914%-threaded: %.o $(LIBRARIES)
915        $(Q) "  LD              $@"
916        $(E)$(LD) -o $@ $(LDFLAGS) $< $(LIBS_THREADED) $(call modldflags,$<)
917
918# rule for building server objects
919%-server.o: %.c
920        $(Q) "  CC              $@"
921        $(E)$(CC) $(CFLAGS) $(SERVERCFLAGS) $(call modcflags,$<) $< -c -o $@
922
923# default rule for building objects for threaded library
924%-threaded.o: %.c
925        $(Q) "  CC              $@"
926        $(E)$(CC) $(LIBTHREADEDCFLAGS) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -c -o $@
927
928# rule for building shared objects for threaded library
929%-threaded.po: %.c
930        $(Q) "  CCPIC           $@"
931        $(E)$(CC) $(LIBTHREADEDCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
932
933# default rule for building objects
934%.o: %.c
935        $(Q) "  CC              $@"
936        $(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -c -o $@
937
938# rule for building shared objects
939%.po: %.c
940        $(Q) "  CCPIC           $@"
941        $(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
942
943# c++ rule for building server objects
944%-server.o: %.cpp
945        $(Q) "  CC              $@"
946        $(E)$(CC) $(CFLAGS) $(SERVERCFLAGS) $(call modcflags,$<) $< -c -o $@
947
948# c++ default rule for building objects for threaded library
949%-threaded.o: %.cpp
950        $(Q) "  CC              $@"
951        $(E)$(CC) $(LIBTHREADEDCFLAGS) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -c -o $@
952
953# c++ rule for building shared objects for threaded library
954%-threaded.po: %.cpp
955        $(Q) "  CCPIC           $@"
956        $(E)$(CC) $(LIBTHREADEDCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
957
958# c++ default rule for building objects
959%.o: %.cpp
960        $(Q) "  CC              $@"
961        $(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -c -o $@
962
963# c++ rule for building shared objects
964%.po: %.cpp
965        $(Q) "  CCPIC           $@"
966        $(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
967
968# bison and yacc
969%.c: %.y
970        $(Q) "  BISON           $@"
971        $(E)$(BISON) -d $< -o $@
972
973%.c: %.l
974        $(Q) "  FLEX            $@"
975        $(E)$(FLEX) -o$@ $<
976
977# handy rule to generate cpp-output file, for debugging
978.PHONY: FORCE
979%-server.i: %.c FORCE
980        $(Q) "  CPP             $@"
981        $(E)$(CC) $(CFLAGS) $(SERVERCFLAGS) $(call modcflags,$<) $< -E -o $@
982
983%.i: %.c FORCE
984        $(Q) "  CPP             $@"
985        $(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -E -o $@
986
987%-threaded.i: %.c FORCE
988        $(Q) "  CPP             $@"
989        $(E)$(CC) $(LIBTHREADEDCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -E -o $@
990
991# all applications depend on the pvfs2 library
992$(ADMINTOOLS): %: %.o $(LIBRARIES)
993$(ADMINTOOLS_SERVER): %: %.o $(LIBRARIES) lib/libpvfs2-server.a
994
995$(USERTOOLS): %: %.o $(LIBRARIES)
996
997$(UCACHEDTOOLS): %: %.o $(LIBRARIES)
998
999$(KERNAPPS): %: %.o $(LIBRARIES)
1000$(KERNAPPSTHR): %: %.o $(LIBRARIES_THREADED)
1001        $(Q) "  LD              $@"
1002        $(E)$(LD) -o $@ $(LDFLAGS) $< $(LIBS_THREADED) $(call modldflags,$<)
1003
1004# special rules to build state machine compiler using build host compiler
1005$(STATECOMPOBJS): %.o: %.c
1006        $(Q) "  BUILD_CC        $@"
1007        $(E)$(BUILD_CC) $(BUILD_CFLAGS) $< -c -o $@ $(call modcflags,$<)
1008
1009$(STATECOMP): $(STATECOMPOBJS)
1010        $(Q) "  BUILD_LD        $@"
1011        $(E)$(BUILD_LD) -o $@ $(BUILD_LDFLAGS) $(STATECOMPOBJS) $(call modldflags,$<)
1012
1013# rule for generating cscope information
1014cscope:
1015        find @SRC_ABSOLUTE_TOP@ -iname "*.[ch]" -o -iname "*.sm" \
1016                 > $(srcdir)/cscope.files
1017        ( cd @SRC_ABSOLUTE_TOP@; cscope -be -i @SRC_ABSOLUTE_TOP@/cscope.files )
1018
1019# Build editor tags file over all source files *.[ch] *.sm and
1020# some known scripts.  Grab the config files from the build dir.
1021# Ignore all generated C files by echoing them and trusting uniq to
1022# throw away the duplicates.  Echo them twice so they do not survive
1023# uniq for out-of-tree builds.
1024tags:
1025        ( find $(addprefix $(srcdir)/,$(MODULES)) $(srcdir)/include \
1026            $(srcdir)/src/kernel/linux-2.6 \
1027            -maxdepth 1 -name '*.[ch]' -o -name '*.sm' ;\
1028          find . -maxdepth 1 -name pvfs2-config.h ;\
1029          echo $(srcdir)/src/apps/admin/pvfs2-genconfig ;\
1030          echo $(patsubst %,./%,$(SMCGEN) $(SMCGEN)) | tr ' ' '\012' ;\
1031        ) | sort | uniq -u | ctags -L- --excmd=pattern -B --extra=+f \
1032          --langmap=c:+.sm -I __hidden,DOTCONF_CB,nested,machine=struct
1033
1034# rule for running code check
1035codecheck:
1036        find $(srcdir) -iname "*.[ch]" | xargs -n 1 $(srcdir)/maint/pvfs2codecheck.pl
1037
1038# target for building documentation
1039docs: $(DOCSPS) $(DOCSPDF) $(DOCSHTML)
1040
1041publish: docs
1042        $(srcdir)/maint/pvfs2-publish-pages `pwd`/doc
1043
1044# rule for cleaning up documentation
1045# latex2html puts all its output in a directory
1046# don't get rid of generated files in dist releases
1047docsclean:
1048        rm -f $(DOCSCRUFT)
1049ifndef DIST_RELEASE
1050        rm -f $(DOCSPS) $(DOCSPDF)
1051        rm -rf $(basename $(DOCSHTML))
1052endif
1053
1054# top rule for cleaning up tree
1055clean::
1056        $(Q) "  CLEAN"
1057        $(E)rm -f $(LIBOBJS) $(LIBTHREADEDOBJS) \
1058            $(ULIBOBJS) $(ULIBTHREADEDOBJS) \
1059                $(SERVEROBJS) $(SERVERBINOBJS) $(MISCOBJS) \
1060                $(LIBRARIES) $(LIBRARIES_THREADED) $(DEPENDS) $(SERVER) \
1061                $(ADMINOBJS) $(ADMINOBJS_SERVER) $(ADMINTOOLS)\
1062                $(ADMINTOOLS_SERVER) lib/libpvfs2-server.a\
1063        $(USERTOOLS) $(USEROBJS) \
1064        $(UCACHEDTOOLS) $(UCACHEDOBJS) \
1065                $(KERNAPPOBJS) $(KERNAPPS) $(KERNAPPSTHR) \
1066                $(VISS) $(VISMISCOBJS) $(VISOBJS) $(VISDEPENDS)\
1067                $(VISMISCDEPENDS) $(KARMAOBJS) $(LIBPICOBJS) \
1068                $(STATECOMP) $(STATECOMPOBJS) $(LIBBMIOBJS) \
1069        $(BMILIBRARIES) $(FUSEOBJS) \
1070                $(VISMISCDEPENDS) $(KARMAOBJS) $(LIBPICOBJS)\
1071                $(STATECOMP) $(STATECOMPOBJS) \
1072                src/server/pvfs2-server-server.o \
1073                src/apps/karma/karma src/apps/fuse/pvfs2fuse
1074ifndef DIST_RELEASE
1075        $(E)rm -f $(STATECOMPGEN)
1076endif
1077
1078ifneq (,$(LINUX_KERNEL_SRC))
1079clean::
1080        @$(MAKE) --no-print-directory -C src/kernel/linux-2.6 clean
1081endif
1082
1083ifneq (,$(LINUX24_KERNEL_SRC))
1084clean::
1085        @$(MAKE) --no-print-directory -C src/kernel/linux-2.4 clean
1086endif
1087
1088# builds a tarball of the source tree suitable for distribution
1089dist: $(SMCGEN) cleaner
1090        @sh $(srcdir)/maint/make-dist.sh $(srcdir) @PVFS2_VERSION@
1091
1092ifdef BUILD_BMI_ONLY
1093# builds a tarball of the BMI source tree suitable for distribution
1094bmidist: cleaner
1095        @sh $(srcdir)/maint/make-bmi-dist.sh $(srcdir) $(builddir) @PVFS2_VERSION@
1096        cp -u $(builddir)/config.save $(builddir)/config.status
1097endif
1098
1099# some stuff that is cleaned in both distclean and dist targets
1100cleaner: clean
1101        rm -f tags
1102        rm -f src/kernel/linux-2.6/Makefile
1103        rm -f src/kernel/linux-2.4/Makefile
1104        rm -f maint/mpi-depend.sh
1105        rm -f examples/pvfs2-server.rc
1106        rm -f doc/doxygen/pvfs2-doxygen.conf
1107        rm -f examples/fs.conf
1108        rm -rf autom4te*.cache
1109        rm -f pvfs2-config.h.in~
1110        rm -f $(srcdir)/cscope.out $(srcdir)/cscope.files
1111        cp -p config.status config.save
1112        rm -f config.log config.status config.cache
1113        rm -f pvfs-@PVFS2_VERSION@.tar.gz
1114
1115# _really_ clean the tree; should go back to pristine state
1116# except, don't remove generated .c files if this is a distributed release
1117distclean: cleaner docsclean
1118        find . -name "module.mk" -exec rm \{\} \;
1119        rm -f Makefile pvfs2-config.h pvfs2-config.h.in configure aclocal.me
1120        rm -rf lib
1121        rm -f src/server/simple.conf
1122        rm -f src/apps/admin/pvfs2-config
1123ifndef DIST_RELEASE
1124        rm -f $(SMCGEN)
1125endif
1126
1127# this is where we include all of our automatic dependencies.
1128# NOTE: we wrap this in ifneq's in order to prevent the
1129#    dependencies from being generated for special targets that don't
1130#    require them
1131ifeq (,$(filter clean distclean dist docs cscope tags nodep,$(MAKECMDGOALS)))
1132-include $(DEPENDS)
1133endif
1134# add this as a make goal to disable rebuilding dependencies
1135.PHONY: nodep
1136nodep:; @:
1137
1138# default rule for generating dependency files
1139%.d: %.c
1140        $(Q) "  DEP             $@"
1141        $(E)CC="$(CC)" $(srcdir)/maint/depend.sh $(call dirname,$*) $(CFLAGS) $(DB_CFLAGS) $(call modcflags,$<) $< > $@
1142
1143# default rules for building documents in .tex format:
1144# TODO: these documentation rules are a big hack!
1145%.dvi: %.tex
1146        $(srcdir)/maint/pvfs2latexwrapper.pl -i $< -o $@
1147%.ps: %.dvi
1148        ( cd $(@D); dvips -t letter $(<F) -o $(@F) )
1149%.pdf: %.dvi
1150        ( cd $(@D); dvipdf $(<F) $(@F) )
1151%.html: %.tex
1152        $(srcdir)/maint/pvfs2latexwrapper.pl -html -i $(basename $<).tex -o $@
1153        $(srcdir)/maint/pvfs2htmlfixup.sh $(@D)/*/$(@F)
1154
1155# rule for automatically generated source files
1156%.c: %.sm $(STATECOMP)
1157        $(Q) "  SMC             $@"
1158        $(E)$(STATECOMP) $< $@
1159
1160# if this is not a distribution tarball, then drop some example
1161# config files in the server build directory with good defaults for
1162# debugging
1163ifndef DIST_RELEASE
1164all:: src/server/simple.conf
1165endif
1166src/server/simple.conf: src/apps/admin/pvfs2-genconfig
1167        $(Q) "  GENCONFIG     $@"
1168        $(E)$(srcdir)/src/apps/admin/pvfs2-genconfig --protocol tcp --port 3334 \
1169 --ioservers localhost --metaservers localhost --logfile /tmp/pvfs2-server.log \
1170 --storage /tmp/pvfs2-test-space --logging "server,network,storage,flow" \
1171 --quiet src/server/simple.conf
1172
1173# whether this is a distribution tarball or not, drop some config files
1174# into the "examples" subdir of the build dir
1175ifndef BUILD_BMI_ONLY
1176all:: examples/fs.conf
1177examples/fs.conf: src/apps/admin/pvfs2-genconfig
1178        $(Q) "  GENCONFIG     $@"
1179        $(E)$(srcdir)/src/apps/admin/pvfs2-genconfig --protocol tcp --port 3334 \
1180 --ioservers localhost --metaservers localhost --logfile /tmp/pvfs2-server.log \
1181 --storage /tmp/pvfs2-test-space \
1182 --quiet examples/fs.conf
1183endif
1184
1185install_doc:
1186        install -d $(mandir)/man1
1187        install -d $(mandir)/man5
1188        rm -f ${mandir}/man1/*.gz
1189        rm -f ${mandir}/man5/*.gz
1190        install -m 644 $(srcdir)/doc/man/*.1 $(mandir)/man1
1191        install -m 644 $(srcdir)/doc/man/*.5 $(mandir)/man5
1192        gzip -f ${mandir}/man1/*.1
1193        gzip -f ${mandir}/man5/*.5
1194
1195ifdef BUILD_BMI_ONLY
1196install:: all
1197        install -d $(includedir)
1198        install -m 644 $(srcdir)/src/io/bmi/bmi.h $(includedir)
1199        install -m 644 $(srcdir)/src/io/bmi/bmi-types.h $(includedir)
1200
1201        install -d $(libdir)
1202        install -m 755 lib/*.* $(libdir)
1203else
1204install:: all install_doc
1205        install -d $(includedir)
1206        install -m 644 $(builddir)/include/pvfs2.h $(includedir)
1207        install -m 644 $(srcdir)/include/pvfs2-request.h $(includedir)
1208        install -m 644 $(srcdir)/include/pvfs2-debug.h $(includedir)
1209        install -m 644 $(srcdir)/include/pvfs2-sysint.h $(includedir)
1210        install -m 644 $(srcdir)/include/pvfs2-usrint.h $(includedir)
1211        install -m 644 $(srcdir)/include/pvfs2-mgmt.h $(includedir)
1212        install -m 644 $(srcdir)/include/pvfs2-types.h $(includedir)
1213        install -m 644 $(srcdir)/include/pvfs2-util.h $(includedir)
1214        install -m 644 $(srcdir)/include/pvfs2-encode-stubs.h $(includedir)
1215        install -m 644 $(srcdir)/include/pvfs2-hint.h $(includedir)
1216        install -m 644 $(srcdir)/include/pvfs2-compat.h $(includedir)
1217        install -m 644 $(srcdir)/include/pvfs2-mirror.h $(includedir)
1218
1219        install -d $(libdir)
1220ifneq (,$(LIBRARIES_STATIC))
1221        for i in $(notdir $(LIBRARIES_STATIC)) ; do \
1222            install -m 755 lib/$$i $(libdir) ;\
1223        done
1224ifneq (,$(KERNAPPSTHR))
1225        for i in $(notdir $(LIBRARIES_THREADED_STATIC)) ; do \
1226            install -m 755 lib/$$i $(libdir) ;\
1227        done
1228endif
1229endif
1230ifneq (,$(LIBRARIES_SHARED))
1231        for i in $(notdir $(LIBRARIES_SHARED)) ; do \
1232            install -m 755 lib/$$i $(libdir)/$$i.$(SO_FULLVER) ;\
1233            $(LN_S) $$i.$(SO_FULLVER) $(libdir)/$$i.$(SO_VER) ;\
1234            $(LN_S) $$i.$(SO_VER) $(libdir)/$$i ;\
1235        done
1236ifneq (,$(KERNAPPSTHR))
1237        for i in $(notdir $(LIBRARIES_THREADED_SHARED)) ; do \
1238            install -m 755 lib/$$i $(libdir)/$$i.$(SO_FULLVER) ;\
1239            $(LN_S) $$i.$(SO_FULLVER) $(libdir)/$$i.$(SO_VER) ;\
1240           $(LN_S) $$i.$(SO_VER) $(libdir)/$$i ;\
1241        done
1242endif
1243endif
1244
1245ifdef TARGET_OS_DARWIN
1246#       TOC needs to be regenerated in libs after they get moved
1247        ranlib $(patsubst %,$(prefix)/%,$(LIBRARIES))
1248endif
1249
1250        install -d $(bindir)
1251        install -m 755 $(ADMINTOOLS) $(bindir)
1252        install -m 755 $(USERTOOLS) $(bindir)
1253ifdef BUILD_UCACHE
1254        install -m 755 $(UCACHEDTOOLS) $(sbindir)
1255endif
1256        # for compatibility in case anyone really wants "lsplus"
1257        $(LN_S) pvfs2-ls $(bindir)/pvfs2-lsplus
1258        install -m 755 src/apps/admin/pvfs2-config $(bindir)
1259        @# if we ever auto-generate genconfig, remove the $(srcdir)
1260        install -m 755 $(srcdir)/src/apps/admin/pvfs2-genconfig $(bindir)
1261        install -m 755 $(srcdir)/src/apps/admin/pvfs2-config-convert $(bindir)
1262        install -m 755 $(srcdir)/src/apps/admin/pvfs2-getmattr $(bindir)
1263        install -m 755 $(srcdir)/src/apps/admin/pvfs2-setmattr $(bindir)
1264ifdef BUILD_KARMA
1265        install -m 755 $(KARMA) $(bindir)
1266endif
1267
1268ifdef BUILD_FUSE
1269        install -m 755 $(FUSE) $(prefix)/bin
1270endif
1271
1272        # install any development tools built
1273        for i in $(notdir $(DEVELTOOLS)) ; do \
1274                if [ -f $(srcdir)/src/apps/devel/$$i ]; then install -m 755 $(srcdir)/src/apps/devel/$$i $(bindir); fi;\
1275        done
1276
1277        install -d $(sbindir)
1278
1279ifdef BUILD_SERVER
1280        install -m 755 $(ADMINTOOLS_SERVER) $(bindir)
1281    ifeq ($(NPTL_WORKAROUND),)
1282        install -m 755 $(SERVER) $(sbindir)
1283    else
1284        install -m 755 $(srcdir)/$(SERVER_STUB) $(sbindir)/pvfs2-server
1285        install -m 755 $(SERVER) $(sbindir)/pvfs2-server.bin
1286    endif
1287endif
1288endif
1289
1290ifneq (,$(LINUX_KERNEL_SRC))
1291
1292NUM_UTS_LINES := $(shell grep -c UTS_RELEASE $(LINUX_KERNEL_SRC)/include/linux/version.h)
1293ifeq ($(NUM_UTS_LINES),1)
1294    KERNEL_VERS := $(shell grep UTS_RELEASE $(LINUX_KERNEL_SRC)/include/linux/version.h | cut -d\" -f2)
1295else
1296    # multiple locations of utsrelease.h, just find and grep so we don't have to change again
1297    KERNEL_VERS := $(shell find ${LINUX_KERNEL_SRC}/include -name utsrelease.h -exec grep UTS_RELEASE '{}' \; | cut -d \" -f2 )
1298endif
1299
1300KMOD_DIR ?= $(DESTDIR)/${kmod_prefix}/lib/modules/$(KERNEL_VERS)/kernel/fs/pvfs2
1301
1302.PHONY: just_kmod_install
1303just_kmod_install: just_kmod
1304        install -d $(KMOD_DIR)
1305        install -m 755 src/kernel/linux-2.6/pvfs2.ko $(KMOD_DIR)
1306
1307.PHONY: kmod_install
1308kmod_install: kmod kernapps just_kmod_install
1309        install -d $(sbindir)
1310        install -m 755 $(KERNAPPS) $(KERNAPPSTHR) $(sbindir)
1311endif
1312
1313ifneq (,$(LINUX24_KERNEL_SRC))
1314
1315NUM_UTS_LINES := $(shell grep -c UTS_RELEASE $(LINUX24_KERNEL_SRC)/include/linux/version.h)
1316ifeq ($(NUM_UTS_LINES),1)
1317    KERNEL_VERS := $(shell grep UTS_RELEASE $(LINUX24_KERNEL_SRC)/include/linux/version.h | cut -d\" -f2)
1318else
1319    KERNEL_VERS := $(shell uname -r)
1320endif
1321KMOD_DIR := $(DESTDIR)/lib/modules/$(KERNEL_VERS)/kernel/fs/pvfs2
1322
1323.PHONY: just_kmod24_install
1324just_kmod24_install: just_kmod24
1325        install -d $(KMOD_DIR)
1326        install -m 755 src/kernel/linux-2.4/pvfs2.o $(KMOD_DIR)
1327
1328.PHONY: just_kmod24_apps_install
1329just_kmod24_apps_install: kmod24 kernapps
1330        install -d $(sbindir)
1331        install -m 755 $(KERNAPPS) $(KERNAPPSTHR) $(sbindir)
1332        install -m 755 src/apps/kernel/linux/mount.pvfs2 $(sbindir)
1333
1334.PHONY: kmod24_install
1335kmod24_install: kmod24 kernapps just_kmod24_install just_kmod24_apps_install
1336        @echo ""
1337        @echo "For improved linux-2.4 support,"
1338        @echo "install $(sbindir)/mount.pvfs2 to /sbin/mount.pvfs2"
1339        @echo ""
1340endif
Note: See TracBrowser for help on using the browser.