mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-13 21:56:42 +00:00
111 lines
3.2 KiB
Makefile
Executable file
111 lines
3.2 KiB
Makefile
Executable file
ifeq ($(strip $(DEVKITARM)),)
|
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
endif
|
|
|
|
include $(DEVKITARM)/base_rules
|
|
|
|
################################################################################
|
|
|
|
IPL_LOAD_ADDR := 0x40008000
|
|
|
|
################################################################################
|
|
|
|
TARGET := aio_rcm
|
|
BUILDDIR := build
|
|
OUTPUTDIR := output
|
|
SOURCEDIR = bootloader
|
|
BDKDIR := bdk
|
|
BDKINC := -I./$(BDKDIR)
|
|
VPATH = $(dir ./$(SOURCEDIR)/) $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
|
|
VPATH += $(dir $(wildcard ./$(BDKDIR)/)) $(dir $(wildcard ./$(BDKDIR)/*/)) $(dir $(wildcard ./$(BDKDIR)/*/*/))
|
|
|
|
# Main and graphics.
|
|
OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
start.o exception_handlers.o \
|
|
main.o heap.o \
|
|
gfx.o \
|
|
)
|
|
|
|
# Hardware.
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
bpmp.o ccplex.o clock.o di.o gpio.o i2c.o irq.o mc.o sdram.o \
|
|
pinmux.o pmc.o se.o smmu.o tsec.o uart.o \
|
|
fuse.o kfuse.o minerva.o \
|
|
sdmmc.o sdmmc_driver.o nx_sd.o \
|
|
bq24193.o max17050.o max7762x.o max77620-rtc.o \
|
|
hw_init.o \
|
|
)
|
|
|
|
# Utilities.
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
btn.o dirlist.o ianos.o util.o \
|
|
config.o ini.o \
|
|
)
|
|
|
|
# Libraries.
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
lz.o blz.o \
|
|
diskio.o ff.o ffunicode.o ffsystem.o \
|
|
elfload.o elfreloc_arm.o \
|
|
)
|
|
|
|
GFX_INC := '"../$(SOURCEDIR)/gfx/gfx.h"'
|
|
FFCFG_INC := '"../$(SOURCEDIR)/libs/fatfs/ffconf.h"'
|
|
|
|
################################################################################
|
|
|
|
CUSTOMDEFINES := -DIPL_LOAD_ADDR=$(IPL_LOAD_ADDR)
|
|
CUSTOMDEFINES += -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC)
|
|
|
|
# 0: UART_A, 1: UART_B.
|
|
#CUSTOMDEFINES += -DDEBUG_UART_PORT=0
|
|
|
|
#CUSTOMDEFINES += -DDEBUG
|
|
|
|
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
|
|
CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
|
|
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=IPL_LOAD_ADDR=$(IPL_LOAD_ADDR)
|
|
|
|
MODULEDIRS := $(wildcard modules/*)
|
|
NYXDIR := $(wildcard nyx)
|
|
|
|
################################################################################
|
|
|
|
.PHONY: all clean
|
|
|
|
all: $(TARGET).bin
|
|
@printf ICTC49 >> $(OUTPUTDIR)/$(TARGET).bin
|
|
@echo "--------------------------------------"
|
|
@echo -n "Payload size: "
|
|
$(eval BIN_SIZE = $(shell wc -c < $(OUTPUTDIR)/$(TARGET).bin))
|
|
@echo $(BIN_SIZE)" Bytes"
|
|
@echo "Payload Max: 126296 Bytes"
|
|
@if [ ${BIN_SIZE} -gt 126296 ]; then echo "\e[1;33mPayload size exceeds limit!\e[0m"; fi
|
|
@echo "--------------------------------------"
|
|
|
|
clean:
|
|
@rm -rf $(OBJS)
|
|
@rm -rf $(BUILDDIR)
|
|
@rm -rf $(OUTPUTDIR)
|
|
|
|
$(TARGET).bin: $(BUILDDIR)/$(TARGET)/$(TARGET).elf
|
|
$(OBJCOPY) -S -O binary $< $(OUTPUTDIR)/$@
|
|
|
|
$(BUILDDIR)/$(TARGET)/$(TARGET).elf: $(OBJS)
|
|
@$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@
|
|
@echo "hekate was built with the following flags:\nCFLAGS: "$(CFLAGS)"\nLDFLAGS: "$(LDFLAGS)
|
|
|
|
$(BUILDDIR)/$(TARGET)/%.o: %.c
|
|
@echo Building $@
|
|
@$(CC) $(CFLAGS) $(BDKINC) -c $< -o $@
|
|
|
|
$(BUILDDIR)/$(TARGET)/%.o: %.S
|
|
@echo Building $@
|
|
@$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
$(OBJS): $(BUILDDIR)/$(TARGET)
|
|
|
|
$(BUILDDIR)/$(TARGET):
|
|
@mkdir -p "$(BUILDDIR)"
|
|
@mkdir -p "$(BUILDDIR)/$(TARGET)"
|
|
@mkdir -p "$(OUTPUTDIR)"
|