2016-04-12 04:48:35 +02:00
|
|
|
rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2))
|
2016-03-08 15:13:55 +01:00
|
|
|
|
|
|
|
ifeq ($(strip $(DEVKITARM)),)
|
|
|
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
|
|
endif
|
|
|
|
|
2016-04-12 04:48:35 +02:00
|
|
|
CC := arm-none-eabi-gcc
|
|
|
|
AS := arm-none-eabi-as
|
|
|
|
LD := arm-none-eabi-ld
|
|
|
|
OC := arm-none-eabi-objcopy
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-04-12 04:48:35 +02:00
|
|
|
name := $(shell basename $(CURDIR))
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-04-12 04:48:35 +02:00
|
|
|
dir_source := source
|
|
|
|
dir_build := build
|
2016-09-23 18:45:59 +02:00
|
|
|
dir_out := ../$(dir_build)
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-04-19 20:51:00 +02:00
|
|
|
ASFLAGS := -mcpu=arm946e-s
|
|
|
|
CFLAGS := -Wall -Wextra -MMD -MP -mthumb -mthumb-interwork $(ASFLAGS) -fno-builtin -std=c11 -Wno-main -O2 -flto -ffast-math
|
2016-05-03 03:05:11 +02:00
|
|
|
LDFLAGS := -nostdlib
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-04-12 04:48:35 +02:00
|
|
|
objects = $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \
|
Added region/language emulation feature, thanks to the hard work of @TuxSH
Create a "locales" folder inside aurei, and one .txt for each game, with the title id of the game. The txt must be exactly 6 bytes long: 3 characters for the region ("JPN", "USA", "EUR", "AUS", "CHN", "KOR", "TWN"), a space, and two for the language ("JP", "EN", "FR", "DE", "IT", "ES", "ZH", "KO", "NL", "PT", "RU", "TW"). You can enable the feature globally in the config menu. This should also make DLCs for foreign games work.
2016-04-14 00:46:36 +02:00
|
|
|
$(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \
|
|
|
|
$(call rwildcard, $(dir_source), *.s *.c)))
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-04-12 04:48:35 +02:00
|
|
|
.PHONY: all
|
2016-09-23 18:45:59 +02:00
|
|
|
all: $(dir_out)/$(name).bin
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-04-12 04:48:35 +02:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
@rm -rf $(dir_build)
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-09-23 18:45:59 +02:00
|
|
|
$(dir_out)/$(name).bin: $(dir_build)/$(name).elf
|
2016-04-12 04:48:35 +02:00
|
|
|
$(OC) -S -O binary $< $@
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-04-12 04:48:35 +02:00
|
|
|
$(dir_build)/$(name).elf: $(objects)
|
2016-04-19 20:51:00 +02:00
|
|
|
$(LINK.o) -T linker.ld $(OUTPUT_OPTION) $^
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-05-03 03:05:11 +02:00
|
|
|
$(dir_build)/memory.o: CFLAGS += -O3
|
|
|
|
|
2016-04-12 04:48:35 +02:00
|
|
|
$(dir_build)/%.o: $(dir_source)/%.c
|
|
|
|
@mkdir -p "$(@D)"
|
|
|
|
$(COMPILE.c) $(OUTPUT_OPTION) $<
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-04-12 04:48:35 +02:00
|
|
|
$(dir_build)/%.o: $(dir_source)/%.s
|
|
|
|
@mkdir -p "$(@D)"
|
|
|
|
$(COMPILE.s) $(OUTPUT_OPTION) $<
|
|
|
|
include $(call rwildcard, $(dir_build), *.d)
|