#SDL LAME
#DC porting by Neoblast


INC=-I../include -Iinclude

#OPT= -O3 -fstrict-aliasing -fexpensive-optimizations -foptimize-register-move  -freduce-all-givs -frename-registers -frerun-cse-after-loop -frerun-loop-opt -fschedule-insns -fno-sched-interblock -fsched-spec-load -fsingle-precision-constant -fstrength-reduce -fstrict-aliasing -ffast-math -fno-common  -fno-builtin -fno-exceptions -fargument-noalias-global -fomit-frame-pointer# -Wall -g  -ffreestanding

OPT2 = -O9 -fomit-frame-pointer -fno-ident -freorder-blocks -funsigned-char -funsigned-char -funroll-all-loops -frerun-loop-opt  -falign-loops -fstrict-aliasing

#OPT3 = -Os -mbigtable -mnomacsave -fschedule-insns2 -fexpensive-optimizations -fomit-frame-pointer -fstrict-aliasing -ffast-math
#OPT4 = -DFRAME_POINTER -g3 -O0 -fno-eliminate-unused-debug-types
#KOS_CFLAGS += $(INC) $(OPT2)
KOS_CFLAGS = $(INC) -ml -m4-single-only -D_arch_dreamcast -D_arch_sub_pristine -D_SDL -DDREAMCAST \
$(OPT2) \
-I$(KOS_BASE)/addons/include/SDL \
-I$(KOS_BASE)/addons/include/GL \
-I$(KOS_BASE)/addons/include

KOS_CPPFLAGS+= ${KOS_CFLAGS} $(INC)

TARGET = dclame.elf

.PHONY: all all-before all-after clean clean-custom

all: all-before $(TARGET) all-after

include dreamcast.mak

OBJS = sdlame.o computer.o game.o input.o output.o player.o
   
	 
include $(KOS_BASE)/Makefile.rules

clean:
	-rm -f $(TARGET) $(OBJS) dclame.bin romdisk.*

rm-elf:
	-rm -f $(TARGET) romdisk.*

$(TARGET): $(OBJS) $(PROBJS) romdisk.o
	$(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \
		$(OBJS)  $(PROBJS)  romdisk.o $(OBJEXTRA) -L$(KOS_BASE)/lib -lgcc -lSDL_129 -lSDL_image_124 -lSDL_ttf -lpng_128 -lfreetype -lz_123 -lm -lSDL_129 $(KOS_LIBS)

