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

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

sunCCFlags	:= ${sunCCFlags} -g
Libes		:= ${Libes} -lchd -lcu
#
# Add an architecture library variable which may be set in one of the gmake
# rules files referenced above. Initialized with SOLARIS port.. - jmw 8/9/93
#

ifneq "${SOLARIS}" ""
${TArchDir}Libes := ${${TArchDir}Libes} -lnsl -lintl -Bdynamic -ldl -Bstatic
endif

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

CSrcs	:=	abbrev.c argsep.c chd.c chd_fill.c chd_load.c chd_save.c \
		chd_prtln.c chd_srch.c do_def.c do_export.c do_help.c \
		do_import.c do_load.c do_query.c do_reset.c do_set.c \
		do_sleep.c \
		do_undef.c do_unload.c ident.c lockopen.c op_export.c \
		op_import.c op_load.c op_unload.c op_shutdown.c op_start.c \
		process_cmd.c do_syscall.c sys_add.c sys_disp.c sys_help.c \
		sys_shutdown.c sys_sign.c sys_start.c sys_zap.c \

SafeFiles	:= ${AllSrcs} Makefile

PRGM		:= ${LocalBin}/chd

targets : ${PRGM}

all :  safe targets remotes install

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


remotes:	RemoteCopies RemoteMakes

install:
	mancopy 1 chd
	apps-execopy  chd prod chd
	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}

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

include ${TArchDir}/included.files

#  generate include files
#  date stamp source

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