# This makefile is set up for Borland make 3.0/3.6
# With gnuish make 3.58 you have to edit the libbcc.a rule
# and to uncomment the following line
#.SUFFIXES: .c .S .o

CC     = gcc
CFLAGS = -O2 -fomit-frame-pointer -Wall
LIB    = ..\LIB
INC    = ../INCLUDE
INCDEP = bccgrx00.h $(INC)/bccgrx.h

BCC_O  = bccgrx.o\
	bccgrx01.o bccgrx02.o bccgrx03.o bccgrx04.o bccgrx05.o\
	bccgrx06.o bccgrx07.o bccgrx08.o bccgrx09.o bccgrx10.o\
	bccgrx11.o bccgrx12.o bccgrx13.o bccgrx14.o bccgrx15.o\
	bccgrx16.o bccgrx17.o bccgrx18.o bccgrx19.o bccgrx20.o\
	bccgrx21.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) delay.o rand_tp.o readkey.o

.c.o:
	gcc $(CFLAGS) -I$(INC) -c $*.c

.S.o:
	gcc $(CFLAGS) -c $*.S

all: $(LIB)\libbcc.a

$(LIB)\libbcc.a: libbcc.a
	copy libbcc.a $(LIB)\libbcc.a

clean:
	del *.o
	del libbcc.a

cleanall: clean

# ------------------------------------------------------------------ libbcc.a
## libbcc.a rule with Borland make
#libbcc.a: $(LIB_O)
# 	-del libbcc.a
# 	ar rvs libbcc.a @&&|
# 	$(LIB_O)

## libbcc.a with gnuish make
LONGARGS=ar
libbcc.a: $(LIB_O)
	-del libbcc.a
	ar rvs libbcc.a $(LIB_O)
# --------------------------------------------------------------------------

$(BCC_O): $(INCDEP)

$(EXT_O): $(INC)/bccgrx.h $(INC)/bgiext.h $(INC)/libbcc.h

delay.o : delay.S

rand_tp.o: rand_tp.c $(INC)/p2c/tp_port.h
readkey.o: readkey.c $(INC)/p2c/tp_port.h
