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

include ${DEPTROOT}/usp/etc/gmake.init
#include ${DEPTROOT}/usp/etc/gmake.init.db
#include ${DEPTROOT}/usp/src/cmd/fkinterp/gmake.init
include ${DEPTROOT}/etc/gmake.mathadv
#include ${DEPTROOT}/etc/gmake.mbs

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

#Libes		:= ${Libes} -lut ${MathAdvO} -lieeeio -lfu -lfastm
#Libes           := -lut -lmbs ${MathAdvO} -lieeeio -lfu
Libes           := -lut ${MathAdvO} -lieeeio -lfu
#Libes           := -lut -lmbs ${MathAdvO} -lieeeio -lfu -Bstatic
#Libes		:= ${Libes} -lut ${MathAdvO} -lieeeio -lfu -Bdynamic
#
# 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}

FCFlags	:=	${FCFlags}

# 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     := attin.F FitVelocity.F BuildRMS.F Sloper.F WriteReal.F \
           GetAngleMatrix.F LeastSquares.F RMStoINT.F \
           Matrix.F solver.F avangle.F Robust.F HeapSort.F runs.F \
           gamma.F probab.F yhat.F yhsum.F Matrix_avg.F yhat_avg.F \
	   attrstk.F

CSrcs       := getsize.c crvray.c

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

PRGM		:= ${LocalBin}/attin

targets : ${PRGM}

all :  safe targets install remotes

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

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

remotes:	RemoteCopies RemoteMakes

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} \
	RemoteCopies RemoteMakes ${wildcard ShdCpy*} date.h
