# $Id: base,v 1.40 1998/04/27 21:10:32 balay Exp $ 

PARCH    = hpux
#
#   The name of the C compiler to use, the -Aa option is mandatory
#  and indicates the we are compiling with ANSI C.
#
CC       = cc -Aa +z
#
# If building shared libraries, use the following instead.
# You MUST use +z for shared libraries.
# CC       = cc -Aa +z
# Do similar modifcations for other base.* files which define "CC"
#
#
#  Indicates the version of the compiler you are using; if you do not know
#  how to get the version number then use: unknown
#
CCV      = unknown
#
#   Fortran compiler to use
#
FC       = f77
AR       = ar
RM       = rm -f
RANLIB   = true
#
# The native make on HP-UX is garbage; you must use Gnu make, which is
# probably already installed on your machine (called gnumake). On our 
# machine the Gnu make is installed as make; if yours is called gnumake
# then edit the line below. On newer versions of HP-UX the make may be
# OK, in that case you must remove --no-print-directory from below. It
# is only for Gnu make.
#
#OMAKE    = make --no-print-directory
OMAKE    = /bin/make
SHELL    = /bin/sh
CLINKER  = cc ${COPTFLAGS}
#
#  One must use fort77 rather then f77 because f77 has a different 
#  meaning for the -L option!
#
FLINKER  = fort77 ${FOPTFLAGS} 
#
# For HPUX 9.* use the following instead
#SYS_LIB  =  -lV3 -lU77 
#
SYS_LIB  =  -lV3 -lU77 /usr/lib/libail.sl -lcnx_syscall



SHELL    = /bin/sh

include ${PETSC_DIR}/bmake/common

libc:
	for i in ${OBJSC}; do ${OMAKE} BOPT=${BOPT} libmember LIBMEMBER=$$i ; done

libf:
	for i in ${OBJSF}; do ${OMAKE} BOPT=${BOPT} libmember LIBMEMBER=$$i ; done

libmember:    ${LIBNAME}(${LIBMEMBER})

##############

.F.o:
	-${FC} -c ${FOPTFLAGS} ${FFLAGS} ${CPPFLAGS} $*.F

.F.a: 
	-${FC} -c ${FOPTFLAGS} ${FFLAGS} ${CPPFLAGS} $*.F
	-${AR} cr ${LIBNAME} $*.o
	-${RM} $*.o

SLSUFFIX = sl

#shared: chkopts_basic
#	-echo making shared libraries in ${LDIR} ;\
#	cd ${LDIR}; \
#	for LIBNAME in ${SHLIBS} ; \
#	  do ${LD} -o $$LIBNAME.${SLSUFFIX} -b -B immediate -B nonfatal -a archive  $$LIBNAME.a ; \
#	done

shared: chkopts_basic
	-@echo making shared libraries in ${LDIR} ;\
	cd ${LDIR}; \
	${RM} -rf tmp; \
	mkdir tmp; \
	cd tmp; \
	for LIBNAME in ${SHLIBS} ; \
	do \
	  flag=""; \
	  if [ -f ${LDIR}/$$LIBNAME.${SLSUFFIX} ]; then \
              flag=`find ${LDIR} -type f -name $$LIBNAME.a -newer ${LDIR}/$$LIBNAME.${SLSUFFIX} -print`; \
	  else \
	      flag="true"; \
	  fi; \
	  if [ "$$flag" != "" ]; then \
	    echo "building $$LIBNAME.${SLSUFFIX}"; \
	    ${AR} x ../$$LIBNAME.a ;\
	    ${LD} -b  *.o  -o ../$$LIBNAME.${SLSUFFIX} ; \
	    ${RM} -f * ; \
	  fi; \
	done ;\
	cd ../ ; \
	${RM} -rf tmp 




