#
#   If you do not have the XlC compiler then use the xlc compiler below
# we default to xlC since it generates faster code.
#
CC       = xlC -DPARCH_rs6000 
FC       = xlf 
AR       = ar
RM       = rm -f
RANLIB   = ranlib
OMAKE    = make
SHELL    = /bin/sh
# 
#  Some systems may require instead
# CLINKER = xlc $(BASEOPT) -bI:/usr/lpp/xlf/lib/lowsys.exp 
# CLINKER = xlc $(BASEOPT)
#  Next line is a hack for IBM SPx, you should remove it if 
# you are running on plain IBM RS6000 workstations and replace 
# with one of the above.
#
CLINKER  = mpcc $(BASEOPT) 
#
# Fortran programs MUST be linked statically (no shared libraries) for them
# to run on systems that haven't licensed a Fortran runtime or compiler.
# This used to be the default, but I've removed it since most system have
# licensed runtimes
#
# FLINKER = xlf 
#  Next line is a hack for IBM SPx, you should remove it if 
# you are running on plain IBM RS6000 workstations and replace 
# with the above.
#
FLINKER = mpxlf $(BASEOPTF)

SHELL   = /bin/sh
SYS_LIB =

#these flags are used by configure
CONF    = -DHAVE_STROPTS_H -DHAVE_SEARCH_H -DHAVE_PWD_H -DHAVE_STDLIB_H \
          -DHAVE_STRING_H -DHAVE_MALLOC_H -DHAVE_X11 -D_POSIX_SOURCE \
          -DHAVE_DRAND48  -DHAVE_GETDOMAINNAME -D_XOPEN_SOURCE \
          -DUSES_VOID_VOID_VOID_VOID_TSEARCH

include $(PARPRE_DIR)/bmake/common

libc:
	 for i in $(OBJSC); do $(OMAKE) libmember LIBMEMBER=$$i ; done

libf:
	for i in $(OBJSF); do $(OMAKE) libmember LIBMEMBER=$$i ; done

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

# 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
.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

.SUFFIXES: $(SUFFIXES) .F
.SUFFIXES: $(SUFFIXES) .r

# This F.f rule ensures that the old *.f files are removed.
.F.f:
	-$(RM) $*.f
	-$(CC) $(CFLAGS) -E $< | grep -v '^ *#' > $*.f

.F.o:
	-$(RM) $*.f
	-$(CC) $(CFLAGS) -E $< | grep -v '^ *#' > $*.f
	-$(FC) -c $(FFLAGS) $(BASEOPTF) $*.f
	-$(RM) $*.f

.F.a:
	-$(RM) $*.f
	-$(CC) $(CFLAGS) -E $< | grep -v '^ *#' > $*.f
	-$(FC) -c $(FFLAGS) $(BASEOPTF) $*.f
	-$(AR) cr $(LIBNAME) $*.o
	-$(RM) $*.o	$*.f

