# gmake makefile for usp program.

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

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

sunF90Flags	:= ${sunF90Flags} -lF77
sgiF90Flags	:= ${sgiF90Flags}

ifeq "${F90C}" "ifc"
${TArchDir}Libes += -lPEPCF90
endif

Libes		:= ${Libes} ${${TArchDir}Libes}

F77Srcs		:= mapfill.F fillmap.f count_mask_pts.f set_mask_pts.f
F90Srcs		:= linear_rsamp.f90

SafeFiles	:= ${AllSrcs} Makefile

PRGM		:= ${LocalBin}/mapfill
#PRGM		:= ${DEVPATH}/bin/mapfill

targets : ${PRGM}

all :  safe targets remotes install

${PRGM}    :  ${FObjs}
	${LinkF90} -o $@ ${FObjs} ${Libes}

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

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