# File         : Makefile
# Author       : Sung-Hoon Ko, Xinying Li
# Created      : Thu Apr 1998
# Revision     : ver 1.1
# Updated      : $Date: 1998/08/29 22:14:19 $
# Copyright: Northeast Parallel Architectures Center at Syracuse University 1998

SHELL       = /bin/sh


srcdir = @srcdir@
top_srcdir = @top_srcdir@

VPATH = .:${srcdir}


CC = @MPIPATH@/bin/@CC@
LD = @MPIPATH@/bin/@CC@

JDK = @JAVA@

MPI_INC = @MPI_INC@
MPI_LIB = @MPI_LIB@

CCLIBKEY = @CCLIBKEY@

INCLUDES = -I$(JDK)/include -I$(JDK)/include/@JOS@ -I$(MPI_INC)

CLASSES = @top_srcdir@/lib/classes
LIB = @top_srcdir@/lib

TITLE = mpi
PFX = $(TITLE)_
PKG = $(TITLE).
DIR = $(TITLE)/

RM = rm
CP = cp
MV = mv

JC = $(JDK)/bin/javac
JH = $(JDK)/bin/javah
JFLAG = -jni
CFLAGS = -c

LDFLAG = @LDFLAG@
#LDFLAGS = -G # solaris native compiler and linker
#LDFLAGS = -shared #gnu compiler and linker ; irix


OBJ = $(PFX)MPI.o       $(PFX)Comm.o      \
      $(PFX)Op.o        $(PFX)Datatype.o  \
      $(PFX)Intracomm.o $(PFX)Intercomm.o \
      $(PFX)Cartcomm.o  $(PFX)Graphcomm.o \
      $(PFX)Group.o     $(PFX)Status.o    \
      $(PFX)Request.o   $(PFX)Prequest.o  \
      $(PFX)Errhandler.o



all:: $(LIB)/lib$(TITLE).so 



$(LIB)/lib$(TITLE).so : $(OBJ)
	  $(CC) $(LDFLAG) -o $(LIB)/libmpijava.so \
                -L$(MPI_LIB) $(OBJ) $(CCLIBKEY); 



.SUFFIXES:
.SUFFIXES: .c .C .o

.C.o:
	$(CXX) -c $(INCLUDES)  -o $@ $*.C

.c.o:
	$(CC) -c $(INCLUDES)  -o $@ $*.c



$(PFX)MPI.o :        $(PFX)MPI.c $(PFX)MPI.h
$(PFX)Comm.o :       $(PFX)Comm.c $(PFX)Comm.h
$(PFX)Intercomm.o :  $(PFX)Intercomm.c $(PFX)Intercomm.h
$(PFX)Intracomm.o :  $(PFX)Intracomm.c $(PFX)Intracomm.h
$(PFX)Status.o :     $(PFX)Status.c $(PFX)Status.h
$(PFX)Op.o :         $(PFX)Op.c $(PFX)Op.h
$(PFX)Request.o :    $(PFX)Request.c $(PFX)Request.h
$(PFX)Prequest.o :   $(PFX)Prequest.c $(PFX)Prequest.h
$(PFX)Datatype.o :   $(PFX)Datatype.c $(PFX)Datatype.h
$(PFX)Cartcomm.o :   $(PFX)Cartcomm.c $(PFX)Cartcomm.h
$(PFX)Graphcomm.o :  $(PFX)Graphcomm.c $(PFX)Graphcomm.h
$(PFX)Group.o :      $(PFX)Group.c $(PFX)Group.h
$(PFX)Errhandler.o : $(PFX)Errhandler.c $(PFX)Errhandler.h

clean :
	$(RM) -f $(PFX)*.h
	$(RM) -f *.o 
	$(RM) -f $(LIB)/lib*.so

