########################################################################
#                 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
include ${DEPTROOT}/etc/gmake.motif1.2

# get the qtc math advantage directory and file name.
#   place overrides after the include statement.
include ${DEPTROOT}/etc/gmake.mathadv

# define the targets

PRGM		:=	${LocalBin}/xgraph
PRGM2		:=	${LocalBin}/xgtest

# set the architecture dependent variables

ifeq "${SOLARIS}"  ""
sunCCFlags	:=	-DSYSTEM_STRICMP
endif

sunCCFlags	:=	${sunCCFlags} -DSUN -O
crayCCFlags	:=	${crayCCFlags} -DCRAY
sgiCCFlags	:= 	${sgiCCFlags} -O

sunFCFlags	:=	${sunFCFlags} -DSUN -O
crayFCFlags	:=	${crayFCFlags} -DCRAY -ePws -dp

crayLibes	:= 	-lnet
# CommonLibes	:= 	-lxtb -lux11 -lX11 -lm
CommonLibes	:= 	-lxtb -lX11 -lm

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

sunCLFlags	:=	-Bdynamic

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

CSrcsmain	:=	xgraph.c xgX.c hard_devices.c dialog.c hpgl.c ps.c params.c st.c idraw.c
CSrcstest	:=	xgtest.c
CSrcs		:=	${CSrcsmain} ${CSrcstest}

CObjsmain	=	${patsubst %.c, ${TArchDir}/%.o, ${CSrcsmain}}
CObjstest	=	${patsubst %.c, ${TArchDir}/%.o, ${CSrcstest}}

SafeFiles	:=	${AllSrcs} ${wildcard *.1} Makefile ${wildcard *.h} \
			${wildcard *.11} xgraph.pattern \
			${wildcard README* }

.PHONY:	all safe remotes targets

targets:	${PRGM} 

all:	safe clean targets remotes install

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

${PRGM2}:	${CObjstest} 
	${LinkC} -o $@ ${CObjstest} ${Libes}

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

test:
	${PRGM2} 5 0. 5. .25 | ${PRGM}

remotes:	RemoteCopies  RemoteMakes

RemoteCopies:	${SafeFiles}
	(cd bitmaps;	${MAKE} remotes);
	shadowcopy -v ${SafeFiles} && touch RemoteCopies

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

include ${TArchDir}/included.files

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

safe:	.safe.${jdate}.Z
	(cd bitmaps;	${MAKE} safe);

.safe.${jdate}.Z:	${SafeFiles}
	${MakeSafe}
#	${PRGM2} 23 0. 10. .5 | xgraph =1000x900+0+0

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