########################################################################
#                 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.mathadv
include ${DEPTROOT}/etc/gmake.motif1.2

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

Libes   := ${Libes} -lut -lmbs -lfu -lcu -lieeeio ${MathAdvO}
sgiLibes   := ${sgiLibes} -lcomplib.sgimath

Libes   := ${Libes} ${${Vendor}Libes} ${${TArchDir}Libes}
Libes	+= ${${TArchDir}Libes}

CCFlags		+=	
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.

CSrcs		:= files.c flatd2t.c   parsearg.c

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

ifeq "${Vendor}" "intel"
ifeq "${FLD}" "pgf77"
FLFlags += -Mnomain
endif
endif

# the ${LocalBin} entry will cause the code to appear in ~usp/bin/sun4
# which is not too useful while debugging.  To defeat this don't insert
# the ${LocalBin} until you are ready for installation of your routine in
# usp.  i.e. when you compile from ~usp/src/cmd/name, where name is the 
# name of your routine
PRGM	:= ${LocalBin}/flatd2t

targets : ${PRGM}

all :  safe clean targets remotes install

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

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

remotes:	RemoteCopies RemoteMakes

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