CC	= gcc

DEFS    =
CFLAGS	= -fexpensive-optimizations -O7 -finline-functions -fomit-frame-pointer \
	-funroll-all-loops -mpentium -I. 

LIBS    = -lalleg -laudio -lm
OBJS    = debug.o shinobi.o main.o fastcpu.o starcpu.o \
	  interfac.o loader.o msg.o palette.o asm.o mem.o unzip.o inflate.o \
          cpudebug.o audio.o video.o bootintf.o psg.o fm.o ym2151.o mz80.o \
	  mz80sup.o eagle.o keyboard.o tpl.o timer.o swdrv32.o joystick.o 
#liballeg.a 
	  
#all: star.exe system16.exe
all: system16.exe

star.exe: 
	$(CC) star.c -o star.exe -O3 -march=pentium
	del starcpu.s >nul

system16.exe: $(OBJS)
	$(CC) -s -o system16 $(OBJS) $(LIBS)
#	coff2exe system16

starcpu.s:
	star.exe starcpu.s s16 16

%.o: %.c
	$(CC) $(DEFS) $(CFLAGS) -c $<

asm.o: asm.asm
	nasmw asm.asm -f coff

starcpu.o: starcpu.asm
	nasmw starcpu.asm -f coff

mem.o: mem.asm
	nasmw mem.asm -f coff

mz80.o: mz80.asm
	nasmw mz80.asm -f coff

eagle.o: eagle.asm
	nasmw eagle.asm -f coff

swdrv32.o: swdrv32.asm
	nasmw swdrv32.asm -f coff

shinobi.o:	shinobi.h 
main.o:		shinobi.h
debug.o:	shinobi.h
fastcpu.o:	shinobi.h
video.o:	shinobi.h
audio.o:	shinobi.h
bootintf.o:	shinobi.h
loader.o:	shinobi.h
audio.o:	shinobi.h dosaudio.c

clean:
	del *.o
	del system16.exe
	
	
