
# Game development library v 0.1
CPU_IS_386=NO

CC	 = g++
INC      = -I/usr/local/include
DEBUG    = -ggdb
OPTS	 = -Wall -pipe
OPTIMIZE = -fomit-frame-pointer -O2 -ffast-math -funroll-loops -s

ifeq ($(CPU_IS_386),NO)
OPTS := -m486 $(OPTS)
endif

DEFINES  =

# regular use
CFLAGS	 = $(DEFINES) $(INC) $(OPTIMIZE) $(OPTS)

# for debugging
#CFLAGS	 = $(DEFINES) $(INC) $(DEBUG) $(OPTS)

#LFLAGS   = -static

GAMELIB    = gamelib.a
GAMELIB_O  =  HiScore.o Bitmap.o SBitmap.o \
	  Timer.o Ui.o ObjTools.o FastMath.o Explosion.o \
	  Sprite.o Joystick.o Keyboard.o fonts.o \
	  RawImageLoader.o cfclass.o

$(GAMELIB): $(GAMELIB_O)
	ar -rc $(GAMELIB) $(GAMELIB_O)	
	@echo 
	@echo \"$(GAMELIB)\" has successfully compiled.
	@echo 

.c.o:
	$(CC) $(CFLAGS) -c -o $*.o $<

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


.PHONY:	dep depend clean cleanall

cleanall: clean
	rm -f $(GAMELIB)

clean:
	rm -f *.o *~

dep:	depend
depend:	
	rm -rf depend
	$(CC) -MM $(INC) *.c > dependancies

include dependancies
