# SUN VGT server makefile
# Ross Finlayson, September 1984

#include ../../../buildprefix

.SUFFIXES: .b

VPATH = ./ ../mi

VGTSEXEC = init.b

# device independent object files:
MAINOBJS = mux.b handlers.b event.b dir.b

VGTSOBJS = edit.b interp.b keyboard.b keytable.b manager.b execs.b mouse.b \
	mousehit.b tty.b pad.b sdf.b timer.b hash.b 

GRAFIXOBJS = window.b graphdisp.b display.b font.b stipdefs.b \
	circle.b arc.b fillarea.b fillpolyarc.b attrib.b

TEXTOBJS = silfonttab.b

SPLINEOBJS = displine.b spline.b line.b polygon.b fill.b 

MISCOBJS = splinedefs.b nibdefs.b patdefs.b markers.b

# device independent object files:
DIOBJS = $(MAINOBJS) $(VGTSOBJS) $(GRAFIXOBJS) $(TEXTOBJS) $(SPLINEOBJS) \
	 $(MISCOBJS)

# device dependent object files:
SUN100_OBJS = sun100_draw1.b sun100_draw2.b
SUN120_OBJS = sun120_draw1.b sun120_draw2.b

C68FLAGS = -O -v${Xx}V -I./ -I../mi -I../../../libc/include/mi

SUN100_DEP_LIBS = libsun100Vgts.a
SUN120_DEP_LIBS = libsun120Vgts.a

INDEP_LIBS = $(VSYS)/lib/m68k/liblockedmalloc.a -lVgraphics

SUN100_LIBS = $(SUN100_DEP_LIBS) $(INDEP_LIBS)
SUN120_LIBS = $(SUN120_DEP_LIBS) $(INDEP_LIBS)


all: sun100vgts.m68k sun120vgts.m68k vgts.m68k debugvgts.m68k
	@echo "Now, remake the necessary first teams in ../../../cmds/team1."

#include dependencies

sun100vgts.m68k: $(VGTSEXEC) $(SUN100_DEP_LIBS)
	cc68 $(C68FLAGS) -o sun100vgts.m68k \
		$(VGTSEXEC) $(SUN100_LIBS)
sun120vgts.m68k: $(VGTSEXEC) $(SUN120_DEP_LIBS)
	cc68 $(C68FLAGS) -o sun120vgts.m68k \
		$(VGTSEXEC) $(SUN120_LIBS)

libsun100Vgts.a: $(DIOBJS) $(SUN100_OBJS)
	rm -f libsun100Vgts.a
	ar cr libsun100Vgts.a $(DIOBJS) $(SUN100_OBJS)
libsun120Vgts.a: $(DIOBJS) $(SUN120_OBJS)
	rm -f libsun120Vgts.a
	ar cr libsun120Vgts.a $(DIOBJS) $(SUN120_OBJS)

vgts.m68k: vgts.c
	cc68 $(C68FLAGS) -o vgts.m68k vgts.c

debugvgts.m68k: debugvgts.c
	cc68 $(C68FLAGS) -o debugvgts.m68k debugvgts.c

libs: libsun100Vgts.a libsun120Vgts.a

sun100_draw1X.c: draw1.c
	bitcompile -DSUN100FB -DNOHDR draw1.c -o sun100_draw1X.c

sun120_draw1X.c: draw1.c
	bitcompile -DSUN120FB -DNOHDR draw1.c -o sun120_draw1X.c

sun100_draw1.b: sun100_draw1X.c gl_sun100.h
	cc68 $(C68FLAGS) -DSUN100FB -c -o sun100_draw1.b sun100_draw1X.c
sun100_draw2.b: draw2.c gl_sun100.h
	cc68 $(C68FLAGS) -DSUN100FB -c -o sun100_draw2.b draw2.c

sun120_draw1.b: sun120_draw1X.c gl_sun120.h
	cc68 $(C68FLAGS) -DSUN120FB -c -o sun120_draw1.b sun120_draw1X.c
sun120_draw2.b: draw2.c gl_sun120.h
	cc68 $(C68FLAGS) -DSUN120FB -c -o sun120_draw2.b draw2.c

.c.b:
	cc68  $(C68FLAGS) -c $<
.c.s:
	cc68 $(C68FLAGS) -S -c $<

install: all
	-mv -f sun100vgts.sav sun100vgts.old
	-cp sun100vgts.m68k sun100vgts.sav
	-mv -f sun120vgts.sav sun120vgts.old
	-cp sun120vgts.m68k sun120vgts.sav
	-mv -f vgts.sav vgts.old
	-cp vgts.m68k vgts.sav
	-mv -f debugvgts.sav debugvgts.old
	-cp debugvgts.m68k debugvgts.sav
	${NETINSTALL} "libsun100Vgts.a libsun120Vgts.a" $(VSYS)/lib/m68k
	${NETINSTALL} -p "sun100vgts.m68k sun120vgts.m68k vgts.m68k debugvgts.m68k" $(VSYS)/bin

clean:
	rm -f *.BAK *.CKP *.a *vgts.m68k
	rm -f *.b *.o .emacs*

relink::
	rm -f *.a *vgts.m68k

relink:: all

tags:
	ctags -tw *.[ch]

depend:
	makedep -N -e b $(VPATH)/*.c
