Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Commit

Permalink
Improve arm-linux makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdanielps committed May 14, 2016
1 parent 97f9a95 commit af82736
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 90 deletions.
54 changes: 54 additions & 0 deletions 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
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -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
Expand Down
88 changes: 0 additions & 88 deletions source/arm-linux/Makefile

This file was deleted.

0 comments on commit af82736

Please sign in to comment.