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

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

# define the targets

PRGM		:=	${LocalBin}/xchd

# CLD := purify cc

# set the architecture dependent variables

CCFlags		:=	-D_NO_PROTO -DBSD_COMP
sunCCFlags	:=	-DSUN 

sunCLFlags	:=	-Bstatic

ifneq "${SOLARIS}" ""
CommonLibes	:=	-Bdynamic -lXm -lXt -lX11 -Bstatic 
sunLibes	+= 	-lgen -lsocket -Bdynamic -lSM -lICE \
			-ldl -Bstatic -lform -lintl -lnsl -Bdynamic
else
CommonLibes	:=	-lXm -lXt -lX11
endif
intelLibes	:= 	${intelLibes} -lXext

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

CSrcs		:=	create_button.c reset_display.c	xs_insert_string.c \
			get_from_chd.c send_to_chd.c xs_talkto.c \
			quit_chd.c xchd.c quit.c chd_stat.c bld_list.c \
			comments.c history.c dialog.c sensitive.c \
			bufferio.c

# client.c

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

.PHONY:	all safe remotes targets

targets:	${Vendor}targets

suntargets:	${PRGM}

hptargets:	${PRGM}

sgitargets:	${PRGM}

inteltargets:	${PRGM}

ibmtargets:	no_build

no_build:
	@echo Unable to build target ${PRGM} on ${Vendor} architecture

all:	safe targets remotes

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

install:
	apps-execopy chd prod xchd
	shadowexec -v ${MAKE} install

purify:		${CObjs}
	purify ${LinkC} -o ${PRGM}  ${CObjs} ${Libes}

remotes:	RemoteCopies  RemoteMakes

RemoteCopies:	${SafeFiles}
	shadowcopy -R DEPT $? && touch RemoteCopies

RemoteMakes:	${SafeFiles}
	shadowexec -R DEPT ${MAKE} && touch RemoteMakes

include ${TArchDir}/included.files

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

saberc:	Makefile
	-rm -f saberc.make
	echo "saber:" > saberc.make
	echo "	#setopt make_prog gmake" >> saberc.make
	echo "	#unsetopt make_args" >> saberc.make
	echo "	#setopt make_symbol !" >> saberc.make
	echo "	#load ${IncludeDirs} ${CFlags} ${CSrcs} ${LibDirs} ${Libes}" >> saberc.make

safe:	.safe.${jdate}.Z

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

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


