ALL: default
##### User configurable options #####

ARCH        = @ARCH@
COMM        = @COMM@
BOPT        = @BOPT@
P4_DIR      = @P4_DIR@
TOOLS_DIR   = @TOOLS_DIR@
MPIR_HOME   = @MPIR_HOME@
CC          = @CC@
CLINKER     = $(CC)
CCC         = @CPP_COMPILER@
CCLINKER    = $(CCC)
F77         = @F77@
FLINKER     = $(F77)
AR          = @AR@
RANLIB      = @RANLIB@
PROFILING   = $(PMPILIB)
OPTFLAGS    = @OPTFLAGS@
MPE_LIBS    = @MPE_LIBS@
MPE_DIR     = @MPE_DIR@
LIB_PATH    = @LIB_PATH@ @X_LIB@
FLIB_PATH   = @FLIB_PATH@
LIB_LIST    = @LIB_LIST@
MPE_GRAPH   = @MPE_GRAPHICS@
#
INCLUDE_DIR = @USER_INCLUDE_PATH@ -I$(MPIR_HOME)/include 
DEVICE      = @DEVICE@

### End User configurable options ###

CFLAGS	  = @USER_CFLAGS@ $(OPTFLAGS) $(INCLUDE_DIR) -DMPI_$(ARCH) \
	    $(PROF_FLG)
CFLAGSMPE = $(CFLAGS) -I$(MPE_DIR) $(MPE_GRAPH)
CCFLAGS	  = $(CFLAGS)
#FFLAGS	  = '-qdpc=e' 
FFLAGS	  = @FFLAGS@ $(OPTFLAGS)
MPILIB	  = $(MPIR_HOME)/lib/$(ARCH)/$(COMM)/libmpi.a 
MPIPPLIB  = $(MPIR_HOME)/lib/$(ARCH)/$(COMM)/libmpi++.a

LIBS	  = $(LIB_PATH) $(LIB_LIST)
FLIBS	  = $(FLIB_PATH) $(LIB_LIST)
LIBSPP	  = $(MPIPPLIB) $(LIBS)
EXECS	  = systest

default: $(EXECS)

all: default

#
# BSD 4.4 derived systems have a make which is INCOMPATIBLE with all other
# versions of make (!!!).  FreeBSD is one such system.  In these systems,
# the 'include' keyword has been DELETED and replaced with #include (Heaven
# help you if you expected # to start comments!).  Because of this
# inconsistant behavior, we can't use include to simplify the creation 
# of makefiles
#
# Just to make things interesting, some makes (FreeBSD, for one) complain
# if the comments do not START in column 1.  I've also changed include to
# -include- just to head off any other problems
#
# -include- $(MPIR_HOME)/profiling/lib/Makefile.timing
# -include- $(MPIR_HOME)/profiling/lib/Makefile.logging
# -include- $(MPIR_HOME)/profiling/lib/Makefile.vismess
# -include- $(MPIR_HOME)/profiling/lib/Makefile.allprof
#
# The following is the contents of $(MPIR_HOME)/profiling/lib/Makefile.logging
# If you think that this is ridiculous, then contact the BSD 4.4 people and
# ask them to conform to existing practice.
# (eventually we'll make configure determine if 'include' is broken and
# add a @ MAKEINCLUDE @ substitution.)

# Add $(PROF_OBJ) to the dependency line
# Add $(PROF_FLG) to the compile line
# Add $(PROF_LIB) to the link line, after the main code but before -lmpi
# Add $(PROF_CLN) to the clean line

WGEN_DIR  = $(MPIR_HOME)/profiling/wrappergen
PROF_DIR  = $(MPIR_HOME)/profiling/lib
PROF_DEF  = $(PROF_DIR)/log_wrappers.w
PROF_ARG  = -w $(PROF_DIR)/log_wrappers.w -f $(PROF_DIR)/pt2pt_fn
PROF_SRC  = log_wrappers.c
PROF_CLN  = $(PROF_SRC) *.log
PROF_OBJ  = log_wrappers.o
PROF_FLG  = -I$(MPIR_HOME)/profiling/lib -I$(MPE_DIR)
PROF_LIB  = $(PROF_OBJ) -lpmpi -lmpe

$(WGEN_DIR)/wrappergen:
	(cd $(WGEN_DIR); make wrappergen)

$(PROF_SRC): $(PROF_DEF) $(WGEN_DIR)/wrappergen
	$(WGEN_DIR)/wrappergen $(PROF_ARG) -o $(PROF_SRC)

# End of $(MPIR_HOME)/profiling/lib/Makefile.logging 


systest: systest.o $(MPIR_HOME)/include/mpir.h $(PROF_OBJ) $(MPILIB)
	$(CLINKER) $(OPTFLAGS) -o systest systest.o \
	$(LIB_PATH) $(PROF_LIB) $(LIB_LIST) -lm

clean:
	/bin/rm -f *.o *~ PI* $(EXECS)

.c.o:
	$(CC) $(CFLAGS) -c $*.c
.f.o:
	$(F77) $(FFLAGS) -c $*.f

