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


# gmake Makefile for src/cmd/c2s
# Joe M Wade      89/9/7
 
include ${DEPTROOT}/usp/etc/gmake.init
include ${DEPTROOT}/etc/gmake.motif1.2

# define the targets

PRGM	:=	${LocalBin}/xcram10

CFlags		:= -D_NO_PROTO 
sunCLFlags	:= -Bstatic
sgiCCFlags	:= ${sgiCCFlags} -OPT:fold_arith_limit=1200

# set the architecture dependent variables

ifeq "${Vendor}" "sun"
CommonLibes :=	-lut -Bdynamic -lXm -lXt -lX11 -lcu
else
CommonLibes :=	-lut -lXm -lXt -lX11 -lcu
endif

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

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

CSrcs		:=	main.c \
			yank.c cram.c xs_talkto.c chd_stat.c pop_dialog.c\
			send_to_chd.c listDrives.c getdevnum.c quit.c \
			XuCrHelpPD.c HelpObject.c findLoaded.c drive_opts.c \
			device.c listUnits.c delay.c dlgcurs.c getroot.c \
			date.c loader.c remote.c parse.c prt_banner.c \
			comments.c history.c

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

.PHONY:	all safe remotes targets

targets:	${Vendor}targets

suntargets:	${PRGM}

craytargets:	dummy

hptargets:	${PRGM}

sgitargets:	${PRGM}

inteltargets:	${PRGM}

appletargets:	${PRGM}

ibmtargets:	dummy

all:	safe clean targets remotes

${PRGM}:	${AllObjs} 
	${LinkC} -o $@ ${AllObjs} ${Libes}

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

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

remotes:	RemoteCopies  RemoteMakes

RemoteCopies:	${SafeFiles}
	shadowcopy -v $?
	touch RemoteCopies

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

include ${TArchDir}/included.files

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

safe:	.safe.${jdate}.Z

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


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