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

include ${DEPTROOT}/usp/etc/gmake.init
include ${DEPTROOT}/etc/gmake.motif1.2

CSrcs		:=	xcram.c yank.c main.c

Libes	:=	 -lXm -lXt -lX11

ifneq "${SOLARIS}"  ""
Libes		:=	-Bdynamic ${Libes} -Bstatic
sunLibes	:=	${sunLibes} -lgen -lsocket \
			-ldl -Bstatic -lform -lnsl -lintl
endif

sunLibes   :=      -Bdynamic -lSM -lICE \
			${sunLibes}

Libes	:=	${Libes} ${${Vendor}Libes}

SafeFiles	:=	${CSrcs} ${wildcard *.1} ${wildcard *.h}	\
			xcram.pattern Makefile

PRGM		:=	${LocalBin}/xcram

targets:	${Vendor}targets


suntargets:	${PRGM}

sgitargets:	${PRGM}

craytargets:	dummy

hptargets:	${PRGM}

ibmtargets:	dummy

inteltargets:	${PRGM}

all:	safe clean targets remotes

${PRGM}:  ${AllObjs}
	(cd WIDGETS/READ; ${MAKE} targets)
	(cd WIDGETS/WRITE; ${MAKE} targets)
	${LinkC} -o $@ $^ ${Libes} -lm

dummy:
	@echo module cannot be built on ${TArchDir} architecture

install:
	(cd WIDGETS/READ; ${MAKE} install)
	(cd WIDGETS/WRITE; ${MAKE} install)
	mancopy 1 xcram
	execopy xcram
	shadowexec -v ${MAKE} install

remotes:	RemoteCopies  RemoteMakes

RemoteCopies:	${SafeFiles}
	shadowcopy $?
	touch RemoteCopies

RemoteMakes:	${SafeFiles}
	shadowexec ${MAKE}
	touch RemoteMakes

include ${TArchDir}/included.files

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

safe:	.safe.${jdate}.Z
	(cd WIDGETS/READ; ${MAKE} safe)
	(cd WIDGETS/WRITE; ${MAKE} safe)

.safe.${jdate}.Z:	${SafeFiles}
	${MakeSafe}


clean:
	(cd WIDGETS/READ; ${MAKE} clean)
	(cd WIDGETS/WRITE; ${MAKE} clean)
	-rm ${TArchDir}/included.files ${AllObjs} ${PRGM} RemoteCopies RemoteMakes ${wildcard ShdCpy*}
