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

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

ifeq "${TArchDir}" "sun4"
CC= acc
endif
ifeq "${TArchDir}" "HP-UX"
CC= c89
endif

sunCLFlags	:=	-Bdynamic

# sunCCFlags		:= ${sunCCFlags} -g -DDEBUG
sunCCFlags		:= ${sunCCFlags} -O
sunCLFLags		:= ${sunCLFLags} -Bstatic
convexCCFlags		:= ${convexCCFlags} -O -DNeedFunctionPrototypes
HP-UXCCFlags		:= ${HP-UXCCFlags} -D_INCLUDE_POSIX_SOURCE

PRGM := ${LocalBin}/xsb
LIB  := ${LocalLib}/libpanels.a

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

CommonLibes := -lpanels -lXmCreateVa -lXgoodies -lXm -lXt -lX11 -lm -lcu

# sun4cg92Libes	:= 	-lsocket -B dynamic \
# 			-R /usr/lib/X11R5 -ldl -B static -lform -lnsl -lintl

ifneq "${SOLARIS}" ""
sunLibes	:= 	${sunLibes} -lgen -lsocket -lnsl -L /usr/ccs/lib \
			-B dynamic \
			-ldl -B static -lform -lintl
endif

intelLibes := ${intelLibes} -lXext

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

CSrcs := xsb.c \
 	 flow.c menubar.c menucb.c module.c mouse.c libio.c

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

targets: ${PRGM}

all :  safe clean targets remotes install

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

remotes:	RemoteCopies RemoteMakes

install:
	mancopy 1 xsb
	execopy  xsb
	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}

include ${TArchDir}/included.files

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

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