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

# gmake makefile for a usp program.
# Changes:
# 09/27/89	Terri Fischer
# 09/10/90	Terri Fischer	updated

# get the initialization files from .../etc

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

#  the libraray names (e.g. "ut") get translated into full path names
#  via the info in the initialization files above

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

#  define compiler flags

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


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

# Warning:
# Don't leave files with the same name but different suffixes in your
# source directory, it will confuse the compilers. Make sure you
# delete any .f files associated with .F files that afp might have
# left around before trying to recompile.

F77Srcs         := scor.F misc.F prntem.F stscal.F bldsts.F errtab.F evpikr.F \
                   evtime.F errcal.F iterat.F freqer.F editpk.F aplycr.F \
                   matrix.F fdstat.F opnprm.F shift.F elopen.F rotate.F

SafeFiles	:= ${AllSrcs} ${wildcard *.1} Makefile

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

targets : ${PRGM}

all :  safe clean targets remotes install


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

#purify:	${F77Objs}
#	purify ${LinkC} -o $@.tst ${F77Objs} ${Libes} -lF77

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

remotes:	RemoteCopies RemoteMakes

install:
	mancopy 1 scorusp
	execopy  scorusp
	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 ${wildcard ShdCpy*}
