
CC = gcc
CFLAGS = -O2 -fomit-frame-pointer -s
LFLAGS = -s -N
MODULES = grlib.o driver.o line.o palette.o scale.o text.o font8x8.o
SVGALIB = /usr/lib/libvga.a

all		:	libvgagl.a testgl fun speedtest

libvgagl.a	:	$(MODULES)
	ar rcs libvgagl.a $(MODULES)
	cp libvgagl.a /usr/lib
	cp vgagl.h /usr/include

grlib.o		:	grlib.c vgagl.h def.h inlstring.h

driver.o	:	driver.c vgagl.h def.h inlstring.h

line.o		:	line.c vgagl.h def.h

palette.o	:	palette.c vgagl.h def.h

scale.o		:	scale.c vgagl.h def.h inlstring.h

text.o		:	text.c vgagl.h def.h

fun.o		:	fun.c vgagl.h

testgl.o	:	testgl.c vgagl.h

speedtest.o	:	speedtest.c vgagl.h

font8x8.o	:	font8x8.c

fun		:	fun.o libvgagl.a $(SVGALIB)
	$(CC) $(LFLAGS) fun.o -o fun -lvgagl -lvga
	chmod +s fun

testgl		:	testgl.o libvgagl.a $(SVGALIB)
	$(CC) $(LFLAGS) testgl.o -o testgl -lvgagl -lvga
	chmod +s fun

speedtest	:	speedtest.o libvgagl.a $(SVGALIB)
	$(CC) $(LFLAGS) speedtest.o -o speedtest -lvgagl -lvga
	chmod +s fun

clean		:
	rm -f *.o *~ libvgagl.a fun testgl speedtest

cleanbin	:
	rm -f *~ fun testgl speedtest
