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

Revision 4898, 10.4 KB (checked in by kumudb, 5 months ago)

executable works except mpiexec

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        ${MAKE} all-executable
77        @if [ "@BUILD_TVDLL@" = "yes" ] ; then \
78        ( cd src/mpi/debugger && $(MAKE) ./libtvmpich2.@SHLIB_EXT@ ) ; fi
79        @if [ -s lib/pkglist.new ] ; then mv -f lib/pkglist.new lib/pkglist ; fi
80        @echo "Make completed"
81
82# ./lib/libmpich.a ./lib/libmpichcxx.a ./lib/libmpichf90.a ./lib/libfmpich.a
83
84build-lib: lib_subsystem_libmpich ${LIB_SUBSYSTEM} 
85
86lib_subsystem_libmpich: ./lib/libmpich.a
87
88lib_subsystem_libmpichcxx: ./lib/libmpichcxx.a
89
90lib_subsystem_libmpichf90: ./lib/libmpichf90.a
91
92lib_subsystem_libfmpich: ./lib/libfmpich.a
93
94lib_subsystem_libmpiexec: ./lib/libmpiexec.a
95
96./lib/libmpich.a: ./lib/.libmpich.a.timestamp
97        ${AR} cr ./lib/libmpich.a `find ${abs_buildir} -name libmpich.a.manifest -exec cat {} \;`
98        ${RANLIB} ./lib/libmpich.a
99
100./lib/libmpichcxx.a: ./lib/.libmpichcxx.a.timestamp
101        ${AR} cr ./lib/libmpichcxx.a `find ${abs_buildir} -name libmpichcxx.a.manifest -exec cat {} \;`
102        ${RANLIB} ./lib/libmpichcxx.a
103
104./lib/libmpichf90.a: ./lib/.libmpichf90.a.timestamp
105        ${AR} cr ./lib/libmpichf90.a `find ${abs_buildir} -name libmpichf90.a.manifest -exec cat {} \;`
106        ${RANLIB} ./lib/libmpichf90.a
107 
108./lib/libfmpich.a: ./lib/.libfmpich.a.timestamp
109        ${AR} cr ./lib/libfmpich.a `find ${abs_buildir} -name libfmpich.a.manifest -exec cat {} \;`
110        ${RANLIB} ./lib/libfmpich.a
111
112./lib/libmpiexec.a: ./lib/.libmpiexec.a.timestamp
113        ${AR} cr ./lib/libmpiexec.a `find ${abs_buildir} -name libmpiexec.a.manifest -exec cat {} \;`
114        ${RANLIB} ./lib/libmpiexec.a
115
116# The test on lib/.mpich2created lets us delete the local lib directory
117# if we created it, and not otherwise
118distclean-local:
119        -@rm -f lib/lib${MPILIBNAME}.a lib/pkglist lib/pkglist.new
120        -@rm -f lib/lib${MPILIBNAME}.@SHLIB_EXT@* lib/lib${MPILIBNAME}.la
121        -@if [ -s lib/.mpich2created ] ; then rm -rf lib ; fi
122        -@rm -f src/include/${MPILIBNAME}conf.h
123        -@rm -f src/include/mpio.h
124        -@rm -f bin/mpicc
125        -@rm -f bin/mpich2version
126        -@cd test && $(MAKE) distclean
127
128# Version < 1 is pre MPI-1 release.
129# Version >= 2 contains MPI-2
130# Version between 1 and 2 contains all of MPI1 and parts of MPI-2
131# Version is now set in the Configure file so that we can easily include the
132# version on the configure output and to match the common practice of
133# current autoconfs
134VERSION = @VERSION@
135# With PACKAGE set, all mpich2 and mpe2 documentation
136# will go to docdir=$datarootdir/doc/$PACKAGE,
137# and mpe2's exaamples_*/ and logfiles/ go to $datadir/$PACKAGE.
138# Unsetting PACKAGE enables docdir=$datarootdir/doc and mpe2 data in $datadir
139# User can do "make install PACKAGE=mpich2-xxx" enables
140# docdir=$datarootdir/doc/mpich2-xxx and mpe2 data in $datadir/mpich2-xxx.
141# PACKAGE = mpich2-$(VERSION)
142
143# We skip the mpid/mm directories because mm is no longer active
144# mpe2 is an outside project and is tested against the default
145# checks
146coding-check:
147        @if [ -z $(CODINGCHECK) ] ;then \
148            echo "You must define CODINGCHECK for this target" ; \
149        else \
150           echo "Checking the MPICH2 sources" ;\
151           $(CODINGCHECK) -addchecks=mpich2,funcstates,funcnests \
152                -skipfiles=src/mpe2,src/mpid/mm src examples test ;\
153           if [ -d src/mpe2 ] ; then \
154                echo "Checking mpe2 sources" ;\
155                $(CODINGCHECK) src/mpe2 ; \
156           fi ; \
157        fi
158
159# Set the document sources and types (empty lists still cause recursion)
160# These should be empty; any source files should be described in the
161# directory that contains those source files.  The presence of these
162# items simply indicates that there are such documents
163doc_HTML_SOURCES  =
164doc_MAN_SOURCES   =
165doc_LATEX_SOURCES =
166
167# Add the www index pages
168htmldoc-local:
169        doc/mansrc/createhtmlindex
170
171# Testing requires installation first
172testing:
173        (cd test && $(MAKE) testing)
174
175profilelib_${MPILIBNAME} = ${PMPILIBNAME}
176MPICXXLIBNAME = @MPICXXLIBNAME@
177MPIFLIBNAME   = @MPIFLIBNAME@
178MPIFWRAPNAME  = @FWRAPNAME@
179install_LIB = lib/lib${MPILIBNAME}.a
180optinstall_LIB = lib/lib${MPIFLIBNAME}.a
181optinstall_LIB = lib/lib${MPICXXLIBNAME}.a
182optinstall_LIB = lib/lib${MPIFWRAPNAME}.a
183#optinstall_SHLIB = lib/lib${MPIFLIBNAME}.@SHLIB_EXT@
184#optinstall_SHLIB = lib/lib${MPICXXLIBNAME}.@SHLIB_EXT@
185
186# Extra information on creating shared libraries, needed on some platforms
187# On the platforms that require these options, we require that
188# PMPILIBNAME and MPILIBNAME be the same.
189# UNUSED, example for experimentation only
190#lib${MPILIBNAME}_so_EXPORTS = maint/mpi.def
191#libf${MPILIBNAME}_so_EXPORTS = maint/fmpi.def
192libf${MPILIBNAME}_so_LIBS = -L. -l$(MPILIBNAME)
193
194install_INCLUDE = src/include/mpi.h
195
196optinstall_LIB = lib/lib${PMPILIBNAME}.a
197optinstall_SHLIB = lib/lib${MPILIBNAME}.@SHLIB_EXT@
198optinstall_SHLIB = lib/lib${PMPILIBNAME}.@SHLIB_EXT@
199optinstall_INCLUDE = src/mpi/romio/include/mpiof.h src/mpi/romio/include/mpio.h
200optinstall_LIB = lib/libf${MPILIBNAME}.a
201optinstall_SHLIB = lib/libf${MPILIBNAME}.@SHLIB_EXT@
202optinstall_LIB = lib/lib${MPILIBNAME}f90.a
203optinstall_SHLIB = lib/lib${MPILIBNAME}f90.@SHLIB_EXT@
204optinstall_SHLIB = lib/lib${MPICXXLIBNAME}.@SHLIB_EXT@
205
206# Some of the subsidiary packages may need to be installed.  This target will
207# invoke their install targets as part of the installation process
208INSTALL_SUBDIRS = src/util/thread src/env src/packaging/pkgconfig src/packaging/envmods \
209                  @bindings_dirs@ @other_install_dirs@
210
211# Install preamble checks for possible problems
212install-preamble:
213        @if [ "@ENABLE_SHLIB@" = none ] ; then\
214             found=no ; \
215             for file in ${libdir}/lib*${MPILIBNAME}.@SHLIB_EXT@ ; do \
216                 if [ -f $$file ] ; then \
217                     echo "Remove $$file and rerun ${MAKE} install" ; \
218                     found=yes ; \
219                 fi ; \
220             done ; \
221             if [ $$found != no ] ; then exit 1 ; fi ;\
222        fi
223
224# Install optional features which require special actions:
225#   The debugger interface (the "Totalview" DLL)
226#   The "other" process managers when more that one are built
227install_local_DIR = libdir
228install-local:
229        -if [ "@BUILD_TVDLL@" = "yes" ] ; then \
230            $(INSTALL_DATA) src/mpi/debugger/libtvmpich2.@SHLIB_EXT@ \
231                        ${DESTDIR}${libdir}/libtvmpich2.@SHLIB_EXT@ ; fi
232        -if [ -n "@other_pm_names@" ] ; then \
233            for pm in @other_pm_names@ /dev/null ; do \
234                if [ -d src/pm/$$pm ] ; then \
235                     (cd src/pm/$$pm && $(MAKE) install-alt ) ; fi ; \
236            done ; \
237        fi
238
239#
240# The install-examples target may be used if you want to install the cpi
241# program for others to use.  This is nto part of the default installation
242# because there isn't a good place to put this in the GNU recommended
243# installation targets (its a kind of hardware-architecture-specific
244# documentation)
245install-examples:
246        if [ ! -d ${DESTDIR}${exec_prefix}/examples ] ; then \
247            $(MKDIR_P) ${DESTDIR}${exec_prefix}/examples ; \
248        fi
249        $(INSTALL_PROGRAM) examples/cpi ${DESTDIR}${exec_prefix}/examples/cpi
250
251install-devdocs:
252        (cd doc && $(MAKE) install-devdocs)
253
254# installcheck-postable adds checks that may require special
255# handling. 
256# FIXME: Some install checks require that the Process Manager be
257# started first.  This step does not handle that.
258installcheck-postamble:
259        @if [ -n "@mpe_dir@" -a -d "src/@mpe_dir@" ] ; then \
260            (cd src/@mpe_dir@ && $(MAKE) installcheck-all PACKAGE=$(PACKAGE) ; ) ; fi
261#
262# The documents are shipped as part of the release, and so should be
263# installed from the source directory, not a VPATH build directory
264install_DOC =
265optinstall_DOC = \
266    $(srcdir)/doc/userguide/user.pdf \
267    $(srcdir)/doc/installguide/install.pdf \
268    $(srcdir)/doc/smpd/smpd_pmi.pdf \
269    $(srcdir)/doc/logging/logging.pdf
270installdir_HTML = $(srcdir)/www
271installdir_MAN  = $(srcdir)/man
272#install_BIN =
273#install_SBIN =         
274# Still to do: figure out the appropriate target for installing the html
275# versions of the documents.
Note: See TracBrowser for help on using the browser.