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

# gmake makefile for usp program.

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

LibFtnHP-UX= -lU77 -lm

Libes		:=  ${MathAdvO} -lut -lieeeio -lfu
Libes	:=	${Libes} ${${TArchDir}Libes}

CCFlags		:=	${CCFlags} -O
sun3CCFlags	:=	${sun3CCFlags} -DSUN
sun3fpaCCFlags	:=	${sun3fpaCCFlags} -DSUN -ffpa
sun4CCFlags	:=	${sun4CCFlags} -DSUN
crayCCFlags	:=	${crayCCFlags} -DCRAY


FCFlags		:=	${FCFlags}
sun3FCFlags	:=	${sun3FCFlags} -DSUN -O2
sun3fpaFCFlags	:=	${sun3fpaFCFlags} -DSUN -ffpa -O
sun4FCFlags	:=	${sun4FCFlags} -DSUN -O
crayFCFlags	:=	${crayFCFlags} -DCRAY -Wf"-astack" -Wf"-es" -Wf"-dp"
crayxeaFCFlags  :=      ${crayxeaFCFlags} -DCRAY -Wf"-astack" -Wf"-eus" -Wf"-dp"
convexFCFlags	:=      ${convexFCFlags} -re -O2

hpFLFlags       :=      ${hpFLFlags} +U77

F77Srcs         := prepmig.F \
prepsub.F 			\
interph.F 			\
rdheader.F			\
vspindx.F			\
regindx.F			\
crkindx.F			\
reproject.F			\
chkindex.F
CSrcs		:= 


SafeFiles	:= ${AllSrcs} Makefile prepmig.1 prepmig.pattern

PRGM		:= ${LocalBin}/prepmig

targets : ${PRGM}

all :  safe targets install remotes

${PRGM}    :  ${AllObjs}
	${LinkF} -o $@ ${AllObjs} ${Libes} ${LibFtn${TArchDir}}

remotes:	RemoteCopies RemoteMakes

install:
	mancopy 1 prepmig
	execopy  prepmig
	shadowexec -v execopy install

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

RemoteMakes:	${SafeFiles}
	shadowexec -v ${MAKE} && touch RemoteMakes

safe:	.safe.${jdate}.Z

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

include ${TArchDir}/included.files

${TArchDir}/included.files: ${AllSrcs}
	usp_d_stamp
	${FindIncludes}

clean:
	-rm ${TArchDir}/included.files ${AllObjs} ${PRGM} \
	RemoteCopies RemoteMakes ${wildcard ShdCpy*}
