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

# gmake makefile for ikp program.
# 07/09/90   joe m. wade
# 11/01/93   Douglas Horn

ifeq "${TARCH}" "IRIX64"
TargetArch := -IRIX32
endif

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

ifeq "${Vendor}" "intel"
include ${DEPTROOT}/etc/gmake.motif2.0
else
include ${DEPTROOT}/etc/gmake.motif1.2
endif

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

sgiLibes	+=	-lrpcsvc
intelLibes	:=	-lXext

Libes		:= 	-lcu -likp -lpanels \
			-lXmCreateVa -lXgoodies \
			-lXm -lXt -lX11 -lm ${${TArchDir}Libes} \
			${${Vendor}Libes}

sunCLFlags	:=	-Bdynamic
hpCCFlags	:=	-O -Dnotdef -Ae

# hpCCFlags	:=	-O -Dnotdef -D_BSD
# hpCCFlags       :=      -O -D_INCLUDE_POSIX_PRGM -D_INCLUDE_HPUX_PRGM \
#                         -D_INCLUDE_XOPEN_PRGM -D_INCLUDE_AES_PRGM

# sunCCFlags	:=	${sunCCFlags} -O -Xa -DNeedFunctionPrototypes
sunCCFlags	:=	${sunCCFlags} -O -Xa -DNeedFunctionPrototypes \
			-DINCLUDE_ALLOCA_H
convexCCFlags	:=	${convexCCFlags} -O -DNeedFunctionPrototypes
sgiCCFlags	:=	${sgiCCFlags} -O -DNeedFunctionPrototypes
ifeq "${TArchDir}" "IRIX/6/IP27/n32"
CCFlags	:=	${CCFlags} -DLINUXSYSTEM
endif

# ifeq "${TArchDir}" "HP-UX"
# CC              :=      c89
# CLD             :=      c89
# endif

CSrcs	:=	ikp.c error.c io.c segment.c pipeslot.c \
		connector.c process.c net.c wait.c init.c xdefaults.c \
		event.c menuproc.c netsel.c netfork.c netmon.c \
		netio.c prcsel.c cntlock.c cntsel.c \
		cntdialog.c batch.c lib.c module.c \
		remote.c menubar.c message.c draw.c host.c \
		getroot.c libio.c

# XStrKeysym.c

SafeFiles	:= ${AllSrcs} Makefile ${wildcard *.h} ${wildcard *.bitmap} \
			${wildcard *.xbc*} 

PRGM		:= ${LocalBin}/ikp

targets : ${PRGM}

all :  safe clean targets remotes install

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

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 -DSUN ${IncludeDirs} ${CFlags} ${CSrcs} ${LibDirs} ${LIBES}" >> saberc.make

remotes:	RemoteCopies RemoteMakes

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


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

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

safe:	.safe.${jdate}.Z

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

include ${TArchDir}/included.files

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


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