# Makefile for DJGPP 640x480x256 build of JLib.
# note that I dont -fomit-frame-pointer as this causes crashes under windows.
#

AR       = ar
CC       = gcc
OPTIMIZE = -O3 -finline-functions -fstrength-reduce -fforce-mem -fforce-addr \
	   -funroll-loops -frerun-cse-after-loop

CFLAGS   = $(OPTIMIZE)
LIBS = -lj -lpc -lgrx

TARGET	= target/djgrx640/palette.o target/djgrx640/blit.o    \
	  target/djgrx640/blast.o   target/djgrx640/memcopy.o \
	  target/djgrx640/mouse.o target/djgrx640/misc.o 

include target/common

all:	libj.a $(DEMOS) $(UTES)

libj.a: $(TARGET) $(MODULES)
	del libj.a
	$(AR) rcs libj.a $(MODULES)
	$(AR) rcs libj.a $(TARGET)
#==============================================================================
#
# IMPORTANT: CHANGE the line below to copy libj.a to your \gcc\lib directory!
#
#============================================================================== 
	copy libj.a \gcc\lib

clean:
	rm $(MODULES) $(TARGET)

realclean:
	rm $(DEMOS) $(UTES)

%.exe : %.foo
	strip $<
	coff2exe $<
	rm $<

%.foo : %.c
	$(CC) $(CFLAGS) -o $@ $< $(LIBS)

