#
# MAKEFILE
#   for building the DJGPP and the Turbo C versions of the GRX library
#   usage: make [-DPLANE=<planes>] [-DMODEL=<Turbo C memory model>] [-DDEBUG]
#
CC	  = gcc
GCCDBG    = # -ggdb
GCCOPTMZE = -Wall -O2 -fomit-frame-pointer -I../ -I/usr/local/include/Vga 

PLANE = 255
GCCLIB= ../../lib/libgrx.a
GSTAMP= stamp.gcc

MODE_X= 32
M_8514= 64
M_S3=   128

# 
# compiler options 
# 
CPPOPT= -I/usr/local/include/Vga -I../../include -DGRXPLANES=$(PLANE)
CFLAGS= $(GCCOPTMZE) $(CPPOPT) 

#
# default rules:
#    C -> ASM rules are there to look at the generated code
#    when using inline assembly
#
.c.o:
	$(CC) $(CFLAGS) -c $*.c 


#.c.o:
#	$(CC) -c $(CFLAGS) $(GDEBUG) $*.c
#

.c.s:
	$(CC) -S $(CFLAGS) $*.c

.S.o:
	$(CC) -c -xassembler-with-cpp $*.S

.s.o:
	$(CC) -c -xassembler-with-cpp $*.s


#
# linux specific objects for building the DJGPP library
#

LAUX	= lnxmouse.o   lnxcursor.o  gppconio.o  lnxmode.o #mousedrv.o  
OBJS	= $(LAUX)
LIBS	= $(DOSSUP) -lp2c -lncurses #-ltermcap 
PROGS	= iotest etcr

#
# default targets:
#
all: $(OBJS) # $(PROGS)

clean:
	rm -f *.o $(PROGS) etcr.c

lib: $(OBJS)

etcr.c: etcr.pas lnxconio.h lnxdos.h .p2crc p2c/tp2bcc.p2c
etcr:   $(OBJS) etcr.o
iotest: $(OBJS) iotest.o

dep: .depend

.depend:
	$(CC) -MM $(CFLAGS) $(GDEBUG) $(patsubst %.o,%.c,$(OBJS)) >.depend


include .depend

