2018-03-14 20:14:02 +00:00
|
|
|
rwildcard = $(foreach d, $(wildcard $1*), $(filter $(subst *, %, $2), $d) $(call rwildcard, $d/, $2))
|
|
|
|
|
|
|
|
ifeq ($(strip $(DEVKITARM)),)
|
|
|
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
|
|
endif
|
|
|
|
|
|
|
|
include $(DEVKITARM)/base_tools
|
|
|
|
|
|
|
|
dir_source := src
|
|
|
|
dir_out := out
|
|
|
|
dir_exosphere := ../exosphere
|
2018-04-07 21:43:54 +00:00
|
|
|
dir_main := fusee
|
|
|
|
dir_loader := fusee-loader
|
|
|
|
dir_stage1 := fusee-stage1
|
2018-03-14 20:14:02 +00:00
|
|
|
|
|
|
|
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
|
|
|
|
|
|
|
|
ASFLAGS := -g $(ARCH)
|
|
|
|
|
|
|
|
# For debug builds, replace -O2 by -Og and comment -fomit-frame-pointer out
|
|
|
|
CFLAGS = \
|
|
|
|
$(ARCH) \
|
|
|
|
-g \
|
|
|
|
-O2 \
|
|
|
|
-fomit-frame-pointer \
|
|
|
|
-ffunction-sections \
|
|
|
|
-fdata-sections \
|
|
|
|
-std=gnu11 \
|
|
|
|
-Werror \
|
|
|
|
-Wall
|
|
|
|
|
|
|
|
LDFLAGS = -specs=linker.specs -g $(ARCH)
|
|
|
|
|
|
|
|
.PHONY: all
|
2018-04-07 21:43:54 +00:00
|
|
|
all: $(dir_out)
|
2018-03-14 20:14:02 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
@$(MAKE) -C $(dir_exosphere) clean
|
2018-04-07 21:43:54 +00:00
|
|
|
@$(MAKE) -C $(dir_main) clean
|
|
|
|
@$(MAKE) -C $(dir_loader) clean
|
|
|
|
@$(MAKE) -C $(dir_stage1) clean
|
2018-03-14 20:14:02 +00:00
|
|
|
@rm -rf $(dir_out)
|
|
|
|
|
2018-04-07 21:43:54 +00:00
|
|
|
.PHONY: $(dir_exosphere) $(dir_loader) $(dir_main) $(dir_stage1)
|
2018-03-14 20:14:02 +00:00
|
|
|
|
2018-04-07 21:43:54 +00:00
|
|
|
$(dir_out): $(dir_main) $(dir_loader) $(dir_stage1)
|
|
|
|
@mkdir -p "$(dir_out)"
|
|
|
|
@$(MAKE) -C $(dir_exosphere)
|
2018-03-14 20:14:02 +00:00
|
|
|
|
|
|
|
$(dir_exosphere)/out/exosphere.bin: $(dir_exosphere)
|
|
|
|
@$(MAKE) -C $<
|
|
|
|
|
2018-04-07 21:43:54 +00:00
|
|
|
$(dir_main):
|
|
|
|
@mkdir -p "$(dir_out)"
|
|
|
|
@$(MAKE) -C $(dir_main)
|
|
|
|
@cp "$(dir_main)/out/$(dir_main).bin" "out/$(dir_main).bin"
|
|
|
|
|
|
|
|
$(dir_loader):
|
|
|
|
@mkdir -p "$(dir_out)"
|
|
|
|
@$(MAKE) -C $(dir_loader)
|
|
|
|
@cp "$(dir_loader)/out/$(dir_loader).bin" "out/$(dir_loader).bin"
|
|
|
|
|
|
|
|
$(dir_stage1):
|
|
|
|
@mkdir -p "$(dir_out)"
|
|
|
|
@$(MAKE) -C $(dir_stage1)
|
|
|
|
@cp "$(dir_stage1)/out/$(dir_stage1).bin" "out/$(dir_stage1).bin"
|
|
|
|
|