home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.parl.clemson.edu
/
2015-02-07.ftp.parl.clemson.edu.tar
/
ftp.parl.clemson.edu
/
pub
/
pvfs2
/
orangefs-2.8.3-20110323.tar.gz
/
orangefs-2.8.3-20110323.tar
/
orangefs
/
test
/
Makefile.in
< prev
next >
Wrap
Makefile
|
2008-11-26
|
14KB
|
410 lines
# Top level makefile for pvfs2 test programs
# define a few generic variables that we need to use
srcdir = @srcdir@
prefix = @prefix@
mandir = @mandir@
exec_prefix = @exec_prefix@
pvfs2_srcdir = @PVFS2_SRC_RELATIVE_TOP@
pvfs2_builddir = @PVFS2_BUILD_RELATIVE_TOP@
VPATH = $(srcdir)
SHELL = @SHELL@
INSTALL = @INSTALL@
# TODO: should probably check for bison and flex in configure
BISON = bison
FLEX = flex
LDSHARED = $(CC) -shared
PICFLAGS = -fPIC
BUILD_MPI = @BUILD_MPI@
MPICC = @MPICC@
GNUC = @GNUC@
INTELC = @INTELC@
MPI_GNUC = @MPI_GNUC@
MPI_INTELC = @MPI_INTELC@
TARGET_OS_DARWIN = @TARGET_OS_DARWIN@
TARGET_OS_LINUX = @TARGET_OS_LINUX@
TARGET_OS_BSD = @TARGET_OS_BSD@
# override default quiet mode with "make V=1"
QUIET_COMPILE = @QUIET_COMPILE@
ifdef V
QUIET_COMPILE = 0
endif
ifeq ($(QUIET_COMPILE),1)
# say a one-line description of the action, do not echo the command
Q=@echo
E=@
else
# do not say the short Q lines, but do echo the entire command
Q=@echo >/dev/null
E=
endif
# some of the test programs require the use of the pvfs2 server library;
# we therefore need to find out what libraries the original pvfs2 build
# used for server components
SERVERLIBS = @SERVERLIBS@
# Eliminate all default suffixes. We want explicit control.
.SUFFIXES:
# PHONEY targets are targets that do not result in the generation
# of a file that has the same name as the target. Listing them
# here keeps make from accidentally doing too much work (see GNU
# make manual).
.PHONY: all clean distclean cscope tags
################################################################
# Find project subdirectories
# MODULES is a list of subdirectories that we wish to operate on.
# They are identified by the presence of module.mk files (makefile
# includes).
MODULES := $(shell find . -name "*.mk" | sed -e 's/^.\///;s/module.mk//')
# List of directories to search for headers.
INCLUDES := \
${pvfs2_srcdir}/src/client/sysint \
${pvfs2_srcdir}/src/common/misc \
${pvfs2_srcdir}/src/common/quickhash \
${pvfs2_srcdir}/src/common/quicklist \
${pvfs2_srcdir}/src/common/dotconf \
${pvfs2_srcdir}/src/common/id-generator \
${pvfs2_srcdir}/src/common/gossip \
${pvfs2_srcdir}/src/common/gen-locks \
${pvfs2_srcdir}/src/common/llist \
${pvfs2_srcdir}/src/io/trove \
${pvfs2_srcdir}/src/io/bmi \
${pvfs2_srcdir}/src/io/description \
${pvfs2_srcdir}/src/io/flow \
${pvfs2_srcdir}/src/io/buffer \
${pvfs2_srcdir}/src/io/job \
${pvfs2_srcdir}/src/io/dev \
${pvfs2_srcdir}/src/proto \
${pvfs2_srcdir}/src/server \
${pvfs2_srcdir}/src/server/request-scheduler \
${pvfs2_srcdir} \
${pvfs2_srcdir} \
${pvfs2_builddir}/include
#################################################################
# Setup global flags
# These should all be self explanatory; they are standard flags
# for compiling and linking unless otherwise noted
CC = @CC@
CFLAGS = @CFLAGS@ @DB_CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
LD = gcc
LDSHARED = $(CC) -shared
PICFLAGS = -fPIC
LDFLAGS += -Llib
# turn on large file support by default
CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
# include current directory (for pvfs2-test-config.h)
CFLAGS += -I .
# add in include paths from pvfs2 src tree
CFLAGS += $(patsubst %,-I%,$(INCLUDES))
# special Intel cc options, all warnings, but disable:
# remark #279: controlling expression is constant
# shows up in ifdefs such as "do { ... } while (0)" construct
INTEL_CFLAGS := -Wall -wd279
# special gcc options
GCC_CFLAGS := -Wall -Wstrict-prototypes -pipe
################################################################
# Setup component specific flags
# Use these same cflags for the mpi test codes.
MPICFLAGS := $(CFLAGS)
# Add gcc-specific flags if we know it is a gnu compiler.
ifdef GNUC
CFLAGS += $(GCC_CFLAGS)
endif
ifdef INTELC
CFLAGS += $(INTEL_CFLAGS)
endif
ifdef MPI_INTELC
MPICFLAGS += $(INTEL_CFLAGS)
endif
ifdef MPI_GNUC
MPICFLAGS += $(GCC_CFLAGS)
endif
#################################################################
# Starter variables
# NOTES: These variables are used to categorize the various source
# files. We let the makefile includes append to them so that we
# gradually build up a list of source files without having to
# list them all at the top level.
# TESTSRC is source code for test programs
TESTSRC :=
# MISCSRC is a grab bag of other sources that must be built into
# object form (for example, shared test components)
MISCSRC :=
# SHAREDSRC is a hack to get things to build when mpi is not passed to configure.
SHAREDSRC :=
# MPIIOTESTSRC is the source for test programs that must be compiled
# with MPI-IO
MPIIOTESTSRC :=
# MPITESTSRC is the source code for test programs that must be compiled
# with MPI
MPITESTSRC :=
# MPIMISCSRC is a collection of sources that must be built into
# object form using MPI
MPIMISCSRC :=
# DLLSRC is a collection of sources that must be built into
# dlls/shared objects.
DLLSRC :=
# files generated as part of the build that should be deleted on "make clean"
CLEANFILES :=
################################################################
# Top level (default) targets
# default rule builds server, library, and test programs
all: tests
################################################################
# Makefile includes
# this is how we pull build information from all of the project
# subdirectories, make sure to catch top level module.mk as well
include $(patsubst %, %/module.mk, $(MODULES))
################################################################
# Derived file lists
# NOTES: At this point, the subdirectory makefile includes have informed
# us what the source files are. Now we want to generate some
# other lists (such as objects, executables, and dependency files)
# by manipulating the lists of source files
# TESTOBJS is a list of test program objects
TESTOBJS := $(patsubst %.c,%.o, $(filter %.c,$(TESTSRC)))
# TESTS is a list of test program executables
TESTS := $(patsubst %.c,%, $(filter %.c, $(TESTSRC)))
# TESTDEPENDS is a list of dependency files for test programs
TESTDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(TESTSRC)))
# MISCOBJS is a list of misc. objects not in the above categories
MISCOBJS := $(patsubst %.c,%.o, $(filter %.c,$(MISCSRC)))
# MISCDEPENDS is a list of dependency files for misc. objects
MISCDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(MISCSRC)))
# SHAREDOBJS is a list of shared. objects not in the above categories
SHAREDOBJS := $(patsubst %.c,%.o, $(filter %.c,$(SHAREDSRC)))
# SHAREDDEPENDS is a list of dependency files for shared. objects
SHAREDDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(SHAREDSRC)))
# MPIMISCOBJS is a list of misc. MPI objects not in the above categories
MPIMISCOBJS := $(patsubst %.c,%.o, $(filter %.c,$(MPIMISCSRC)))
# MPIMISCDEPENDS is a list of dependency files for MPI misc. objects
MPIMISCDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(MPIMISCSRC)))
# DLLOBJS is a list of misc. objects made into DLLs
DLLOBJS := $(patsubst %.c,%.po, $(filter %.c,$(DLLSRC)))
# DLLDEPENDS is a list of dependency files for dll objects
DLLDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(DLLSRC)))
#DLLS is a list of DLLs
DLLS := $(patsubst %.c,%.so, $(filter %.c,$(DLLSRC)))
# MPITESTOBJS is a list of MPI test program objects
MPITESTOBJS := $(patsubst %.c,%.o, $(filter %.c,$(MPITESTSRC)))
# MPITESTS is a list of MPI test program executables
MPITESTS := $(patsubst %.c,%, $(filter %.c, $(MPITESTSRC)))
# TESTDEPENDS is a list of dependency files for MPI test programs
MPITESTDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(MPITESTSRC)))
# MPIIOTESTOBJS is a list of MPI-IO test program objects
MPIIOTESTOBJS := $(patsubst %.c,%.o, $(filter %.c,$(MPIIOTESTSRC)))
# MPIIOTESTS is a list of MPI-IO test program executables
MPIIOTESTS := $(patsubst %.c,%, $(filter %.c, $(MPIIOTESTSRC)))
# MPIIOTESTDEPENDS is a list of dependency files for MPI-IO test programs
MPIIOTESTDEPENDS := $(patsubst %.c,%.d, $(filter %.c,$(MPIIOTESTSRC)))
# DEPENDS is a global list of all of our dependency files.
# NOTE: sort is just a trick to remove duplicates; the order
# doesn't matter at all.
DEPENDS := $(sort $(TESTDEPENDS) $(MISCDEPENDS) $(DLLDEPENDS))
ifdef BUILD_MPI
DEPENDS += $(MPITESTDEPENDS) $(MPIMISCDEPENDS)
endif
####################################################################
# Rules and dependencies
# target for building MPI-IO test programs
mpiiotests: $(MPIIOTESTS)
# Just like dir, but strip the slash off the end, to be pretty.
dirname = $(patsubst %/,%,$(dir $(1)))
# Generate the canonical in-tree location of a file, given a possibly
# out-of-tree reference.
canonname = $(patsubst $(srcdir)/%,%,$(call dirname,$(1)))
# Grab any CFLAGS defined by the make stub for a particular file, and
# for the directory in which the source resides.
# Always add the directory in question for "local" includes.
modcflags = $(MODCFLAGS_$(call canonname,$(1))) \
$(MODCFLAGS_$(patsubst $(srcdir)/%,%,$(1))) \
-I$(call dirname,$(1))
modldflags = $(MODLDFLAGS_$(call canonname,$(1))) \
$(MODLDFLAGS_$(patsubst $(srcdir)/%,%,$(1))) \
-L$(call dirname,$(1))
# target for building the test program executables
tests: $(TESTS)
# target for building MPI test program executables
mpitests: $(MPITESTS)
ifdef BUILD_MPI
# add MPI programs to default rule
all: mpitests mpiiotests
endif
# rule for building MPI objects
$(MPITESTOBJS): %.o: %.c
ifdef BUILD_MPI
$(Q) " MPICC $@"
$(E)$(MPICC) $(LIBCFLAGS) $(MPICFLAGS) $(call modcflags,$<) $< -c -o $@
else
@echo Error: You must specify --with-mpi=dir at configure time
@echo in order to enable compilation of MPI programs.
@false
endif
# rule for building MPI-IO objects
$(MPIIOTESTOBJS): %.o: %.c
ifdef BUILD_MPI
$(Q) " MPICC $@"
$(E)$(MPICC) $(LIBCFLAGS) $(MPICFLAGS) $(call modcflags,$<) $< -c -o $@
else
@echo Error: You must specify --with-mpi=dir at configure time
@echo in order to enable compilation of MPI programs.
@false
endif
# rule for building MPI misc. objects
$(MPIMISCOBJS): %.o: %.c
ifdef BUILD_MPI
$(Q) " MPICC $@"
$(E)$(MPICC) $(LIBCFLAGS) $(MPICFLAGS) $(call modcflags,$<) $< -c -o $@
else
@echo Error: You must specify --with-mpi=dir at configure time
@echo in order to enable compilation of MPI programs.
@false
endif
# rule for building MPI executables from object files
$(MPITESTS): %: %.o $(MPIMISCOBJS) $(SHAREDOBJS) $(LIBRARIES)
$(Q) " MPILD $@"
$(E)$(MPICC) $^ $(LDFLAGS) $(call modldflags,$<) $(LIBS) -lm -o $@
# rule for building MPI-IO executables from object files
# note: add a $(MPIMISCOBJS) prereq if we build multi-object tests someday
$(MPIIOTESTS): %: %.o $(LIBRARIES)
$(Q) " MPILD $@"
$(E)$(MPICC) $^ $(LDFLAGS) $(call modldflags,$<) $(LIBS) -lm -o $@
# default rule for building executables from object files
%: %.o $(LIBRARIES) $(MISCOBJS) $(SHAREDOBJS)
$(Q) " LD $@"
$(E)$(LD) $(LDFLAGS) $(call modldflags,$<) $< $(MISCOBJS) $(SHAREDOBJS) $(LIBS) -o $@
# default rule for building objects
%.o: %.c
$(Q) " CC $@"
$(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(call modcflags,$<) $< -c -o $@
# rule for building shared objects
%.po: %.c
$(Q) " CCPIC $@"
$(E)$(CC) $(LIBCFLAGS) $(CFLAGS) $(PICFLAGS) $(call modcflags,$<) $< -c -o $@
%.so: $(DLLOBJS)
$(Q) " LDSO $@"
$(E)$(LDSHARED) -o $@ $(DLLOBJS)
# all test programs depend on the pvfs2 library
$(TESTS): %: %.o $(LIBRARIES)
# rule for generating cscope information
cscope:
find @SRC_ABSOLUTE_TOP@ -iname "*.[ch]" -o -iname "*.sm" \
> $(srcdir)/cscope.files
( cd @SRC_ABSOLUTE_TOP@; cscope -be -i @SRC_ABSOLUTE_TOP@/cscope.files )
# build editor tags file over all source files *.[ch] *.sm and
# some known scripts
tags:
( find $(addprefix $(srcdir)/,$(MODULES)) \
-maxdepth 1 -name '*.[ch]' ;\
) | ctags -L- --excmd=pattern -B --extra=+f -I __hidden
# top rule for cleaning up tree
clean:
$(Q) " CLEAN"
$(E)rm -f $(TESTOBJS) $(MISCOBJS) $(TESTS) $(MISCDEPENDS)\
$(DEPENDS) $(CLEANFILES) $(MPIMISCOBJS) $(SHAREDOBJS) $(SHAREDDEPENDS)\
$(MPITESTS) $(MPITESTOBJS) $(MPITESTDEPENDS) $(MPIMISCDEPENDS)\
$(MPIIOTESTOBJS) $(MPIIOTESTS) $(DLLDEPENDS) $(DLLS) $(DLLOBJS)
# some stuff that is cleaned in both distclean and dist targets
cleaner: clean
rm -f tags
rm -f examples/pvfs2-server.rc
rm -rf autom4te*.cache
rm -f $(srcdir)/cscope.out $(srcdir)/cscope.files
rm -f config.log config.status config.cache
rm -f maint/mpi-depend.sh common/pav/configfile.sample
# _really_ clean the tree; should go back to pristine state
distclean: cleaner
find . -name "module.mk" -exec rm \{\} \;
rm -f Makefile pvfs2-test-config.h
# this is where we include all of our automatic dependencies.
# NOTE: we wrap this in ifneq's in order to prevent the
# dependencies from being generated for special targets that don't
# require them
ifeq (,$(filter clean distclean cscope tags nodep,$(MAKECMDGOALS)))
-include $(DEPENDS)
endif
# add this as a make goal to disable rebuilding dependencies
.PHONY: nodep
nodep:; @:
# rule for generating dependency files for MPI code
#
# note: mpi-depend.sh is automatically generated, so it is in
# the build directory already.
ifdef BUILD_MPI
$(MPITESTDEPENDS) $(MPIMISCDEPENDS): %.d: %.c
$(Q) " DEP $@"
$(E)sh ./maint/mpi-depend.sh `dirname $*` $(MPICFLAGS) $(call modcflags,$<) $< > $@
endif
# default rule for generating dependency files
%.d: %.c
$(Q) " DEP $@"
$(E)CC="$(CC)" $(pvfs2_srcdir)/maint/depend.sh $(call dirname,$*) $(CFLAGS) $(call modcflags,$<) $< > $@
install::
install -d @PVFS2_TOP_PREFIX@/test
install -m 755 $(TESTS) @PVFS2_TOP_PREFIX@/test
ifdef BUILD_MPI
install -m 755 $(MPITESTS) @PVFS2_TOP_PREFIX@/test
install -m 755 $(MPIIOTESTS) @PVFS2_TOP_PREFIX@/test
endif