#
#   Makefile for cgl (nonproprietary RGL) residing on the workstation
#
#   Also stashes the stuff for building the cgl library on the 
#	remote host in ./hostlib
#
TARGET = /usr/local/lib
NEWRGLLIB = libcgl.a
#
#DEBUG = -DDEBUG -g
INCLUDES = -I../include -I/usr/include/bsd
IOOBJS = netio.o netinit.o interp.o special.o
CFLAGS = -O -DIRIS -DIRIS3000 -DIEEEHOST ${DEBUG} ${INCLUDES}
LIBS = -lgl2 -lbsd -ldbm -lm
#
all:	${NEWRGLLIB} cgliris

${NEWRGLLIB}:	libobjs ${IOOBJS} 
	cd libobjs; ar crv ../${NEWRGLLIB} *.o
	ar rv ${NEWRGLLIB} ${IOOBJS}
	ranlib ${NEWRGLLIB}

libsrc: 	wkslib.ex
	-mkdir libsrc; ex < wkslib.ex wkslib.c

libobjs: 	libsrc
	-mkdir libobjs; 
	cd libsrc; cc -c ${CFLAGS} -I../../include *.c;
	cd libsrc; mv *.o ../libobjs

cgliris: cgliris.c ${NEWRGLLIB}
	cc -o cgliris cgliris.c ${NEWRGLLIB} ${DEBUG} ${LIBS}

install: 
	mv ${NEWRGLLIB} ${TARGET}
	ranlib ${TARGET}/${NEWRGLLIB}

clean:	
	-rm -rf libsrc libobjs *.o 

clobber:	
	-rm -rf libsrc libobjs *.a *.o 
