# Generated automatically from Makefile.in by configure.
#  (C) 1993 by Argonne National Laboratory and Mississipi State University.
#      All rights reserved.  See COPYRIGHT in top-level directory.
#

CC          = cc
F77         = g77
F90         = false
AR          = ar crl
RANLIB      = ranlib
OPTFLAGS    = -O2
OPTFLAGSC   = 
prefix      = /usr/rels/mpich-1.2..4pre2
top_srcdir  = /usr/rels/mpich-1.2..4pre2
srcdir      = /usr/rels/mpich-1.2..4pre2/src/env
libbuild_dir = /usr/rels/mpich-1.2..4pre2/lib
libdir      = ${prefix}/lib

DEFS        = -DHAVE_CONFIG_H ${MPIPROFILE} -I. -I${srcdir} -I/usr/rels/mpich-1.2..4pre2/include -I/usr/rels/mpich-1.2..4pre2/include -I/usr/rels/mpich-1.2..4pre2/mpid/ch_gm
CFLAGS      =  -I/GM/binary/include -I/GM/include -DGM_DEV -DFORTRANDOUBLEUNDERSCORE -DHAVE_MPICHCONF_H 

SHELL       = /bin/sh

VPATH=.:$(srcdir)

.SUFFIXES:
.SUFFIXES: .o .c .f

LIBS = ${libbuild_dir}/libmpich.a

FFLAGS =  ${OPTFLAGS} 

MPI_FOBJECTS = farg.o initfcmn.o initfdte.o
MPI_COBJECTS = abort.o debugutil.o init.o initthread.o initutil.o \
	finalize.o initialize.o \
	errorstring.o fstrutils.o initdte.o \
	getpname.o errcreate.o errset.o errget.o errfree.o errclass.o \
	wtime.o wtick.o nerrmsg.o getversion.o msgqdllloc.o
MPI_FSOURCES = farg.f initfcmn.f initfdte.f
MPI_CSOURCES = abort.c debugutil.c init.c initthread.c initutil.c \
	finalize.c fstrutils.c initialize.c errorstring.c initdte.c \
	getpname.c errcreate.c errset.c errget.c errfree.c errclass.c \
	wtime.c wtick.c nerrmsg.c getversion.c msgqdllloc.c
MPI_TSOURCES = errclass.c 
MPI_WSOURCES = abortf.c finalizef.c errclassf.c
MPI_WOBJECTS = initializef.o abortf.o initf.o finalizef.o errorstringf.o \
	getpnamef.o errcreatef.o errsetf.o errgetf.o errfreef.o errclassf.o \
	wtimef.o wtickf.o getversionf.o

MPI_SOURCES = ${MPI_CSOURCES} ${MPI_WSOURCES}
MPI_OBJECTS = ${MPI_COBJECTS} ${MPI_WOBJECTS}

default: ${libbuild_dir}/libmpich.a
	if [ -n "$(MPI_FOBJECTS)" ] ; then \
	make --no-print-directory ${libbuild_dir}/libmpichf.a ; fi


profile: ${libbuild_dir}/libpmpich.a

wrapperlib: ${MPI_WOBJECTS}
	${AR} ${libbuild_dir}/libfmpich.a $?	

# default_all is the same as default, but without the RANLIB.  This
# can speed up the build (ranlibs can take a LONG time).  profile_all 
# is the same, but for the profile library
default_all: default_objs
default_objs: ${MPI_OBJECTS} $(MPI_FOBJECTS) 
	${AR} ${libbuild_dir}/libmpich.a $?
	if [ -n "$(MPI_FOBJECTS)" ] ; then \
	make --no-print-directory ${libbuild_dir}/libmpichf.a ; fi
profile_all: ${MPI_OBJECTS} $(MPI_FOBJECTS)
	${AR} ${libbuild_dir}/libpmpich.a $?

${MPI_OBJECTS} :  ${MPI_INCLUDE}
${MPI_FOBJECTS} :  ${MPI_INCLUDE}

mpe_debug_objs:  mpehname.o
	${AR} ${libbuild_dir}/libmpich.a  mpehname.o
	${RANLIB} ${libbuild_dir}/libmpich.a

# 
# This is needed for initutil.c
#setlinks:
#	if [ ! -s ${top_srcdir}/include/mpeexten.h ] ; then \
#	    (cd ${top_srcdir}/include ; \
#		ln -s ${top_srcdir}/mpe/mpeexten.h mpeexten.h ) ; fi

source_names:
	@echo ${MPI_CSOURCES}

#
# This gives -mpiversion the ability to echo the configuration arguments.
#initutil.o: ${srcdir}/initutil.c
#	${CC} ${DEFS} ${INCLUDES} ${CFLAGS} -c \
#	-DCONFIGURE_ARGS_CLEAN='"-nodevdebug -cflags=-I/GM/binary/include -I/GM/include -opt=-O2 -device=ch_gm -noromio -noc++ --lib=-L/GM/binary/lib/ -L/GM/lib/ -lgm -arch=LINUX -fc=g77 -rsh=rsh"' \
#	-DMPIRUN_MACHINE='"ch_gm"' \
#	-DMPIRUN_DEVICE='"ch_gm"' \
#	${srcdir}/initutil.c

mpich.En_US.cat: ${srcdir}/mpich.En_US.msg
	gencat mpich.En_US.cat ${srcdir}/mpich.En_US.msg

