CC = sc

MATHLIB = lib:scm881.lib

LINKOPTS = SMALLCODE SMALLDATA

OBJS = binary.o bitmap.o command.o contour.o eval.o fit.o gnubin.o \
	graph3d.o graphics.o help.o internal.o matrix.o misc.o parse.o \
	plot.o scanner.o setshow.o specfun.o standard.o term.o util.o \
	version.o

CSOURCE1 = bf_test.c binary.c command.c setshow.c 
CSOURCE2 = help.c gnubin.c graphics.c graph3d.o internal.c 
CSOURCE3 = misc.c eval.c parse.c plot.c scanner.c standard.c 
CSOURCE4 = bitmap.c term.c util.c version.c fit.c matrix.c
CSOURCE5 = term/ai.trm term/amiga.trm term/aed.trm term/atari.trm \
	term/bigfig.trm term/cgi.trm term/corel.trm \
	term/djsvga.trm term/dumb.trm \
	term/dxf.trm term/dxy.trm \
	term/debug.trm term/eepic.trm term/epson.trm term/excl.trm \
	term/fig.trm term/hp26.trm term/hp2648.trm term/hpgl.trm  \
	term/hpljii.trm term/metafont.trm\
	term/apollo.trm term/gpr.trm term/hppj.trm term/compact.c 
CSOURCE6 = term/impcodes.h term/imagen.trm term/next.trm term/object.h \
	term/iris4d.trm term/kyo.trm term/latex.trm term/mif.trm \
	term/pbm.trm term/pc.trm 
CSOURCE7 = term/post.trm term/pstricks.trm term/qms.trm term/regis.trm \
	term/rgip.trm term/sun.trm\
	term/t410x.trm term/tek.trm term/texdraw.trm term/tgif.h\
	term/tgif.trm term/tpic.trm \
	term/unixpc.trm term/unixplot.trm \
	term/v384.trm term/vws.trm term/x11.trm term/xlib.trm
CSOURCE8 = contour.c specfun.c


all: gnuplot

gnuplot: $(OBJS)
	slink FROM LIB:c.o \
     binary.o bitmap.o command.o contour.o eval.o fit.o gnubin.o graph3d.o \
     graphics.o help.o internal.o matrix.o misc.o parse.o plot.o scanner.o \
     setshow.o specfun.o standard.o term.o util.o version.o \
TO /bin/gnuplot \
LIB $(MATHLIB) LIB:scnb.lib \


bf_test: bf_test.o binary.o
	slink from lib:c.o bf_test.o binary.o to /demo/bf_test \
	lib $(MATHLIB) lib:scnb.lib
	@echo "*N*NRun bf_test in demo subdirectory to make binary demo files*N"

bf_test.o: bf_test.c
binary.o: binary.c plot.h
bitmap.o: bitmap.c bitmap.h plot.h
command.o: command.c plot.h setshow.h help.h
contour.o: contour.c plot.h
eval.o: eval.c plot.h
fit.o: fit.c fit.h matrix.h plot.h type.h
gnubin.o: gnubin.c plot.h setshow.h
help.o: help.c plot.h help.h
internal.o: internal.c plot.h
matrix.o: matrix.c matrix.h fit.h type.h
misc.o: misc.c plot.h setshow.h help.h
parse.o: parse.c plot.h
plot.o: plot.c plot.h setshow.h
scanner.o: scanner.c plot.h
setshow.o: setshow.c plot.h setshow.h
specfun.o: specfun.c plot.h
standard.o: standard.c plot.h
util.o: util.c plot.h
version.o: version.c
graph3d.o: graph3d.c plot.h setshow.h
graphics.o: graphics.c plot.h setshow.h

.c.o:
	$(CC) OPT $< 

term.o: term.c term.h plot.h setshow.c bitmap.h $(CSOURCE5) $(CSOURCE6) $(CSOURCE7)
	$(CC) $<
