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

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

# define the targets

PRGM		:=	${LocalBin}/cmdwatch

# set the architecture dependent variables

CCFlags		:=	-D_NO_PROTO -O
sunCCFlags	:=	-DSUN 
sun4cg92CCFlags	:=	${sun4cg92CCFlags} -DATT
i86pc_solCCFlags :=	${i86pc_solCCFlags} -DATT
crayCCFlags	:=	-DCRAY 
convexCCFlags	:=	-DATT

sunCLFlags	:=	-Bstatic

# CommonLibes	:=	-lcurses
intelLibes	:= 	${intelLibes} -lncurses
sunLibes	:= 	${sunLibes} -ltermcap -lcurses
sgiLibes	:= 	${sgiLibes} -lcurses
hpLibes		:= 	${hpLibes} -lcurses
convexLibes	:= 	${convexLibes} -ltermcap -lcurses
appleLibes	:= 	${appleLibes} -lncurses

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

CSrcs		:=	cmdwatch.c

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

.PHONY:	all safe remotes targets

targets:	${PRGM}

exmpl:	${TArchDir}/exmpl.o	
	${LinkC} -o exmpl $< -lcurses -ltermcap

all:	safe clean targets remotes install

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

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

install: ${PRGM} RemoteCopies RemoteMakes
	mancopy 1 cmdwatch
	execopy cmdwatch
	shadowexec -v ${MAKE} install

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}
	${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*}