# Create the message catalog files.  This will add ALL files, including the
# US English one
# The .m files are requires on IRIX and perhaps other platforms
# The files are put into the libbuild directory when building.  When
# installing, they are put into messagecat_dir.
message_cat: mpich.En_US.cat
	for file in ${srcdir}/mpich.*.msg ; do \
	fileroot=`basename $file .msg` ; \
	/bin/rm -f $fileroot.cat $fileroot.cat.m ; \
	gencat $fileroot.cat $file > /dev/null 2>&1 ; \
	if test -s $fileroot.cat ; then \
	    /bin/rm -f ${libbuild_dir}/$fileroot.cat ; \
	    cp $fileroot.cat ${libbuild_dir} ; \
	fi ; \
	if test -s $fileroot.cat.m ; then \
	    /bin/rm -f ${libbuild_dir}/$fileroot.cat.m ; \
	    cp $fileroot.cat.m ${libbuild_dir} ; \
	fi ; \
	done )
	if test -s mpich.En_US.cat ; then \
	    if test ! -s ${libbuild_dir}/mpich.cat ; then \
	       (cd ${libbuild_dir} ; ln -s mpich.En_US.cat mpich.cat ) \
	    fi \
	else \
	    echo "Could not create catalog. US English messages will be used" ; \
	fi

#
# We should really put this entire directory AFTER src/infoexport; then we
# can test on the existance of the library.  
# We use PREFIX instead of MPIR_HOME so that the result of installing
# the MPI libraries will work
msgqdllloc.o: ${top_srcdir}/src/env/msgqdllloc.c
	if test -n "ignore" -a "ignore" != "ignore" ; then \
	  ${CC} ${DEFS} ${CFLAGS} -c  \
	  -DMPICH_INFODLL_LOC='"${prefix}/lib/libtvmpich.so"' \
		  ${top_srcdir}/src/env/msgqdllloc.c ; \
	else \
	    ${CC} ${DEFS} ${CFLAGS} -c ${top_srcdir}/src/env/msgqdllloc.c ; \
	fi

.c.o:
	${CC} ${DEFS} ${INCLUDES} ${CFLAGS} ${OPTFLAGSC} ${OPTFLAGS} -c $<
# For VPATH builds, some Fortran compilers use the directory of the file 
# rather than the directory of the build.
.f.o:
	if [ -n "-I" ] ; then \
	    ${F77} -I. ${FFLAGS} -c $< ; \
	else \
	    if [ ! -s $*.f ] ; then cp $< . ; fi ; \
	    ${F77} ${FFLAGS} -c $*.f ; \
	fi

# Always compile this with -g
# Warning: some systems might not support -g.  We'll deal with that when
# we have to.  We use the part of CFLAGS that does not include the
# optimization switches.
debugutil.o: ${srcdir}/debugutil.c
	${CC} -g ${DEFS} ${INCLUDES}  -I/GM/binary/include -I/GM/include -DGM_DEV -DFORTRANDOUBLEUNDERSCORE -DHAVE_MPICHCONF_H ${INCLUDE_DIR} ${MPIPROFILE} -c \
		${srcdir}/debugutil.c

# GETNAME_DEFS are needed by mpehname.c; these need mpe includes
mpehname.o: ${top_srcdir}/mpe/mpehname.c
	${CC} ${DEFS} ${CFLAGS}  -DHAVE_UNAME=1 -DHAVE_NETDB_H=1 -DHAVE_GETHOSTBYNAME=1 -c -I${top_srcdir}/mpe \
		${top_srcdir}/mpe/mpehname.c 
# Note that we remove the link after we use it.
dbxerr.o: ${top_srcdir}/mpe/dbxerr.c
	${CC} ${DEFS} ${CFLAGS}  -DHAVE_UNAME=1 -DHAVE_NETDB_H=1 -DHAVE_GETHOSTBYNAME=1 -c -I${top_srcdir}/mpe \
		${top_srcdir}/mpe/dbxerr.c 
	rm -f dbxerr.c
# errmsg needs to know about NLS definitions.
nerrmsg.o: ${srcdir}/nerrmsg.c mpierrstrings.h
	${CC} ${DEFS} ${CFLAGS} $(OPTFLAGS)  -DHAVE_CATOPEN=1 -DHAVE_CATCLOSE=1 -DHAVE_CATGETS=1 -DHAVE_GENCAT=1 -DHAVE_NL_TYPES_H=1 -c ${srcdir}/nerrmsg.c

farg90.o: ${srcdir}/farg90.f
	@if [ -n "$(F90)" ] ; then \
	  $(F90) -c ${FFLAGS} ${srcdir}/farg90.f ; \
	  cp farg90.o ${libbuild_dir} ; \
	fi

${libbuild_dir}/libmpich.a: \
		${MPI_OBJECTS} $(MPI_FOBJECTS) 
	${AR} $@ $?
	${RANLIB} $@

${libbuild_dir}/libpmpich.a: ${MPI_OBJECTS} $(MPI_FOBJECTS)
	${AR} $@ $?
	${RANLIB} $@
# This library is created to contain ONLY the Fortran MPI_Init and
# called routines.  This is needed for shared library support.
${libbuild_dir}/libmpichf.a: initf.o farg.o
	${AR} $@ initf.o farg.o
	${RANLIB} $@
tstmsg:
	${CC} ${CFLAGS} -DTEST_MSGS  -DHAVE_CATOPEN=1 -DHAVE_CATCLOSE=1 -DHAVE_CATGETS=1 -DHAVE_GENCAT=1 -DHAVE_NL_TYPES_H=1 -c nerrmsg.c
	cc -o nerrmsg nerrmsg.o ${libbuild_dir}/libmpich.a
	/bin/rm -f nerrmsg.o

# We need to clean the srcdir of any .o files because they can confuse the
# VPATH build process
clean:
	/bin/rm -f *.o *~ ${srcdir}/*.o
