# -*- makefile -*- # # $Id: Makefile.am,v 6.39.2.1 2001/05/02 01:41:18 jsquyres Exp $ # # This file is part of the LAM/MPI software package from the # University of Notre Dame. # # See the LICENSE file in the top-level directory for Copyright notices. # AUTOMAKE_OPTIONS = foreign dist-tarZ no-dependencies SUBDIRS = share otb tools etc man DIST_SUBDIRS = $(SUBDIRS) examples EXTRA_DIST = HISTORY HISTORY-6.4 INSTALL INSTALL-6.4 \ LICENSE README RELEASE_NOTES RELEASE_NOTES-6.4 \ VERSION Makefile.depend # 'cause this is just so annoying!!! This may not work anywhere # outside nd.edu. :-) TAR = gtar # This file is only here so that the "tags" target will work properly. # Without *something* in either SOURCES or HEADERS, the tags target # won't work nicely. Ugh. Hopefully this will be fixed in automake # 1.5! noinst_HEADERS = acconfig.h # For building all the examples examples: lam-examples mpi2c++-examples romio-examples @ $(MAKE) examples-done examples-clean: @ echo "Making clean in examples" @ (cd examples; $(MAKE) clean) examples-distclean: @ echo "Making distclean in examples" @ (cd examples; $(MAKE) distclean) lam-examples: @ (cd examples; $(MAKE) all) # Supplement various targets so that we can build ROMIO, MPI 2 C++ # bindings, and examples as well all-local: $(MPI2CPP_BUILD_TARGET) $(ROMIO_BUILD_TARGET) @ $(MAKE) all-done install-exec-local: $(MPI2CPP_INSTALL_TARGET) $(ROMIO_INSTALL_TARGET) clean-local: mpi2c++-clean romio-clean examples-clean @ rm -f .lam_built distclean-local: mpi2c++-distclean romio-distclean examples-distclean uninstall-local: mpi2c++-uninstall romio-uninstall # Be sure to set LAMHOME properly so that hcc/hcp/hf77 use the right # libraries/include files (to avoid conflicts if the user may already # have a LAM installed, and already have LAMHOME set somewhere else). # Before you ask, yes, the final "cat" on the ROMIO_TEMP line is # necessary. If it is not there and grep does not find '-g' in # $(CFLAGS), grep will return 1, which will cause "make" to bail. But # apparently only the *last* command's return code will be returned to # make. Cat will always return 0, which means that "make" won't bail. # Really weird. # Another bug in ROMIO -- we have to go set the unix permissions on # directories under $LAMHOME/include to be 755 again. ROMIO does a # chmod 644 $LAMHOME/include/* -- ick! The ROMIO authors have been # notified of this. 13 June 1999/JMS. # Automakeizm -- check to see if we already built ROMIO. "make # install" implicitly invokes "make all" first (in a roundabout way). # VPATHizms -- check to see if the "romio" dir exists. If it doesn't, # make it. Then we have to go find the configure file. If it's not # in the romio dir, check ../$(top_srcdir)/romio. If it's not there, # barf. Set LAM_TOP_BUILDDIR and LAM_TOP_SRCDIR as appropriate (hcc # uses these variables to reset -I and -L paths). Also, ROMIO doesn't # seem to be able to create its "test" directory properly (if it # doesn't exist), so we have to make it. # libtoolizms -- set the underlying LAMHCC and LAMHF77 to have libtool # in them. Even though ROMIO will not create any executables, and # therefore strictly won't need libtool, during ROMIO's configure, it # checks for libmpi, etc., and makes some dummy executables, and # therefore does need libtool. Ugh!! # Arrgh -- we have to forcibly remove -I$(top_srcdir)/share/include # form $(CFLAGS) because relative to romio/, that directory doesn't # exist, because $(top_srcdir) is replaced *here* -- not in romio/. # Hence $(top_srcdir) is replaced with ., and ./share/include doesn't # exist relative to romio. $#%@#%@#%#$!!! So we have to sed it out # of $(CFLAGS) and put it in a temporary environment variable and use # that instead. romio-all: @ echo "Making all in romio" @ (if test ! -f romio/.lam_built; then $(MAKE) romio-all-redirect; fi) romio-all-redirect: @ echo @ echo "Compiling ROMIO support" @ echo @ (LAM_TOP_BUILDDIR="`pwd`"; \ LAM_TOP_SRCDIR="$$LAM_TOP_BUILDDIR"; \ if test ! -d romio; then \ mkdir -p romio/test; \ fi ; \ cd romio ; \ LAMHCC="$$LAM_TOP_BUILDDIR/libtool --quiet $(CC)" ; \ LAMF77="$$LAM_TOP_BUILDDIR/libtool --quiet $(FC)" ; \ LAMHOME="$(DESTDIR)$(prefix)" ; \ ROMIO_DEBUG="" ; \ ROMIO_TEMP="`echo '$(CFLAGS)' | grep '\-g' | cat`" ; \ if test "$$ROMIO_TEMP" != ""; then \ ROMIO_DEBUG="-debug" ; \ fi ; \ TOP_SRCDIR_ESC="`echo '$(top_srcdir)' | sed -e 's/\//\\\\\//g'`"; \ CFLAGS_ENV="`echo '$(CFLAGS)' | sed -e s/-I$$TOP_SRCDIR_ESC\\\/share\\\/include// | cat`" ; \ TROLLIUSHOME=bogus ; \ unset TROLLIUSHOME ; \ rm -f config.cache ; \ if test -x configure; then \ cdir="." ; \ cd ..; \ LAM_TOP_SRCDIR="`pwd`"; \ cd romio; \ elif test -x ../$(top_srcdir)/romio/configure; then \ cdir="../$(top_srcdir)/romio"; \ tmp="`pwd`"; \ cd ../$(top_srcdir); \ LAM_TOP_SRCDIR="`pwd`"; \ cd $$tmp; \ elif test -x $(top_srcdir)/romio/configure; then \ cdir="$(top_srcdir)/romio"; \ tmp="`pwd`"; \ cd $(top_srcdir); \ LAM_TOP_SRCDIR="`pwd`"; \ cd $$tmp; \ else \ echo "Error! I can't find the configure for the ROMIO package. :-(" ; \ exit 1; \ fi; \ export LAMHCC LAMF77 LAMHOME CFLAGS_ENV LAM_TOP_BUILDDIR LAM_TOP_SRCDIR; \ $$cdir/configure \ --prefix=$(DESTDIR)$(prefix) \ -mpi=lam \ -mpiincdir="$$LAM_TOP_SRCDIR/share/include" \ -cc="$$LAM_TOP_BUILDDIR/tools/hcc/hcc" \ -fc="$$LAM_TOP_BUILDDIR/tools/hf77/hf77" \ $$ROMIO_DEBUG \ -cflags="-lam-building $$CFLAGS_ENV" \ -fflags="-lam-building $(FFLAGS) @ROMIO_FLAGS@" \ @ROMIO_NOF77@ \ -make=$(MAKE) \ -mpilib="$$LAM_TOP_BUILDDIR/share/libmpi.la" \ @ROMIO_USER_FLAGS@ && \ $(MAKE) && touch .lam_built; \ ) romio-install: @ echo "Making install in romio" @ if test ! -f romio/.lam_built ; then \ $(MAKE) romio-all && $(MAKE) romio-install-redirect ; \ else \ $(MAKE) romio-install-redirect; \ fi romio-install-redirect: @ (if test -d romio; then \ cd romio ; \ if test -f Makefile; then \ ( $(MAKE) install PREFIX=$(DESTDIR)$(prefix) \ DATADIR=$(DESTDIR)$(datadir) \ LIBDIR=$(DESTDIR)$(libdir) \ INCLUDEDIR=$(DESTDIR)$(includedir) \ MANDIR=$(DESTDIR)$(mandir); ) \ fi ; \ fi) romio-examples: @ echo "Making examples in romio" @ (if test -d romio; then \ cd romio; \ if test "`echo $(ROMIO_EXAMPLES)`" != "" -a -f Makefile; then \ if test -f .lam_built ; then \ ( cd test; \ unset TROLLIUSHOME LAMHOME LAMHCP LAMHCC; \ $(MAKE) CC=mpicc F77=mpif77 LIBS= USER_CFLAGS="$(CFLAGS)" USER_FFLAGS="$(FFLAGS) $(ROMIO_FLAGS)" ) ; \ else \ echo "*** Error: it does not appear that ROMIO was built yet." ; \ echo "*** I cannot tell if LAM was built yet or not, so I will abort." ; \ echo "*** Please build ROMIO the normal LAM build interface" ; \ echo "*** and then attempt to build the ROMIO again." ; \ fi; \ fi; \ fi ) romio-clean: @ echo "Making clean in romio" @ (if test -d romio; then \ cd romio; \ rm -f .lam_built; \ if test -f Makefile ; then \ $(MAKE) clean; \ fi; \ fi ) romio-distclean: @ echo "Making distclean in romio" @ (if test -d romio; then \ cd romio; \ rm -f .lam_built; \ if test -f Makefile ; \ then $(MAKE) cleanall; \ fi ; \ fi) romio-uninstall: @ echo "Making uninstall in romio" @ if test -f romio/.lam_built ; then \ $(MAKE) romio-uninstall-redirect; \ fi # This is just so ugly; it's painful. romio-uninstall-redirect: @ ( cd romio; $(MAKE) uninstall PREFIX=$(DESTDIR)$(prefix) \ DATADIR=$(DESTDIR)$(datadir) \ LIBDIR=$(DESTDIR)$(libdir) \ INCLUDEDIR=$(DESTDIR)$(includedir) \ MANDIR=$(DESTDIR)$(mandir); \ if test -f $(DESTDIR)$(libdir)/liblammpio.a; then \ rm -f $(DESTDIR)$(libdir)/liblammpio.a; \ fi) # Be sure to set LAMHOME properly so that hcc/hcp/hf77 use the right # libraries/include files (to avoid conflicts if the user may already # have a LAM installed, and already have LAMHOME set somewhere else). # Automakeizm -- check to see if we already built the bindings. "make # install" implicitly invokes "make all" first (in a roundabout way). mpi2c++-all: @ echo "Making all in mpi2c++" @ rm -f tools/hcc/lamboot @ (if test ! -f mpi2c++/.lam_built; then \ $(MAKE) mpi2c++-all-redirect; \ fi) # Ick. Because of the way MPI 2 C++'s configure.in works, it expects # to find an installed LAM/MPI. So it expects to find hcp/lamboot in # the same directory (under the assumption that it's $prefix/bin). So # we have to sym link lamboot into tools/hcc during the build. Ugh! # We really should put a hook in MPI 2 C++ to make this better (a la # ROMIO's hook for MPICH), but not right now... # VPATHizms -- check to see if the "romio" dir exists. If it doesn't, # make it. Then we have to go find the configure file. If it's not # in the romio dir, check ../$(top_srcdir)/romio. If it's not there, # barf. Set LAM_TOP_BUILDDIR and LAM_TOP_SRCDIR as appropriate (hcc # uses these variables to reset -I and -L paths). # libtoolizm -- very, very painful. We must set libtool as the # underlying LAMHCP because mpi2c++'s configure checks for the # presence of libmpi, etc. libtool does not understand C++ compilers # or options, so an additional --mode switch must be insertted. hcc # had to be modified to look for libtool as the first arg in # conjunction with building LAM and compiling C++ programs. It will # insert the right --mode switch, as appropriate. It will also ditch # the libtool arguments if it finds a -E, so that the *real* # underlying compiler can act as a preprocessor. Woof -- what a day. # What sucks even worse is that CVS and the distscript.csh don't # preserve timestamps properly, hence the automake-ized mpi2c++ # project tries to re-run aclocal and friends. This is disasterous, # because we don't have the maintainer tree here -- just the # distribution tarball (e.g., acconfig.h is not shipped, so autoheader # barfs). So we have to do a really gross touch to get all the # timestamps equal. Don't laugh; it's the only thing that I can think # to do. :-( mpi2c++-all-redirect: @ echo @ echo "Compiling MPI 2 C++ bindings support" @ echo @ (LAM_TOP_BUILDDIR="`pwd`"; \ LAM_TOP_SRCDIR=$$LAM_TOP_BUILDDIR; \ if test ! -d mpi2c++; then mkdir mpi2c++; fi ; \ cd mpi2c++ ; \ LAMHCP="$$LAM_TOP_BUILDDIR/libtool --quiet $(CXX)" ; \ PATH="$$LAM_TOP_BUILDDIR/tools/hcc:$$PATH" ; \ CXXFLAGS="$(CXXFLAGS) $(USER_CXXFLAGS)"; \ LDFLAGS="$(LDFLAGS) $(USER_CXXLDFLAGS)"; \ LAMHOME=bogus ; \ TROLLIUSHOME=bogus ; \ unset LAMHOME TROLLIUSHOME; \ rm -f src/libmpi++.a; \ rm -f $$LAM_TOP_BUILDDIR/tools/hcc/lamboot ; \ $(LN_S) $$LAM_TOP_BUILDDIR/tools/lamboot/lamboot $$LAM_TOP_BUILDDIR/tools/hcc/lamboot; \ if test -x configure; then \ cdir="." ; \ cd ..; \ LAM_TOP_SRCDIR="`pwd`"; \ cd mpi2c++; \ elif test -x ../$(top_srcdir)/mpi2c++/configure; then \ cdir="../$(top_srcdir)/mpi2c++"; \ tmp="`pwd`"; \ cd ../$(top_srcdir); \ LAM_TOP_SRCDIR="`pwd`"; \ cd $$tmp; \ elif test -x $(top_srcdir)/mpi2c++/configure; then \ cdir="$(top_srcdir)/mpi2c++"; \ tmp="`pwd`"; \ cd $(top_srcdir); \ LAM_TOP_SRCDIR="`pwd`"; \ cd $$tmp; \ else \ echo "Error! I can't find the configure for the MPI 2 C++ package. :-(" ; \ exit 1; \ fi; \ MAKE="$(MAKE)"; \ export LAMHCP LAMHOME TROLLIUSHOME CXXFLAGS LDFLAGS LAM_TOP_BUILDDIR \ LAM_TOP_SRCDIR PATH MAKE ; \ $$cdir/configure \ --prefix=$(DESTDIR)$(prefix) \ --with-lam=$$LAM_TOP_BUILDDIR/tools/hcc \ $(MPI2CPP_CONFIGURE_EXFLAGS) \ --with-libopt= --with-examopt= \ --with-lam-building && \ $(MAKE) all && touch .lam_built || rm -f $$LAM_TOP_BUILDDIR/tools/hcc/lamboot; \ rm -f $$LAM_TOP_BUILDDIR/tools/hcc/lamboot \ ) mpi2c++-install: @ echo "Making install in mpi2c++" @ if test ! -f mpi2c++/.lam_built ; then \ $(MAKE) mpi2c++-all && $(MAKE) mpi2c++-install-redirect ; \ else \ $(MAKE) mpi2c++-install-redirect; \ fi mpi2c++-install-redirect: @ (if test -d mpi2c++; then \ cd mpi2c++; \ if test -f Makefile ; then \ $(MAKE) install; \ mv $(DESTDIR)$(libdir)/libmpi++.a $(DESTDIR)$(libdir)/liblammpi++.a; \ fi; \ fi) mpi2c++-examples: @ echo "Making examples in mpi2c++" @ (if test -d mpi2c++; then \ cd mpi2c++; \ if test "`echo $(MPI2CPP_EXAMPLES)`" != "" -a -f Makefile; then \ if test -f .lam_built ; then \ unset TROLLIUSHOME LAMHOME LAMHCC LAMHCP; \ $(MAKE) examples; \ else \ echo "*** Error: it does not appear that the MPI 2 C++ bindings were built yet." ; \ echo "*** I cannot tell if LAM was built yet or not, so I will abort." ; \ echo "*** Please build the MPI 2 C++ bindings through the normal LAM build interface" ; \ echo "*** and then attempt to build the MPI 2 C++ examples again." ; \ exit 1 ; \ fi; \ fi; \ fi) mpi2c++-clean: @ echo "Making clean in mpi2c++" @ (if test -d mpi2c++; then \ cd mpi2c++; \ rm -f .lam_built; \ if test -f Makefile ; then \ $(MAKE) clean; \ fi; \ fi) mpi2c++-distclean: @ echo "Making distclean in mpi2c++" @ (if test -d mpi2c++; then \ cd mpi2c++; \ rm -f .lam_built; \ if test -f Makefile ; then \ $(MAKE) distclean; \ fi; \ fi) mpi2c++-uninstall: @ echo "Making uninstall in mpi2c++" @ if test -f mpi2c++/.lam_built ; then \ $(MAKE) mpi2c++-uninstall-redirect; \ fi mpi2c++-uninstall-redirect: @ (if test -d mpi2c++; then \ cd mpi2c++; $(MAKE) uninstall; \ if test -f $(DESTDIR)$(libdir)/liblammpi++.a; then \ rm -f $(DESTDIR)$(libdir)/liblammpi++.a; \ fi; \ fi) # # For printing friendly messages at the end :-) # examples-done: @echo @echo "===========================================================================" @echo @echo "The examples for LAM/MPI $(LAM_VERSION) have been built." @echo @echo "Look in the subdirectories of examples/ for each of" @echo "the example programs. Each subdirectory has a README file" @echo "that explains how to run it, etc." @echo @echo "===========================================================================" all-done: .lam_built .lam_built: @ echo @ echo "===========================================================================" @ echo @ echo "LAM/MPI $(LAM_VERSION) has been built." @ echo @ echo "You now need to install it with \"make install\"" @ echo @ echo "===========================================================================" @ touch .lam_built install-exec-hook: @echo @echo "===========================================================================" @echo @echo "Installation of LAM/MPI $(LAM_VERSION) is complete." @echo @echo "Be sure to visit the LAM/MPI web page: http://www.lam-mpi.org/" @echo @echo "The FAQ and LAM mailing list archives (both accessable from the web page)" @echo "contain much information about getting started with LAM/MPI, as well as" @echo "solutions to common problems." @echo @echo "===========================================================================" @echo # # For making the distribution. LAM maintainers only. It won't work # for you. :-) # # Requires the "sowing" package from ftp://ftp.mcs.anl.gov/ to make # the man pages. # dist-hook: csh -f config/distscript.csh $(DESTDIR)$(distdir) # # This is fairly fragile; don't interrupt it! # lamdist64: mv VERSION VERSION.save cp VERSION-6.4 VERSION p="`pwd`"; \ lv="`sh config/get_lam_version $$p --full`"; \ $(MAKE) VERSION="$$lv" dist rm -f VERSION mv VERSION.save VERSION lamdist: dist @(mkdir /tmp/lam-dist.$$; \ chmod 700 /tmp/lam-dist.$$; \ p="`pwd`"; \ cd /tmp/lam-dist.$$; \ echo "*** Making lam-$(LAM_VERSION).tar.Z..."; \ cp $$p/lam-$(LAM_VERSION).tar.gz .; \ gunzip lam-$(LAM_VERSION).tar.gz; \ compress lam-$(LAM_VERSION).tar; \ mv lam-$(LAM_VERSION).tar.Z $$p; \ echo "*** Making lam-$(LAM_VERSION).tar.bz2..."; \ cp $$p/lam-$(LAM_VERSION).tar.gz .; \ gunzip lam-$(LAM_VERSION).tar.gz; \ bzip2 lam-$(LAM_VERSION).tar; \ mv lam-$(LAM_VERSION).tar.bz2 $$p; \ cd $p;\ rm -rf /tmp/lam-dist.$$; ) # # No SOURCEFILES, but we do need the rule # include $(top_srcdir)/Makefile.depend