hekate-emmc/Makefile

88 lines
1.7 KiB
Makefile
Raw Normal View History

2018-04-30 22:15:48 -07:00
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
2018-06-08 02:42:24 -07:00
include $(DEVKITARM)/base_rules
2018-04-30 22:15:48 -07:00
TARGET := ipl
BUILD := build_ipl
2018-08-07 07:53:58 -07:00
OUTPUT := output
2018-04-30 22:15:48 -07:00
SOURCEDIR := ipl
2018-08-07 07:53:58 -07:00
2018-04-30 22:15:48 -07:00
OBJS = $(addprefix $(BUILD)/, \
start.o \
main.o \
config.o \
2018-04-30 22:15:48 -07:00
btn.o \
blz.o \
2018-04-30 22:15:48 -07:00
clock.o \
cluster.o \
fuse.o \
gpio.o \
heap.o \
hos.o \
i2c.o \
kfuse.o \
lz.o \
2018-06-24 12:42:46 -07:00
bq24193.o \
2018-04-30 22:15:48 -07:00
max7762x.o \
2018-06-24 12:42:46 -07:00
max17050.o \
2018-04-30 22:15:48 -07:00
mc.o \
nx_emmc.o \
sdmmc.o \
sdmmc_driver.o \
sdram.o \
sdram_lp0.o \
tui.o \
util.o \
di.o \
gfx.o \
pinmux.o \
pkg1.o \
pkg2.o \
se.o \
tsec.o \
uart.o \
ini.o \
)
2018-08-07 07:53:58 -07:00
2018-06-22 20:30:57 -07:00
OBJS += $(addprefix $(BUILD)/, diskio.o ff.o ffunicode.o ffsystem.o)
2018-08-07 07:53:58 -07:00
OBJS += $(addprefix $(BUILD)/elfloader/, elfload.o elfreloc_arm.o)
2018-04-30 22:15:48 -07:00
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
2018-08-07 07:53:58 -07:00
CUSTOMDEFINES := -DMENU_LOGO_ENABLE #-DDEBUG
2018-06-19 07:10:59 -07:00
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
2018-04-30 22:15:48 -07:00
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections
2018-08-07 07:53:58 -07:00
MODULEDIRS := $(wildcard modules/*)
.PHONY: all clean $(MODULEDIRS)
2018-04-30 22:15:48 -07:00
2018-05-10 19:28:53 -07:00
all: $(TARGET).bin
2018-06-30 18:56:58 -07:00
@echo -n "Payload size is "
2018-08-07 07:53:58 -07:00
@wc -c < $(OUTPUT)/$(TARGET).bin
2018-06-30 18:56:58 -07:00
@echo "Max size is 126296 Bytes."
2018-04-30 22:15:48 -07:00
clean:
@rm -rf $(OBJS)
2018-05-10 19:28:53 -07:00
@rm -rf $(BUILD)
2018-08-07 07:53:58 -07:00
@rm -rf $(OUTPUT)
$(MODULEDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
2018-04-30 22:15:48 -07:00
2018-08-07 07:53:58 -07:00
$(TARGET).bin: $(BUILD)/$(TARGET).elf $(MODULEDIRS)
$(OBJCOPY) -S -O binary $< $(OUTPUT)/$@
2018-04-30 22:15:48 -07:00
$(BUILD)/$(TARGET).elf: $(OBJS)
$(CC) $(LDFLAGS) -T ipl/link.ld $^ -o $@
$(BUILD)/%.o: $(SOURCEDIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD)/%.o: $(SOURCEDIR)/%.S
2018-05-10 19:28:53 -07:00
@mkdir -p "$(BUILD)"
2018-08-07 07:53:58 -07:00
@mkdir -p "$(BUILD)/elfloader"
@mkdir -p "$(OUTPUT)"
2018-04-30 22:15:48 -07:00
$(CC) $(CFLAGS) -c $< -o $@