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

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

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

#  define compiler flags

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


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

F77Srcs		:= recshift.F cmdln.F verbal.F help.F interp.F \
		   PickCount.F Xsd_ReadPicks.F Xsd_ReadHeaderPicks.F \
		   GetShift.F timrd1.F centr1.F trp2d.F flat.F \
		   sailshift.F trimc.F

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

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

targets : ${PRGM}

all :  safe clean targets remotes install

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

#  do remote make (i.e. in our case the cray)

remotes:	RemoteCopies RemoteMakes

install:
	mancopy 1 recshift
	execopy  recshift
	shadowexec -v ${MAKE} 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

#  generate include files
#  date stamp source

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

clean:
	-rm ${TArchDir}/included.files ${AllObjs} ${PRGM} \
	date.h RemoteCopies RemoteMakes
