2015-08-05 03:57:37 +02:00
|
|
|
rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2))
|
|
|
|
|
2016-04-08 19:52:37 +02:00
|
|
|
ifeq ($(strip $(DEVKITARM)),)
|
|
|
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
|
|
endif
|
|
|
|
|
|
|
|
include $(DEVKITARM)/3ds_rules
|
|
|
|
|
2015-08-05 03:57:37 +02:00
|
|
|
CC := arm-none-eabi-gcc
|
|
|
|
AS := arm-none-eabi-as
|
|
|
|
LD := arm-none-eabi-ld
|
|
|
|
OC := arm-none-eabi-objcopy
|
|
|
|
|
2016-04-23 02:38:29 +02:00
|
|
|
name := Luma3DS
|
2016-05-21 22:59:14 +02:00
|
|
|
revision := $(shell git describe --tags --match v[0-9]* --abbrev=8 | sed 's/-[0-9]*-g/-/i')
|
2016-08-17 23:47:30 +02:00
|
|
|
commit := $(shell git rev-parse --short=8 HEAD)
|
2016-01-16 13:57:56 +01:00
|
|
|
|
2015-08-05 03:57:37 +02:00
|
|
|
dir_source := source
|
2016-03-23 20:23:27 +01:00
|
|
|
dir_patches := patches
|
|
|
|
dir_loader := loader
|
2016-09-08 22:33:25 +02:00
|
|
|
dir_injector := injector
|
2016-09-08 19:24:10 +02:00
|
|
|
dir_exceptions := exceptions
|
2016-09-11 01:28:57 +02:00
|
|
|
dir_arm9_exceptions := $(dir_exceptions)/arm9
|
|
|
|
dir_arm11_exceptions := $(dir_exceptions)/arm11
|
2016-09-23 02:06:04 +02:00
|
|
|
dir_cakebrah := CakeBrah
|
2016-09-22 14:48:28 +02:00
|
|
|
dir_diffs := diffs
|
2016-03-23 20:23:27 +01:00
|
|
|
dir_build := build
|
|
|
|
dir_out := out
|
2015-08-05 03:57:37 +02:00
|
|
|
|
2016-04-19 20:51:00 +02:00
|
|
|
ASFLAGS := -mcpu=arm946e-s
|
2016-04-11 15:53:59 +02:00
|
|
|
CFLAGS := -Wall -Wextra -MMD -MP -marm $(ASFLAGS) -fno-builtin -fshort-wchar -std=c11 -Wno-main -O2 -flto -ffast-math
|
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
|
|
|
LDFLAGS := -nostartfiles
|
2016-05-27 14:08:06 +02:00
|
|
|
FLAGS := name=$(name).dat dir_out=$(abspath $(dir_out)) ICON=$(abspath icon.png) APP_DESCRIPTION="Noob-friendly 3DS CFW." APP_AUTHOR="Aurora Wright/TuxSH" --no-print-directory
|
2015-08-05 03:57:37 +02:00
|
|
|
|
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
|
|
|
objects = $(patsubst $(dir_source)/%.s, $(dir_build)/%.o, \
|
|
|
|
$(patsubst $(dir_source)/%.c, $(dir_build)/%.o, \
|
|
|
|
$(call rwildcard, $(dir_source), *.s *.c)))
|
2015-08-05 03:57:37 +02:00
|
|
|
|
2016-09-23 02:25:37 +02:00
|
|
|
bundled = $(dir_build)/reboot.bin.o $(dir_build)/emunand.bin.o $(dir_build)/svcGetCFWInfo.bin.o $(dir_build)/injector.bin.o \
|
|
|
|
$(dir_build)/loader.bin.o $(dir_build)/k11modules.bin.o $(dir_build)/arm9_exceptions.bin.o $(dir_build)/arm11_exceptions.bin.o
|
2016-09-23 02:06:04 +02:00
|
|
|
|
|
|
|
define bin2o
|
|
|
|
bin2s $< | $(AS) -o $(@)
|
|
|
|
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> $(dir_build)/bundled.h
|
|
|
|
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> $(dir_build)/bundled.h
|
|
|
|
endef
|
2016-04-14 17:10:55 +02:00
|
|
|
|
2015-08-05 03:57:37 +02:00
|
|
|
.PHONY: all
|
2016-09-23 02:13:12 +02:00
|
|
|
all: a9lh cakebrah menuhax
|
2015-08-05 12:31:17 +02:00
|
|
|
|
2016-09-23 02:25:37 +02:00
|
|
|
.PHONY: release
|
|
|
|
release: $(dir_out)/$(name)$(revision).7z
|
2015-08-05 03:57:37 +02:00
|
|
|
|
2016-09-14 19:14:45 +02:00
|
|
|
.PHONY: menuhax
|
|
|
|
menuhax: $(dir_out)/menuhax/boot.3dsx
|
|
|
|
|
2016-09-23 02:25:37 +02:00
|
|
|
.PHONY: cakebrah
|
|
|
|
cakebrah: $(dir_out)/3ds/$(name)
|
|
|
|
|
|
|
|
.PHONY: a9lh
|
|
|
|
a9lh: $(dir_out)/arm9loaderhax.bin
|
2016-04-11 05:15:44 +02:00
|
|
|
|
2015-08-05 03:57:37 +02:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2016-09-23 02:06:04 +02:00
|
|
|
@$(MAKE) $(FLAGS) -C $(dir_cakebrah) clean
|
2016-03-20 01:00:45 +01:00
|
|
|
@$(MAKE) -C $(dir_loader) clean
|
2016-04-26 22:06:19 +02:00
|
|
|
@$(MAKE) -C $(dir_arm9_exceptions) clean
|
2016-06-11 00:00:53 +02:00
|
|
|
@$(MAKE) -C $(dir_arm11_exceptions) clean
|
2016-03-29 17:43:53 +02:00
|
|
|
@$(MAKE) -C $(dir_injector) clean
|
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
|
|
|
@rm -rf $(dir_out) $(dir_build)
|
2015-08-05 03:57:37 +02:00
|
|
|
|
2016-09-23 02:06:04 +02:00
|
|
|
.PRECIOUS: $(dir_build)/%.bin
|
|
|
|
|
2016-03-23 20:23:27 +01:00
|
|
|
$(dir_out):
|
2016-08-13 23:56:07 +02:00
|
|
|
@mkdir -p "$(dir_out)"
|
2016-03-23 20:23:27 +01:00
|
|
|
|
2016-09-23 02:06:04 +02:00
|
|
|
$(dir_out)/$(name)$(revision).7z: all
|
|
|
|
@7z a -mx $@ ./$(@D)/* ./$(dir_exceptions)/exception_dump_parser.py
|
|
|
|
|
2016-09-22 14:48:28 +02:00
|
|
|
$(dir_out)/menuhax/boot.3dsx: $(dir_diffs) $(dir_out)
|
2016-09-14 19:14:45 +02:00
|
|
|
@mkdir -p "$(@D)"
|
2016-09-23 02:06:04 +02:00
|
|
|
@cd $(dir_cakebrah); patch -p1 < ../$(dir_diffs)/1.diff; patch -p1 < ../$(dir_diffs)/2.diff; $(MAKE) $(FLAGS); git reset --hard
|
2016-09-14 19:14:45 +02:00
|
|
|
@mv $(dir_out)/$(name).3dsx $@
|
|
|
|
@rm $(dir_out)/$(name).smdh
|
|
|
|
|
2016-09-22 14:48:28 +02:00
|
|
|
$(dir_out)/3ds/$(name): $(dir_diffs) $(dir_out)
|
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
|
|
|
@mkdir -p "$@"
|
2016-09-23 02:06:04 +02:00
|
|
|
@cd $(dir_cakebrah); patch -p1 < ../$(dir_diffs)/1.diff; $(MAKE) $(FLAGS); git reset --hard
|
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
|
|
|
@mv $(dir_out)/$(name).3dsx $(dir_out)/$(name).smdh $@
|
2016-02-08 03:37:03 +01:00
|
|
|
|
2016-09-23 02:06:04 +02:00
|
|
|
$(dir_out)/arm9loaderhax.bin: $(dir_build)/main.bin $(dir_out)
|
|
|
|
@cp -a $(dir_build)/main.bin $@
|
2016-09-08 19:24:10 +02:00
|
|
|
|
2016-04-14 17:10:55 +02:00
|
|
|
$(dir_build)/main.bin: $(dir_build)/main.elf
|
|
|
|
$(OC) -S -O binary $< $@
|
|
|
|
|
2016-09-23 02:06:04 +02:00
|
|
|
$(dir_build)/main.elf: $(bundled) $(objects)
|
2016-04-19 20:51:00 +02:00
|
|
|
$(LINK.o) -T linker.ld $(OUTPUT_OPTION) $^
|
2016-04-14 17:10:55 +02:00
|
|
|
|
2016-09-23 02:06:04 +02:00
|
|
|
$(dir_build)/%.bin.o: $(dir_build)/%.bin
|
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
|
|
|
@mkdir -p "$(@D)"
|
2016-09-23 02:06:04 +02:00
|
|
|
@$(bin2o)
|
2016-05-25 14:34:43 +02:00
|
|
|
|
2016-09-23 02:06:04 +02:00
|
|
|
$(dir_build)/injector.bin: $(dir_injector)/Makefile
|
2016-05-25 14:34:43 +02:00
|
|
|
@mkdir -p "$(@D)"
|
2016-09-19 14:03:55 +02:00
|
|
|
@$(MAKE) -C $(dir_injector)
|
2016-03-08 15:13:55 +01:00
|
|
|
|
2016-09-23 02:06:04 +02:00
|
|
|
$(dir_build)/loader.bin: $(dir_loader)/Makefile
|
|
|
|
@mkdir -p "$(@D)"
|
2016-03-20 01:00:45 +01:00
|
|
|
@$(MAKE) -C $(dir_loader)
|
2015-08-05 03:57:37 +02:00
|
|
|
|
2016-09-23 02:06:04 +02:00
|
|
|
$(dir_build)/arm9_exceptions.bin: $(dir_arm9_exceptions)/Makefile
|
2016-09-08 22:33:25 +02:00
|
|
|
@mkdir -p "$(@D)"
|
2016-04-26 22:06:19 +02:00
|
|
|
@$(MAKE) -C $(dir_arm9_exceptions)
|
|
|
|
|
2016-09-23 02:06:04 +02:00
|
|
|
$(dir_build)/arm11_exceptions.bin: $(dir_arm11_exceptions)/Makefile
|
|
|
|
@mkdir -p "$(@D)"
|
2016-06-02 22:33:44 +02:00
|
|
|
@$(MAKE) -C $(dir_arm11_exceptions)
|
2016-09-23 02:06:04 +02:00
|
|
|
|
|
|
|
$(dir_build)/%.bin: $(dir_patches)/%.s
|
|
|
|
@mkdir -p "$(@D)"
|
|
|
|
@armips $<
|
2016-08-30 21:02:45 +02:00
|
|
|
|
2016-08-30 19:48:21 +02:00
|
|
|
$(dir_build)/memory.o $(dir_build)/strings.o: CFLAGS += -O3
|
2016-09-19 14:03:55 +02:00
|
|
|
$(dir_build)/config.o: CFLAGS += -DCONFIG_TITLE="\"$(name) $(revision) configuration\""
|
2016-08-17 23:47:30 +02:00
|
|
|
$(dir_build)/patches.o: CFLAGS += -DREVISION=\"$(revision)\" -DCOMMIT_HASH="0x$(commit)"
|
2016-04-02 17:58:06 +02:00
|
|
|
|
2016-04-14 17:10:55 +02:00
|
|
|
$(dir_build)/%.o: $(dir_source)/%.c $(bundled)
|
2015-08-05 03:57:37 +02:00
|
|
|
@mkdir -p "$(@D)"
|
|
|
|
$(COMPILE.c) $(OUTPUT_OPTION) $<
|
|
|
|
|
|
|
|
$(dir_build)/%.o: $(dir_source)/%.s
|
|
|
|
@mkdir -p "$(@D)"
|
|
|
|
$(COMPILE.s) $(OUTPUT_OPTION) $<
|
|
|
|
include $(call rwildcard, $(dir_build), *.d)
|