root/branches/Orange-Elaine-Distr-Dir-Branch/Makefile.in @ 8259

Revision 8259, 39.0 KB (checked in by anonymous, 3 years ago)

This commit was manufactured by cvs2svn to create branch 'Orange-Elaine-
Distr-Dir-Branch'.

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