TOOLCHAIN=/opt/mipsel-linux-uclibc/usr
CROSS_COMPILE=$(TOOLCHAIN)/bin/mipsel-linux-

export CC = $(CROSS_COMPILE)gcc

export SDLLIB = `cat ../libs.txt`
SDLFLAGS = -I$(TOOLCHAIN)/include/SDL -D_REENTRANT


#CC = arm-openwiz-linux-gnu-gcc
#CC = arm-open2x-linux-gcc
CFLAGS = -O3 -G0 -static -march=mips32 -mtune=r4600 -mno-mips16 -mxgot -mlong-calls -L$(TOOLCHAIN)/lib \
	-msoft-float -funroll-loops -ffast-math -fomit-frame-pointer -fno-strength-reduce -finline-functions \
	-fprofile-use
#	-fprofile-generate

SRCS = disasm.c audio.c configuration.c dialog.c \
  file.c hostcall.c keymap.c \
  main.c memAlloc.c misc.c \
  screen.c screenConvert.c \
  sdlgui.c shortcut.c scalebit.c \
  input.c fe2.c 

OBJS = $(SRCS:.c=.o)

.c.o:
	$(CC) $(CFLAGS) $(INCFLAGS) $(SDLFLAGS) -c $<

../frontier: $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) $(FE2OBJS) $(SDLLIB) $(LIBFLAGS) -o ../frontier
#	$(CROSS_COMPILE)strip ../frontier

clean:
	rm -f *.o

distclean:
	rm -f *.o
	rm -f *.gcno *.gcda

# Use "make depend" to generate file dependencies:
depend: $(SRCS)
	$(CC) -MM $(CFLAGS) $(SRCS) > Makefile.dep

ifneq (,$(wildcard Makefile.dep))
include Makefile.dep
endif

