######################################################################### 
#									# 
#   File: scorpion/src/treepr/Makefile 
#				 					# 
#   Copyright (C) 1991 Nancy Butler, Joan Curry, Steven Konstant,
#	Dore Rosenblum, and Greg Bollella
#									# 
#   The Scorpion System is free software in the public domain; you can  # 
#   redistribute it and/or modify it as you wish. We ask that you 	# 
#   retain credits referencing the University of Arizona and that you	# 
#   identify any changes you make.					# 
#									# 
#   Report problems to scorpion-project@cs.arizona.edu			# 
#   Direct all inquiries to:	The Scorpion Project			# 
#				Department of Computer Science		# 
#				Gould-Simpson Building			# 
#				University of Arizona			# 
#				Tucson, AZ 85721			# 
#				U.S.A.					# 
#									# 
#   Revision Log:							# 
#	$Log:$ 
#									# 
#   Edit Log:								# 
#									# 
######################################################################### 

# IMPORTED VARIABLES
INCDIR=/usr/local/scorpion/include
LIBDIR=/usr/local/scorpion/lib
BINDIR=/usr/local/scorpion/bin
SRCDIR=/usr/local/scorpion/src
CC=cc
IDLC=$(BINDIR)/idlc
PC=pc
CFLAGS=-I$(INCDIR)/C
IDLCFLAGS=
PFLAGS=-w
CP=cp
MV=mv
RM=rm -f
LEX=lex
MAKE=make
YACC=yacc
UTILITYVARS='CC=$(CC)' 'IDLC=$(IDLC)' 'PC=$(PC)' 'CFLAGS=$(CFLAGS)' \
	      'IDLCFLAGS=$(IDLCFLAGS)' 'PFLAGS=$(PFLAGS)' 'CP=$(CP)' \
	      'MV=$(MV)' 'RM=$(RM)' 'LEX=$(LEX)' 'MAKE=$(MAKE)' \
	      'YACC=$(YACC)'
CI=ci
CO=co -l
INSTALL=/usr/bin/install 

# LOCAL VARIABLES
SRC=trpr.p MakeTree.p GetBoxSizes.p Printdriver.p \
	SetXcoords.p lib.c iDrawBox.p  lDrawBox.p iArccross.p \
	lArccross.p convertcoords.p PadFind.p SubNumber.p TopDown.p \
	buildtree.p placeonpage.p printpage.p subtreefns.p treepr.p

HEADERS=GetBoxSizes.h MakeTree.h MsgChar.h PadFind.h Printdriver.h\
	SetXcoords.h SubNumber.h TopDown.h convertcoords.h globalconst.h\
	globaltypes.h iArccross.h lArccross.h lmltree.h plot.h treepr.h

OTHERS=treepr.i treepr.idl treeprtest.in treeprtest.out1

YOUROBJS=trpr.o MakeTree.o GetBoxSizes.o Printdriver.o \
	SetXcoords.o iDrawBox.o  lDrawBox.o iArccross.o \
	lArccross.o convertcoords.o PadFind.o SubNumber.o TopDown.o \
	buildtree.o placeonpage.o printpage.o subtreefns.o treepr.o \
	lib.o

# libidl.a is needed for the MsgChar routine
LIBES=$(LIBDIR)/libidlP.a $(LIBDIR)/libidl.a -lplot

#################################################################

System : IDLtrpr

IDLtrpr :	$(YOUROBJS) treepr.idl 
	$(PC) $(PFLAGS) $(YOUROBJS) -o IDLtrpr $(LIBES)


Install :
	$(RM) $(LIBDEST)/IDLtrpr
	$(INSTALL) IDLtrpr $(LIBDEST)

Checkout:
	$(BINDIR)/treepr -ftreeprtest.out2  treeprtest.in
#	$(BINDIR)/treepr <treeprtest.in >treeprtest.out2
	sh -c 'cmp -s treeprtest.out1 treeprtest.out2 && (echo "files treeprtest.out1 and treeprtest.out2 agree"; echo "treepr Passed Installation Check") || echo "*** treepr Failed Installation Check"'

