#
# copyright 1987, 1988, 1989 by Donna Converse and Joel Welling, Pittsburgh 
# Supercomputing Center
#                     
#	Makefile for "gplot" 
#	Pittsburgh Supercomputing Center CGM Metacode Translator
#	and the MIT X Window System Version 11 Protocol Release 2 driver
#	and for DrawCGM, a CGM-generating graphics library
#
#	To add device drivers, include the following -D qualifiers on the
#	CFLAGS line below:
#
#		inctty		tty controller (always include this!)
#		incxws		X window system driver
#		incps		postscript driver
#		inctek		tektronix terminal driver
#		incsun		Sun CGI driver
#		inccgmc     clear text CGM driver
#		inccgmb     binary CGM driver
#
#	and also include the following files in the DRV_OBJ symbol definition:
#
#		tty.o		tty controller (always include this!)
#		ps.o		postscript driver
#		tek.o		tektronix terminal driver
#		sundriv.o	Sun CGI driver
#		all xws_ .o files	X window system driver
#		cgmc.o      clear text CGM driver
#		cgmb.o      binary CGM driver
#
#	You must also uncomment the lines including related libraries below.
#
#	Some machines require the addition of a special module to define
#	'common' routines which they don't have, or to add machine-specific
#	symbols.  Scan the lines below looking for a line marked with your 
#	machine type, and if you find it uncomment the associated 
#	definition to include this file.

CFLAGS = -O -Dinctty -Dincps -Dinctek -Dinccgmc -Dinccgmb -Dincxws 

DRV_OBJ = tty.o ps.o tek.o cgmc.o cgmb.o \
	xws_cla.o xws_color.o xws_delim.o xws_marker.o xws_polygon.o \
	xws_polyline.o xws_setup.o xws_text.o


# These lines should not be modified.
MACHINE_DEFS = unix_defs.h
F_LINK = f77
AR = ar -ru

# To include the X11 driver, uncomment the next line to include
# the Athena Widget library, the X Toolkit library, and Xlib.
XLIBS =	-lXaw -lXt -lX11 -lXmu

# To include the Sun driver, uncomment the next line to include
# the Sunwindows, pixrect, and cgi libraries.
#SLIBS = 	-lcgi -lsunwindow -lpixrect

# To build this software on an Ardent Titan, uncomment the next line
#MACHINE = ardent.o

# To build this software on a Cray under Unicos, uncomment the next lines
#MACHINE_DEFS = unicos_defs.h /usr/include/fortran.h
#F_LINK = segldr
#AR = bld -r
#.f.o: ; cft77 $*.f

#----------------------------------------------------------------------------
#	Here ends the section the installer should have to modify
#----------------------------------------------------------------------------

LIBS =	$(XLIBS) $(SLIBS) -lm

GPT_OBJ = gplot.o cgm.o ccgm.o utils.o io.o carray.o devices.o \
	pkras.o drvcla.o

DCGM_OBJ = drawcgm.o cgmgen.o utils.o carray.o io.o pkras.o \
	drvcla.o devices.o

gplot: $(GPT_OBJ) $(DRV_OBJ) $(MACHINE)
	cc  $(CFLAGS) -o $@ $(GPT_OBJ) $(DRV_OBJ) $(MACHINE) $(LIBS)

drawcgm: drawcgm.a

tests: drawcgm_test drawcgm_tst2 cgmgen_test

drawcgm_test: drawcgm_test.o drawcgm.a
	$(F_LINK) -o $@ $(LIBS) drawcgm_test.o drawcgm.a

drawcgm_tst2: drawcgm_tst2.o drawcgm.a
	$(F_LINK) -o $@ $(LIBS) drawcgm_tst2.o drawcgm.a

cgmgen_test: cgmgen_test.o cgmgen_test2.o drawcgm.a
	$(F_LINK) -o $@ $(LIBS) cgmgen_test.o cgmgen_test2.o drawcgm.a

clean: 
	rm *.o

# drawcgm library
drawcgm.a: $(DCGM_OBJ) $(DRV_OBJ) $(MACHINE)
	$(AR) $@ $(DCGM_OBJ) $(DRV_OBJ) $(MACHINE)

# controlling GPLOT program
gplot.o: defs.h

# all of the cgm specific stuff
cgm.o: defs.h

# all of the clear text cgm specific stuff
ccgm.o: defs.h ccdefs.h

# utility functions
utils.o: defs.h

# I/O routines
io.o: defs.h

# devices interface
devices.o: defs.h

# Cell Array libraries
carray.o: defs.h

drvcla.o: defs.h

# decoding for the PK format files
pkras.o: defs.h

#TTY controller
tty.o: defs.h

# Postscript device
ps.o: defs.h

# Tektronix devices
tek.o: defs.h

# Clear text CGM driver
cgmc.o: defs.h

# Binary CGM driver
cgmb.o: defs.h

# Sun CGI driver
sundriv.o:	defs.h

#-------------- X Window System driver --------------------------

xws_setup.o:	/usr/include/stdio.h \
		/usr/include/strings.h \
		/usr/include/X11/Intrinsic.h \
		/usr/include/X11/StringDefs.h \
		/usr/include/X11/Viewport.h \
		/usr/include/X11/Xutil.h \
		/usr/include/X11/cursorfont.h \
		defs.h xws_defs.h

xws_delim.o:    /usr/include/stdio.h \
		/usr/include/strings.h \
		/usr/include/X11/Intrinsic.h \
		/usr/include/X11/Xutil.h \
		defs.h xws_defs.h

xws_color.o:	/usr/include/stdio.h \
		/usr/include/math.h \
		/usr/include/X11/Intrinsic.h \
		/usr/include/X11/Xutil.h \
		/usr/include/X11/Xatom.h \
		defs.h xws_defs.h xws_color.h

xws_polyline.o:	/usr/include/X11/Intrinsic.h \
		defs.h xws_defs.h

xws_polygon.o:	/usr/include/stdio.h \
		/usr/include/X11/Intrinsic.h \
		defs.h xws_defs.h xws_fill.h

xws_marker.o:	/usr/include/X11/Intrinsic.h \
		defs.h xws_defs.h

xws_text.o:	/usr/include/strings.h \
		/usr/include/X11/Intrinsic.h \
		/usr/include/X11/Xatom.h \
		defs.h xws_defs.h

xws_cla.o:      /usr/include/stdio.h \
		/usr/include/math.h \
		/usr/include/X11/Intrinsic.h \
		defs.h xws_defs.h xws_color.h
#-----------------------------------------------------------------------------
# DrawCGM and CGMGen, and test routines
cgmgen.o:	/usr/include/stdio.h \
		/usr/include/string.h \
		defs.h $(MACHINE_DEFS)

drawcgm.o:

drawcgm_test.o:

drawcgm_tst2.o:

cgmgen_test.o:

cgmgen_test2.o:	/usr/include/stdio.h \
		/usr/include/string.h \
		defs.h $(MACHINE_DEFS)

#-----------------------------------------------------------------------------
# Machine-specific modules

ardent.o:	/usr/include/math.h
