# This makefile is set up for Linux / GNU make
.SUFFIXES: .c .S .o
MAJOR_VER	= 1
MINOR_VER	= 0.1
VERSION		= $(MAJOR_VER).$(MINOR_VER)



CC     = gcc
CFLAGS = -fPIC -O2 -fno-strength-reduce -fkeep-inline-functions -fomit-frame-pointer -Wall
LIB    = ../lib
INC    = ../include
INCDEP = bccgrx00.h $(INC)/bccgrx.h
CP     = cp
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 =  $(FONT_O) $(BCC_O) $(EXT_O) rand_tp.o readkey.o #lnxdelay.o

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

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

all: libbcc.so.$(VERSION)

clean:
	@-rm -f *.o libbcc.so.$(VERSION)

cleanall: clean

libbcc.so.$(VERSION): $(LIB_O)
	$(CC) -s -shared -Wl,-soname,libbcc.so.$(MAJOR_VER) -o libbcc.so.$(VERSION) $(LIB_O)
	$(CP) libbcc.so.$(VERSION) ../../libs
	$(CP) $(INC)/bccgrx.h $(INC)/bgiext.h $(INC)/libbcc.h ../../include

$(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

