CC       = xlc -Drs6000 -D_POSIX_SOURCE
FC       = xlf 
AR       = ar
RM       = rm
RANLIB   = ranlib
SHELL    = /bin/sh
LINKER   = xlf 
# Pick these based on main program language
CLINKER = xlc
# Fortran programs MUST be linked statically (no shared libraries) for them
# to run on systems that haven't licensed a Fortran runtime or compiler.
# Since this is necessary for the IBM SP-1 (MPP), I've made this the default.
FLINKER = xlf -bnso -bI:/lib/syscalls.exp
#
# Notes on shared libraries:
# To force an image to be bound without shared objects, use
# -bnso -bI:/lib/syscalls.exp 
# on the link line.  This is equivalent to the Sun -Bstatic .
#
# Blas libraries
BLAS1 = -lblas
BLAS2 = -lblas
BLAS3 = -lblas
BLAS  = -lblas
LAPACK = $(ITOOLSDIR)/libs/libs$(BOPT)/rs6000/liblapack.a

# IBM's make is one of the many that can't handle libraries properly
libbuild: $(SOURCE)
	for i in $(OBJS); do make libmember LIBMEMBER=$$i ; done
lib: $(SOURCE)
	for i in $(OBJS); do make libmember LIBMEMBER=$$i ; done
# liball is a version that builds the source files all at once and then
# adds them, again all at once, to the archive.  Because of the poor
# performance of some archive programs, this can significantly improve
# the speed of an original installation.
liball: $(SOURCEC) $(SOURCEF)
	if [ "$(SOURCEC)" != "" ] ; then \
	     $(CC) -c $(CFLAGS) $(BASEOPT) $(SOURCEC) ;\
	fi
	if [ "$(SOURCEF)" != "" ] ; then \
	     $(FC) -c $(FFLAGS) $(BASEOPTF) $(SOURCEF) ;\
	fi
	$(AR) clq $(LIBNAME) $(OBJS)
	$(RM) $(OBJS)
	

libmember:    $(LIBNAME)($(LIBMEMBER))

deletelibs:
	if (test -w $(LIBNAME)) then $(RM) $(LIBNAME) ; fi

lint:
	lint -cvhu -DLINT $(CFLAGS) $(SOURCE)

# AIX apparently does not remotely resemble EITHER System V or BSD 4.x.
# By defining _POSIX_SOURCE , there is some hope that it will pretend that
# it is some form of Unix.
.c.a: 
	$(CC) -c $(CFLAGS) $(BASEOPT) $*.c
	$(AR) cr $(LIBNAME) $*.o
	rm $*.o
.c.o: 
	$(CC) -c $(CFLAGS) $(BASEOPT) $*.c
.f.o: 
	$(FC) -c $(FFLAGS) $(BASEOPTF) $*.f
.f.a: 
	$(FC) -c $(FFLAGS) $(BASEOPTF) $*.f
	$(AR) cr $(LIBNAME) $*.o
	rm $*.o
