mirror of
https://vps.suchmeme.nl/git/mudkip/Lockpick_RCM.git
synced 2024-12-27 10:11:54 +01:00
98 lines
2.5 KiB
Makefile
98 lines
2.5 KiB
Makefile
ifeq ($(strip $(DEVKITARM)),)
|
|
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
|
endif
|
|
|
|
include $(DEVKITARM)/base_rules
|
|
|
|
################################################################################
|
|
|
|
IPL_LOAD_ADDR := 0x40003000
|
|
LPVERSION_MAJOR := 1
|
|
LPVERSION_MINOR := 1
|
|
LPVERSION_BUGFX := 1
|
|
|
|
################################################################################
|
|
|
|
TARGET := Lockpick_RCM
|
|
BUILDDIR := build
|
|
OUTPUTDIR := output
|
|
SOURCEDIR = source
|
|
VPATH = $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
|
|
|
|
# Main and graphics.
|
|
OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
start.o \
|
|
main.o heap.o \
|
|
keys.o \
|
|
gfx.o \
|
|
)
|
|
|
|
# Hardware.
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
clock.o cluster.o di.o gpio.o i2c.o mc.o sdram.o sdram_lp0.o pinmux.o se.o smmu.o tsec.o \
|
|
fuse.o \
|
|
sdmmc.o sdmmc_driver.o \
|
|
max17050.o max7762x.o max77620-rtc.o \
|
|
hw_init.o \
|
|
)
|
|
|
|
# Utilities.
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
btn.o util.o \
|
|
)
|
|
|
|
# Horizon.
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
nx_emmc.o \
|
|
pkg1.o pkg2.o sept.o \
|
|
)
|
|
|
|
# Libraries.
|
|
OBJS += $(addprefix $(BUILDDIR)/$(TARGET)/, \
|
|
lz.o blz.o \
|
|
diskio.o ff.o ffunicode.o ffsystem.o \
|
|
)
|
|
|
|
################################################################################
|
|
|
|
CUSTOMDEFINES := -DIPL_LOAD_ADDR=$(IPL_LOAD_ADDR)
|
|
CUSTOMDEFINES += -DLP_VER_MJ=$(LPVERSION_MAJOR) -DLP_VER_MN=$(LPVERSION_MINOR) -DLP_VER_BF=$(LPVERSION_BUGFX)
|
|
|
|
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork
|
|
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -std=gnu11 -Wall $(CUSTOMDEFINES)
|
|
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=IPL_LOAD_ADDR=$(IPL_LOAD_ADDR)
|
|
|
|
MODULEDIRS := $(wildcard modules/*)
|
|
|
|
################################################################################
|
|
|
|
.PHONY: all clean $(MODULEDIRS)
|
|
|
|
all: $(TARGET).bin
|
|
@echo -n "Payload size is "
|
|
@wc -c < $(OUTPUTDIR)/$(TARGET).bin
|
|
@echo "Max size is 126296 Bytes."
|
|
|
|
clean:
|
|
@rm -rf $(OBJS)
|
|
@rm -rf $(BUILDDIR)
|
|
@rm -rf $(OUTPUTDIR)
|
|
|
|
$(MODULEDIRS):
|
|
$(MAKE) -C $@ $(MAKECMDGOALS)
|
|
|
|
$(TARGET).bin: $(BUILDDIR)/$(TARGET)/$(TARGET).elf $(MODULEDIRS)
|
|
$(OBJCOPY) -S -O binary $< $(OUTPUTDIR)/$@
|
|
|
|
$(BUILDDIR)/$(TARGET)/$(TARGET).elf: $(OBJS)
|
|
$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@
|
|
|
|
$(BUILDDIR)/$(TARGET)/%.o: %.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
$(BUILDDIR)/$(TARGET)/%.o: %.S
|
|
@mkdir -p "$(BUILDDIR)"
|
|
@mkdir -p "$(BUILDDIR)/$(TARGET)"
|
|
@mkdir -p "$(OUTPUTDIR)"
|
|
$(CC) $(CFLAGS) -c $< -o $@
|