root/mpich2/branches/dev/kumudb/Makefile.sm @ 4827

Revision 4827, 10.1 KB (checked in by kumudb, 5 months ago)

the static library gets generated conditionally.

Line 
1# -*- Mode: makefile; -*-
2SUBDIRS = . @EXTERNAL_SRC_DIRS@ src examples
3# Do not include test in the basic build. 
4OTHER_DIRS = test
5DOC_SUBDIRS = doc
6# The all-local target makes sure that when different subsystems are selected
7# for the configure step, the libraries are removed and the object files
8# cleaned out.  Without this step, it is possible to run make and encounter
9# errors caused by out-of-date objects in the directories and in the
10# library.  We do not replace the pkglist file until the make completes,
11# using the all-postamble target.
12#
13# Here is the logic:
14#   A new configure creates lib/newconfig
15#   A cleanobjsandlibs step removes that file, as well as removing the
16#     libraries and object files
17#   The test for whether the clean step is performed is this:
18#      Create a file lib/pkglist.new
19#      Compare lib/pkglist.new to lib/pkglist
20#      If the same, rm lib/pkglist.new and done.
21#      If different, then cleanout the libraries and object files,
22#          then mv lib/pkglist.new lib/pkglist
23#         
24all-local:
25        @if [ ! -d lib ] ; then mkdir lib ; date > lib/.mpich2created ; \
26        else \
27            echo "@subsystems@" > lib/pkglist.new ; \
28            echo "@CC@ @CFLAGS@" >>lib/pkglist.new ;\
29            echo "@CXX@ @CXXFLAGS@" >> lib/pkglist.new ;\
30            echo "@F77@ @FFLAGS@" >> lib/pkglist.new ;\
31            echo "@F90@ @F90FLAGS@" >> lib/pkglist.new ;\
32            echo "@CONFIGURE_ARGUMENTS@" >>lib/pkglist.new ; \
33            echo "@LDFLAGS@" >> lib/pkglist.new ;\
34            if diff lib/pkglist lib/pkglist.new >/dev/null 2>&1 ; then \
35                rm -f lib/pkglist.new ; \
36            else \
37                ${MAKE} cleanobjsandlibs ; \
38                rm -f lib/pkglist ; \
39                mv -f lib/pkglist.new lib/pkglist ; \
40            fi ; \
41        fi
42
43clean-preamble:
44        ${MAKE} cleanlibs
45
46cleanobjsandlibs:
47        ${MAKE} clean && cd test && ${MAKE} clean
48        rm -f lib/newconfig
49# cleanlibs makes sure that we clean all of the library files
50cleanlibs:
51        rm -f lib/lib${MPILIBNAME}.a lib/lib${PMPILIBNAME}.a
52        rm -f lib/lib${MPICXXLIBNAME}.a
53        rm -f lib/libf${MPILIBNAME}.a lib/lib${MPILIBNAME}f90.a
54        rm -f lib/lib${MPILIBNAME}.@SHLIB_EXT@*
55        rm -f lib/lib${PMPILIBNAME}.@SHLIB_EXT@*
56        rm -f lib/lib${MPICXXLIBNAME}.@SHLIB_EXT@*
57        rm -f lib/libf${MPILIBNAME}.@SHLIB_EXT@*
58        rm -f lib/lib${MPILIBNAME}f90.@SHLIB_EXT@*
59        rm -f lib/lib${MPILIBNAME}.*.@SHLIB_EXT@*
60        rm -f lib/lib${PMPILIBNAME}.*.@SHLIB_EXT@*
61        rm -f lib/lib${MPICXXLIBNAME}.*.@SHLIB_EXT@*
62        rm -f lib/libf${MPILIBNAME}.*.@SHLIB_EXT@*
63        rm -f lib/lib${MPILIBNAME}.la* lib/lib${PMPILIBNAME}.la*
64        rm -f lib/lib${MPICXXLIBNAME}.la*
65        rm -f lib/libf${MPILIBNAME}.la*
66
67all-preamble:
68        @echo "Beginning make"
69        @echo "Using variables CC='@CC@' CFLAGS='@CFLAGS@' LDFLAGS='@LDFLAGS@' AR='@AR@' FC='@FC@' F90='@F90@' FFLAGS='@FFLAGS@' F90FLAGS='@F90FLAGS@' CXX='@CXX@' CPPFLAGS='@CPPFLAGS@'"
70
71# Add any final extras:
72#    1) Build the debugger interface if requested
73# Move the "pkglist.new" file to "pkglist" on successful completion
74all-postamble:
75        ${MAKE} build-lib
76        @if [ "@BUILD_TVDLL@" = "yes" ] ; then \
77        ( cd src/mpi/debugger && $(MAKE) ./libtvmpich2.@SHLIB_EXT@ ) ; fi
78        @if [ -s lib/pkglist.new ] ; then mv -f lib/pkglist.new lib/pkglist ; fi
79        @echo "Make completed"
80
81# ./lib/libmpich.a ./lib/libmpichcxx.a ./lib/libmpichf90.a ./lib/libfmpich.a
82
83build-lib: lib_subsystem_libmpich ${LIB_SUBSYSTEM} 
84
85lib_subsystem_libmpich: ./lib/libmpich.a
86
87lib_subsystem_libmpichcxx: ./lib/libmpichcxx.a
88
89lib_subsystem_libmpichf90: ./lib/libmpichf90.a
90
91lib_subsystem_libfmpich: ./lib/libfmpich.a
92
93./lib/libmpich.a: ./lib/.libmpich.a.timestamp
94        ${AR} cr ./lib/libmpich.a `find ${abs_buildir} -name libmpich.a.manifest -exec cat {} \;`
95        ${RANLIB} ./lib/libmpich.a
96
97./lib/libmpichcxx.a: ./lib/.libmpichcxx.a.timestamp
98        ${AR} cr ./lib/libmpichcxx.a `find ${abs_buildir} -name libmpichcxx.a.manifest -exec cat {} \;`
99        ${RANLIB} ./lib/libmpichcxx.a
100
101./lib/libmpichf90.a: ./lib/.libmpichf90.a.timestamp
102        ${AR} cr ./lib/libmpichf90.a `find ${abs_buildir} -name libmpichf90.a.manifest -exec cat {} \;`
103        ${RANLIB} ./lib/libmpichf90.a
104 
105./lib/libfmpich.a: ./lib/.libfmpich.a.timestamp
106        ${AR} cr ./lib/libfmpich.a `find ${abs_buildir} -name libfmpich.a.manifest -exec cat {} \;`
107        ${RANLIB} ./lib/libfmpich.a
108
109# The test on lib/.mpich2created lets us delete the local lib directory
110# if we created it, and not otherwise
111distclean-local:
112        -@rm -f lib/lib${MPILIBNAME}.a lib/pkglist lib/pkglist.new
113        -@rm -f lib/lib${MPILIBNAME}.@SHLIB_EXT@* lib/lib${MPILIBNAME}.la
114        -@if [ -s lib/.mpich2created ] ; then rm -rf lib ; fi
115        -@rm -f src/include/${MPILIBNAME}conf.h
116        -@rm -f src/include/mpio.h
117        -@rm -f bin/mpicc
118        -@rm -f bin/mpich2version
119        -@cd test && $(MAKE) distclean
120
121# Version < 1 is pre MPI-1 release.
122# Version >= 2 contains MPI-2
123# Version between 1 and 2 contains all of MPI1 and parts of MPI-2
124# Version is now set in the Configure file so that we can easily include the
125# version on the configure output and to match the common practice of
126# current autoconfs
127VERSION = @VERSION@
128# With PACKAGE set, all mpich2 and mpe2 documentation
129# will go to docdir=$datarootdir/doc/$PACKAGE,
130# and mpe2's exaamples_*/ and logfiles/ go to $datadir/$PACKAGE.
131# Unsetting PACKAGE enables docdir=$datarootdir/doc and mpe2 data in $datadir
132# User can do "make install PACKAGE=mpich2-xxx" enables
133# docdir=$datarootdir/doc/mpich2-xxx and mpe2 data in $datadir/mpich2-xxx.
134# PACKAGE = mpich2-$(VERSION)
135
136# We skip the mpid/mm directories because mm is no longer active
137# mpe2 is an outside project and is tested against the default
138# checks
139coding-check:
140        @if [ -z $(CODINGCHECK) ] ;then \
141            echo "You must define CODINGCHECK for this target" ; \
142        else \
143           echo "Checking the MPICH2 sources" ;\
144           $(CODINGCHECK) -addchecks=mpich2,funcstates,funcnests \
145                -skipfiles=src/mpe2,src/mpid/mm src examples test ;\
146           if [ -d src/mpe2 ] ; then \
147                echo "Checking mpe2 sources" ;\
148                $(CODINGCHECK) src/mpe2 ; \
149           fi ; \
150        fi
151
152# Set the document sources and types (empty lists still cause recursion)
153# These should be empty; any source files should be described in the
154# directory that contains those source files.  The presence of these
155# items simply indicates that there are such documents
156doc_HTML_SOURCES  =
157doc_MAN_SOURCES   =
158doc_LATEX_SOURCES =
159
160# Add the www index pages
161htmldoc-local:
162        doc/mansrc/createhtmlindex
163
164# Testing requires installation first
165testing:
166        (cd test && $(MAKE) testing)
167
168profilelib_${MPILIBNAME} = ${PMPILIBNAME}
169MPICXXLIBNAME = @MPICXXLIBNAME@
170MPIFLIBNAME   = @MPIFLIBNAME@
171MPIFWRAPNAME  = @FWRAPNAME@
172install_LIB = lib/lib${MPILIBNAME}.a
173optinstall_LIB = lib/lib${MPIFLIBNAME}.a
174optinstall_LIB = lib/lib${MPICXXLIBNAME}.a
175optinstall_LIB = lib/lib${MPIFWRAPNAME}.a
176#optinstall_SHLIB = lib/lib${MPIFLIBNAME}.@SHLIB_EXT@
177#optinstall_SHLIB = lib/lib${MPICXXLIBNAME}.@SHLIB_EXT@
178
179# Extra information on creating shared libraries, needed on some platforms
180# On the platforms that require these options, we require that
181# PMPILIBNAME and MPILIBNAME be the same.
182# UNUSED, example for experimentation only
183#lib${MPILIBNAME}_so_EXPORTS = maint/mpi.def
184#libf${MPILIBNAME}_so_EXPORTS = maint/fmpi.def
185libf${MPILIBNAME}_so_LIBS = -L. -l$(MPILIBNAME)
186
187install_INCLUDE = src/include/mpi.h
188
189optinstall_LIB = lib/lib${PMPILIBNAME}.a
190optinstall_SHLIB = lib/lib${MPILIBNAME}.@SHLIB_EXT@
191optinstall_SHLIB = lib/lib${PMPILIBNAME}.@SHLIB_EXT@
192optinstall_INCLUDE = src/mpi/romio/include/mpiof.h src/mpi/romio/include/mpio.h
193optinstall_LIB = lib/libf${MPILIBNAME}.a
194optinstall_SHLIB = lib/libf${MPILIBNAME}.@SHLIB_EXT@
195optinstall_LIB = lib/lib${MPILIBNAME}f90.a
196optinstall_SHLIB = lib/lib${MPILIBNAME}f90.@SHLIB_EXT@
197optinstall_SHLIB = lib/lib${MPICXXLIBNAME}.@SHLIB_EXT@
198
199# Some of the subsidiary packages may need to be installed.  This target will
200# invoke their install targets as part of the installation process
201INSTALL_SUBDIRS = src/util/thread src/env src/packaging/pkgconfig src/packaging/envmods \
202                  @bindings_dirs@ @other_install_dirs@
203
204# Install preamble checks for possible problems
205install-preamble:
206        @if [ "@ENABLE_SHLIB@" = none ] ; then\
207             found=no ; \
208             for file in ${libdir}/lib*${MPILIBNAME}.@SHLIB_EXT@ ; do \
209                 if [ -f $$file ] ; then \
210                     echo "Remove $$file and rerun ${MAKE} install" ; \
211                     found=yes ; \
212                 fi ; \
213             done ; \
214             if [ $$found != no ] ; then exit 1 ; fi ;\
215        fi
216
217# Install optional features which require special actions:
218#   The debugger interface (the "Totalview" DLL)
219#   The "other" process managers when more that one are built
220install_local_DIR = libdir
221install-local:
222        -if [ "@BUILD_TVDLL@" = "yes" ] ; then \
223            $(INSTALL_DATA) src/mpi/debugger/libtvmpich2.@SHLIB_EXT@ \
224                        ${DESTDIR}${libdir}/libtvmpich2.@SHLIB_EXT@ ; fi
225        -if [ -n "@other_pm_names@" ] ; then \
226            for pm in @other_pm_names@ /dev/null ; do \
227                if [ -d src/pm/$$pm ] ; then \
228                     (cd src/pm/$$pm && $(MAKE) install-alt ) ; fi ; \
229            done ; \
230        fi
231
232#
233# The install-examples target may be used if you want to install the cpi
234# program for others to use.  This is nto part of the default installation
235# because there isn't a good place to put this in the GNU recommended
236# installation targets (its a kind of hardware-architecture-specific
237# documentation)
238install-examples:
239        if [ ! -d ${DESTDIR}${exec_prefix}/examples ] ; then \
240            $(MKDIR_P) ${DESTDIR}${exec_prefix}/examples ; \
241        fi
242        $(INSTALL_PROGRAM) examples/cpi ${DESTDIR}${exec_prefix}/examples/cpi
243
244install-devdocs:
245        (cd doc && $(MAKE) install-devdocs)
246
247# installcheck-postable adds checks that may require special
248# handling. 
249# FIXME: Some install checks require that the Process Manager be
250# started first.  This step does not handle that.
251installcheck-postamble:
252        @if [ -n "@mpe_dir@" -a -d "src/@mpe_dir@" ] ; then \
253            (cd src/@mpe_dir@ && $(MAKE) installcheck-all PACKAGE=$(PACKAGE) ; ) ; fi
254#
255# The documents are shipped as part of the release, and so should be
256# installed from the source directory, not a VPATH build directory
257install_DOC =
258optinstall_DOC = \
259    $(srcdir)/doc/userguide/user.pdf \
260    $(srcdir)/doc/installguide/install.pdf \
261    $(srcdir)/doc/smpd/smpd_pmi.pdf \
262    $(srcdir)/doc/logging/logging.pdf
263installdir_HTML = $(srcdir)/www
264installdir_MAN  = $(srcdir)/man
265#install_BIN =
266#install_SBIN =         
267# Still to do: figure out the appropriate target for installing the html
268# versions of the documents.
Note: See TracBrowser for help on using the browser.