Clean :
	$(RM) *.o a.out core *.Cdl *.list

CI:
	$(CI) $(SRC) $(HEADERS) $(PFILES) $(OTHERS)
CO:
	$(CO) $(SRC) $(HEADERS) $(PFILES) $(OTHERS)

treepr.o : treepr.p
	$(PC) -c $(PFLAGS) treepr.p

trpr.o : trpr.p globaltypes.h globalconst.h treepr.h treepr.i MakeTree.h \
		GetBoxSizes.h Printdriver.h SetXcoords.h TopDown.h
	$(PC) -c $(PFLAGS) trpr.p

GetBoxSizes.o : globalconst.h globaltypes.h treepr.h GetBoxSizes.h
	$(PC) -c $(PFLAGS) GetBoxSizes.p

MakeTree.o : MakeTree.p MakeTree.h globalconst.h globaltypes.h treepr.h
	$(PC) -c $(PFLAGS) MakeTree.p

PadFind.o : PadFind.p globaltypes.h globalconst.h treepr.h
	$(PC) -c $(PFLAGS) PadFind.p

Printdriver.o : Printdriver.p globalconst.h globaltypes.h treepr.h \
		Printdriver.h plot.h iArccross.h lArccross.h
	$(PC) -c $(PFLAGS) Printdriver.p

SetXcoords.o : SetXcoords.p SetXcoords.h globalconst.h globaltypes.h treepr.h
	$(PC) -c $(PFLAGS) SetXcoords.p

convertcoords.o : convertcoords.p convertcoords.h iArccross.h globaltypes.h \
		treepr.h globalconst.h
	$(PC) -c $(PFLAGS) convertcoords.p

lArccross.o : lArccross.p lArccross.h globalconst.h globaltypes.h treepr.h \
		Printdriver.h
	$(PC) -c $(PFLAGS) lArccross.p

lDrawBox.o: lDrawBox.p Printdriver.h globalconst.h globaltypes.h treepr.h \
		PadFind.h SubNumber.h
	$(PC) -c $(PFLAGS) lDrawBox.p

iArccross.o : globalconst.h globaltypes.h treepr.h PadFind.h iArccross.h \
		convertcoords.h plot.h SubNumber.h
	$(PC) -c $(PFLAGS) iArccross.p

iDrawBox.o : iDrawBox.p Printdriver.h globalconst.h globaltypes.h treepr.h \
		plot.h iArccross.h convertcoords.h PadFind.h SubNumber.h
	$(PC) -c $(PFLAGS) iDrawBox.p

TopDown.o : TopDown.p TopDown.h Printdriver.h globalconst.h globaltypes.h  \
		treepr.h plot.h 
	$(PC) -c $(PFLAGS) TopDown.p

printpage.o : printpage.p Printdriver.h globalconst.h globaltypes.h treepr.h \
		TopDown.h plot.h iArccross.h convertcoords.h SubNumber.h
	$(PC) -c $(PFLAGS) printpage.p

placeonpage.o : placeonpage.p  globalconst.h globaltypes.h treepr.h \
		TopDown.h SetXcoords.h
	$(PC) -c $(PFLAGS) placeonpage.p

buildtree.o : buildtree.p  globalconst.h globaltypes.h treepr.h \
		TopDown.h 
	$(PC) -c $(PFLAGS) buildtree.p

subtreefns.o : subtreefns.p  globalconst.h globaltypes.h treepr.h \
		TopDown.h 
	$(PC) -c $(PFLAGS) subtreefns.p

SubNumber.o : SubNumber.p SubNumber.h globaltypes.h treepr.h globalconst.h 
	$(PC) -c $(PFLAGS) SubNumber.p

# lib.o -- c function

DelSrc:
	$(RM) *.c *.p *.h *.i *.idl

