########################################################################
#                 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}

sun4cg89FCFlags :=      ${sun4cg89FCFlags} -fast -O4 -cg89
sun4cg89FLFlags :=      ${sun4cg89FLFlags} -fast -O4

sun4cg92FCFlags :=      ${sun4cg92FCFlags} -fast -O4 -cg92
sun4cg92FLFlags :=      ${sun4cg92FLFlags} -fast -O4

sun4cg92Libes   :=      -lnsl
sun4cg89Libes   :=      -lnsl
c2mpLibes       :=      ${c2mpLibes} -lveclib

F77Srcs		:= stack.F stacksub.F getwgt.F median.F

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

PRGM		:= ${LocalBin}/stack

targets : ${PRGM}

all :  safe clean targets install remotes

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

install:
	mancopy 1 stack
	execopy  stack
	shadowexec -v ${MAKE} install

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

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


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