########################################################################
#                 copyright 2001, Amoco Production Company             #
#                             All Rights Reserved                      #
#                     an affiliate of BP America Inc.                  #
########################################################################

# gmake makefile for a usp program.

include ${DEPTROOT}/usp/etc/gmake.init
include ${DEPTROOT}/etc/gmake.mathadv

Libes	:=	 ${MathAdvO} -lut -lieeeio -lfu
#
# Add an architecture library variable which may be set in one of the gmake
# rules files referenced above. Initialized with SOLARIS port.. - jmw 8/9/93
#
Libes	:=	${Libes} ${${TArchDir}Libes}

#  define compiler flags

CCFlags		:=	${CCFlags}
sunCCFlags	:=	${sunCCFlags} -DSUN -O
crayCCFlags	:=	${crayCCFlags} -DCRAY

sun4FCFlags	:=	${sun4FCFlags} -DSUN -O
crayFCFlags	:=	${crayFCFlags} -DCRAY -Wf"-astack" -Wf"-es" -Wf"-dp"

F77Srcs	:=	psdm3d.F  PsdmMap.F RedFlag.F PsdmApply.F fcuint.F rinter.F verbal.F help.F cmdln.F

SafeFiles :=	${F77Srcs} ${wildcard *.1} Makefile  psdm3d.pattern

PRGM     :=	${LocalBin}/psdm3d
#PRGM     :=	psdm3d

targets : ${PRGM}

all :  safe clean targets remotes install

${PRGM}   :  ${F77Objs}
	${LinkF} -o $@ ${F77Objs} ${Libes}

#  do remote make (i.e. in our case the cray, hp, convex, etc...)

remotes:	RemoteCopies RemoteMakes

install:
	mancopy 1 psdm3d
	execopy  psdm3d
	shadowexec -v ${MAKE} install

RemoteCopies:	${SafeFiles}
	shadowcopy -v $?
	touch RemoteCopies

RemoteMakes:	${SafeFiles}
	shadowexec ${MAKE}
	touch RemoteMakes

safe:	.safe.${jdate}.Z

.safe.${jdate}.Z:	${SafeFiles}
	${MakeSafe}

include ${TArchDir}/included.files

#  generate include files
#  date stamp source

${TArchDir}/included.files: ${F77Srcs}
	usp_d_stamp
	${FindIncludes}
 
clean:
	-rm ${TArchDir}/included.files ${AllObjs} ${PRGM} date.h RemoteCopies RemoteMakes ${wildcard ShdCpy*}
