diff --git a/Makefile.linux b/Makefile.linux new file mode 100644 index 0000000..2ab0e8a --- /dev/null +++ b/Makefile.linux @@ -0,0 +1,54 @@ +# arm-linux makefile + +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source/common source/arm-linux source/common/inih +INCLUDES := include source/common/inih + +ARCH := -march=armv6 -mfloat-abi=hard + +CFLAGS := -Wall -Wno-unused \ + -fomit-frame-pointer -ffast-math \ + $(ARCH) + +OUTPUT := $(CURDIR)/$(TARGET) +TOPDIR := $(CURDIR) + +DEPSDIR := $(CURDIR)/$(BUILD) +VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +OFILES := $(addsuffix .o,$(BINFILES)) \ + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +CFLAGS += $(INCLUDE) +ASFLAGS := -g $(ARCH) +LIBS := -lm + +all: slowdebug +release: CFLAGS += -O3 -DDEBUGLEVEL=0 +testing: CFLAGS += -O3 -DDEBUGLEVEL=1 +debug: CFLAGS += -g -O0 -DDEBUGLEVEL=2 +slowdebug: CFLAGS += -g -O0 -DDEBUGLEVEL=3 + +release testing debug slowdebug: $(BUILD) $(OUTPUT).elf + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $(DEPSDIR)/$@ + +%.o: %.s + $(CC) $(CFLAGS) -c $< -o $(DEPSDIR)/$@ + +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + +$(OUTPUT).elf: $(OFILES) + $(CC) $(CFLAGS) $(LIBS) -o $@ $(BUILD)/*.o + +clean: + @rm -rf build $(OUTPUT).elf diff --git a/README.md b/README.md index 724a89f..cdceb1d 100644 --- a/README.md +++ b/README.md @@ -52,12 +52,12 @@ between four different make targets: * **`make debug`** adds `-g -O0` to CFLAGS. It builds without optimizations so it can be debugged with gdb. * **`make slowdebug`** adds `-g -O0` to CFLAGS. It will output a lot of debug information, which will slow emulation down but might be helpful to debug game-specific issues. -For easier debugging, you can build it for android (with graphics, sound and input disabled) using `ndk-build`. +For easier debugging, you can build it for arm-linux (tested on a Raspberry Pi) with `make -f Makefile.linux` or for android using `ndk-build`. ###License Some of the code is distributed under the MIT License (check source files for that) but, since -this is a port of Red Dragon (which was based on Reality Boy), here is (part of) the original readme: +this is a port of Reality Boy, here is (part of) the original readme: ``` This Reality Boy emulator is copyright (C) David Tucker 1997-2008, all rights diff --git a/source/arm-linux/Makefile b/source/arm-linux/Makefile deleted file mode 100644 index 102ba70..0000000 --- a/source/arm-linux/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# arm-linux makefile - -# Build with 'make' or 'make CC=...' -# FIXME: Make a proper makefile - -all: r3Ddragon - -SPATH=../common -DPATH=./ -IPATH=../../include -VPATH = $(SPATH):$(DPATH) - -#Set the OBJ and Link flags, based on Debug and Profile -ifdef DEBUGMODE -# build a debug version -OFLAGS = -g -O0 -ffast-math -fomit-frame-pointer -DDEBUGLEVEL=2 -LFLAGS = -lm - -else -ifdef PROFILEMODE -# build with profiling information -OFLAGS = -pg -O3 -ffast-math -fomit-frame-pointer -DDEBUGLEVEL=4 -LFLAGS = -pg -lm - -else -# build a normal optimised version -OFLAGS = -O3 -ffast-math -fomit-frame-pointer -DDEBUGLEVEL=0 -LFLAGS = -lm - -endif -endif - -WFLAGS = -Wall -Wno-unused -CFLAGS = -march=armv6 $(WFLAGS) $(OFLAGS) -I$(SPATH) -I$(DPATH) -I$(IPATH) - -r3Ddragon: allegro_compat.o main.o drc_core.o drc_exec.o drc_static.o \ - rom_db.o v810_cpu.o v810_ins.o v810_mem.o vb_dsp.o vb_gui.o \ - vb_set.o vb_sound.o arm_utils.o ini.o - $(CC) -o $@ $^ $(CFLAGS) $(LFLAGS) - -allegro_compat.o: allegro_compat.c - $(CC) -c $(CFLAGS) $< -o $@ - -main.o: main.c - $(CC) -c $(CFLAGS) $< -o $@ - -drc_core.o: drc_core.c - $(CC) -c $(CFLAGS) $< -o $@ - -drc_exec.o: drc_exec.s - $(CC) -c $(CFLAGS) $< -o $@ - -drc_static.o: drc_static.s - $(CC) -c $(CFLAGS) $< -o $@ - -rom_db.o: rom_db.c - $(CC) -c $(CFLAGS) $< -o $@ - -v810_cpu.o: v810_cpu.c - $(CC) -c $(CFLAGS) $< -o $@ - -v810_ins.o: v810_ins.c - $(CC) -c $(CFLAGS) $< -o $@ - -v810_mem.o: v810_mem.c - $(CC) -c $(CFLAGS) $< -o $@ - -vb_dsp.o: vb_dsp.c - $(CC) -c $(CFLAGS) $< -o $@ - -vb_gui.o: vb_gui.c - $(CC) -c $(CFLAGS) $< -o $@ - -vb_set.o: vb_set.c - $(CC) -c $(CFLAGS) $< -o $@ - -vb_sound.o: vb_sound.c - $(CC) -c $(CFLAGS) $< -o $@ - -arm_utils.o: arm_utils.c - $(CC) -c $(CFLAGS) $< -o $@ - -ini.o: inih/ini.c - $(CC) -Iinih -c $(CFLAGS) $< -o $@ - -clean: - rm -f *.o - rm -f r3Ddragon