# This makefile is set up for Linux / GNU make

.SUFFIXES: .c .S .o

CC     = gcc
CFLAGS = -O6 -fomit-frame-pointer -Wall
LIB    = ../lib
INC    = ../include
INCDEP = bccgrx00.h $(INC)/bccgrx.h

BCC_O  = bccgrx.o \
	 bar.o bar3d.o circle.o clearvp.o drvname.o ellipse.o errmsg.o\
	 fellipse.o fillpatt.o fillpoly.o fillstyl.o fldfill.o getimage.o\
	 getviewp.o imagesze.o line.o lnestyle.o modename.o palette.o\
	 putimage.o rectang.o rgbpal.o sector.o setviewp.o text.o\
	 bgimode.o polygon.o

EXT_O = bgiext01.o bgiext02.o

FONT_O= ../chr/bold.o ../chr/euro.o ../chr/goth.o ../chr/lcom.o\
	../chr/litt.o ../chr/sans.o ../chr/scri.o ../chr/simp.o\
	../chr/trip.o ../chr/tscr.o

LIB_O = $(BCC_O) $(EXT_O) $(FONT_O) rand_tp.o readkey.o #lnxdelay.o

.c.o:
	gcc $(CFLAGS) -I$(INC) -c $*.c

.S.o:
	gcc $(CFLAGS) -c $*.S

all: $(LIB)/libbcc.a

$(LIB)/libbcc.a: libbcc.a
	cp libbcc.a $(LIB)/libbcc.a

clean:
	rm -f *.o libbcc.a

cleanall: clean

libbcc.a: $(LIB_O)
	rm -f libbcc.a
	ar rvs libbcc.a $(LIB_O) 

$(BCC_O): $(INCDEP)

$(EXT_O): $(INC)/bccgrx.h $(INC)/bgiext.h $(INC)/libbcc.h

rand_tp.o: rand_tp.c $(INC)/p2c/tp_port.h
readkey.o: readkey.c $(INC)/p2c/tp_port.h

