-CC = arm-linux-gcc
-STRIP = arm-linux-strip
-TFLAGS = -mcpu=arm920t -Izlib -DGP2X=1 -DLSB_FIRST -DSDL -DUNIX -DPSS_STYLE=1 -DZLIB -DFRAMESKIP -D_REENTRANT
+CROSS = arm-linux-
+CC = $(CROSS)gcc
+STRIP = $(CROSS)strip
+AS = $(CROSS)as
+TFLAGS = -Winline -mcpu=arm920t -Izlib -DGP2X=1 -DLSB_FIRST -DUNIX -DPSS_STYLE=1 -DHAVE_ASPRINTF -DZLIB -DFRAMESKIP -D_REENTRANT
+ASFLAGS = -mcpu=arm920t -mfloat-abi=soft
RM = rm -f
-B = drivers/pc/
+B = drivers/gp2x/
ifdef DEBUG
TFLAGS += -ggdb
+LDRIVER += -ggdb
else
-TFLAGS += -O3
+TFLAGS += -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math
+TFLAGS += -O3 # -pg
+LDRIVER += -O3 # -pg
endif
+asm_6502=1
+#debug_asm_6502=1
+
all: fceu
gpfce: fceu
include zlib/Makefile
-OBJDRIVER = ${B}minimal.o ${B}sdl.o ${B}main.o ${B}throttle.o ${B}unix-netplay.o ${B}sdl-sound.o ${B}sdl-video.o ${B}sdl-joystick.o drivers/common/cheat.o drivers/common/config.o drivers/common/args.o drivers/common/vidblit.o ${UNZIPOBJS} ppu.o
-LDRIVER = -L /mnt/sd/lib -L/mnt/sd/gp2x/usr/lib -lm -lpthread -lz -static
-# `arm-linux-sdl-config --libs`
+OBJDRIVER = ${B}minimal.o ${B}squidgehack.o ${B}asmutils.o ${B}gp2x.o ${B}main.o ${B}throttle.o \
+ ${B}unix-netplay.o ${B}gp2x-sound.o ${B}gp2x-video.o ${B}lnx-joystick.o \
+ drivers/common/cheat.o drivers/common/config.o drivers/common/args.o drivers/common/vidblit.o ${UNZIPOBJS} ppu.o movie.o
+LDRIVER += -L /mnt/sd/lib -L/mnt/sd/gp2x/usr/lib -lm -lz -static -Wl,-Map=fceu.map
+
+ifeq ($(asm_6502),1)
+TFLAGS += -DASM_6502
+OBJDRIVER += ncpu.o
+ifeq ($(debug_asm_6502),1)
+TFLAGS += -DDEBUG_ASM_6502
+OBJDRIVER += x6502.o ncpu_debug.o
+endif
+else
+OBJDRIVER += x6502.o
+endif
+
+x6502.o: x6502.c x6502.h ops.h fce.h sound.h dprintf.h
+
+ncpu.o: ncpu.S ncpu.h
+ $(CC) $(TFLAGS) -c $< -o $@
include Makefile.base
-${B}sdl-joystick.o: ${B}sdl-joystick.c
-${B}main.o: ${B}main.c ${B}main.h ${B}usage.h ${B}input.c ${B}keyscan.h
-${B}sdl.o: ${B}sdl.c ${B}sdl.h
-${B}sdl-video.o: ${B}sdl-video.c
-${B}sdl-video.o: ${B}minimal.c
-${B}sdl-sound.o: ${B}sdl-sound.c
-#${B}sdl-netplay.o: ${B}sdl-netplay.c
-${B}unix-netplay.o: ${B}unix-netplay.c
+${B}main.o: ${B}main.c ${B}main.h ${B}usage.h ${B}input.c
+${B}gp2x.o: ${B}gp2x.c ${B}gp2x.h
${B}throttle.o: ${B}throttle.c ${B}main.h ${B}throttle.h
ppu.o: ppu.c ppu.h
include Makefile.common
+#x6502.o: x6502.c x6502.h ops.h fce.h sound.h
+# $(CC) $(CFLAGS) -finline-limit=60000 -c $< -o $@
+
up: fceu
cp -v fceu /mnt/gp2x/mnt/sd/emus/Gpfce_v02/gpfce
+# ----------- release -----------
+ifneq ($(findstring rel,$(MAKECMDGOALS)),)
+ifeq ($(VER),)
+$(error need VER)
+endif
+endif
+
+rel: gpfce
+ zip -9 -j Gpfce_v$(VER).zip $^ drivers/gp2x/mmuhack.o out_gp2x/*
+
+