defines = # -DSTDC_HEADERS -DHAVE_VOIDPTR
CC=cc
COPTS=-O
CFLAGS=$(COPTS) $(defines)
#LDFLAGS=-g
LDLIBS=-lm
GETOPT=../getopt
#----------------------------------------------------------------
# The toplevel make file uses these.
.PHONY: all install clean realclean
VERS=0.3

# $(DEV) indicates which graphics device this library supports.
DEV=tek
all : plot2$(DEV)

.c.o:
	$(CC) $(CFLAGS) -I$(GETOPT) -I../include -DVERS=\"$(VERS)\" -c $<

install : plot2$(DEV)
	install -c plot2$(DEV) $(BINDIR)
# no manual page for plot2tek yet
#	install -c plot2$(DEV).man $(MANDIR)/plot2$(DEV).$(MANEXT)

clean :
	-rm -f *.o *~ \#* core test* diff TAGS CHECKSUMS
realclean : clean
	-rm -f plot2$(DEV) *.a spline*

all : plot2tek
#----------------------------------------------------------------
plot2tek : plot.o $(GETOPT)/getopt.o $(GETOPT)/getopt1.o libtek.a
	$(CC) $(CFLAGS) -o plot2tek plot.o $(GETOPT)/getopt.o $(GETOPT)/getopt1.o libtek.a $(LDLIBS)

$(GETOPT)/getopt.o $(GETOPT)/getopt1.o : $(GETOPT)/getopt.c $(GETOPT)/getopt1.c
	cd $(GETOPT); make all CC="$(CC)" CFLAGS="$(CFLAGS)"
$(GETOPT)/getopt.o : $(GETOPT)/getopt.h $(GETOPT)/getopt.h
$(GETOPT)/getopt1.o : $(GETOPT)/getopt.h $(GETOPT)/getopt.h
#
# Type `make libtek.a' to creaate the plot compatible library of
# functions for postscript output.
#
LSRC = openpl.c closepl.c space.c rotate.c dot.c point.c \
linemod.c line.c label.c alabel.c erase.c color.c move.c cont.c \
arc.c circle.c fontname.c fontsize.c fill.c

LOBJ = openpl.o closepl.o space.o rotate.o dot.o point.o \
linemod.o line.o label.o alabel.o erase.o color.o move.o cont.o \
arc.o circle.o fontname.o fontsize.o fill.o

libtek.a : $(LOBJ)
	ar ru libtek.a $?
	ranlib libtek.a

#
# Type `make TAGS' to update the TAGS file for use with GNU emacs.
#
TAGS : plot.c $(LSRC) ../include/libplot.h
	etags plot.c $(LSRC) ../include/libplot.h
#
# Dependencies generated by gcc -MM *.c *.h:
#
alabel.o : alabel.c ../include/libplot.h 
arc.o : arc.c ../include/libplot.h 
box.o : box.c ../include/libplot.h 
circle.o : circle.c ../include/libplot.h 
closepl.o : closepl.c ../include/libplot.h 
color.o : color.c ../include/libplot.h 
cont.o : cont.c ../include/libplot.h 
dot.o : dot.c ../include/libplot.h 
erase.o : erase.c ../include/libplot.h 
label.o : label.c ../include/libplot.h 
line.o : line.c ../include/libplot.h 
linemod.o : linemod.c ../include/libplot.h 
move.o : move.c ../include/libplot.h 
openpl.o : openpl.c ../include/libplot.h 
plot.o : plot.c ../include/libplot.h 
point.o : point.c ../include/libplot.h 
rotate.o : rotate.c ../include/libplot.h 
space.o : space.c ../include/libplot.h 
