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


# get the initialization files from .../etc

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

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

#  define compiler flags

CCFlags		:=	${CCFlags}
FCFlags		:=	${FCFlags}

F77Srcs	:= attsel.F solver.F BuildRMS.F Sloper.F WriteReal.F GetAngleMatrix.F \
	LeastSquares.F Polynomial.F RMStoINT.F \
	FitVelocity.F B_2.F V_2.F avangle.F

CSrcs		:= crvray.c summary.c describe.c getsize.c

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

PRGM		:= ${LocalBin}/attsel

targets : ${PRGM}

all :  safe clean targets remotes install

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

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

remotes:	RemoteCopies RemoteMakes

install:
	mancopy 1 attsel
	execopy  attsel
	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*}
