# This is the make file for tek2plot, a tek4010 to plot file translator.
CC=gcc
CFLAGS=-Wall
LDLIBS=-lm
GETOPT=../getopt
#----------------------------------------------------------------
# The toplevel make file uses these.
.PHONY: all install clean realclean

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

all : $(DEV)2plot

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

install : $(DEV)2plot
	install -c $(DEV)2plot $(BINDIR)
# no manual page for tek2plot yet
#	install -c $(DEV)2plot.man $(MANDIR)/$(DEV)2plot.$(MANEXT)
clean :
	-rm -f *.o *~ \#* core diff TAGS CHECKSUMS
realclean : clean
	-rm -f $(DEV)2plot *.a spline*
#----------------------------------------------------------------
$(DEV)2plot : $(DEV)2.o $(GETOPT)/getopt.o $(GETOPT)/getopt1.o libplot.a
	$(CC) $(CFLAGS) -I$(GETOPT) -I../include -o $(DEV)2plot $(DEV)2.o $(GETOPT)/getopt.o $(GETOPT)/getopt1.o libplot.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

../xplot/xplot :
	cd ../xplot; make xplot CC=$(CC) CFLAGS=$(CFLAGS)
#
# Type `make ts.tek' to create ts.tek, a standalone test for $(DEV)2plot.
#
ts.tek: libplot.a ts.c
	$(CC) $(CFLAGS) ts.c libplot.a -lm -o ts
	./ts >ts.tek
#
# Type `make libplot.a' to creaate the plot compatible library of
# functions for unix plot file output.
#
LSRC = openpl.c closepl.c space.c rotate.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 putshort.c

LOBJ = openpl.o closepl.o space.o rotate.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 putshort.o

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

#
# Type `make TAGS' to update the TAGS file for use with GNU emacs.
#
TAGS : $(DEV)2.c $(LSRC) ../include/libplot.h
	etags $(DEV)2.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 
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 
$(DEV)2.o : $(DEV)2.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 
