1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-12-28 02:46:02 +00:00
hekate/Makefile

102 lines
2.1 KiB
Makefile
Raw Normal View History

2018-05-01 06:15:48 +01:00
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
2018-06-08 10:42:24 +01:00
include $(DEVKITARM)/base_rules
2018-05-01 06:15:48 +01:00
2018-08-13 09:58:24 +01:00
TARGET := hekate
BLVERSION_MAJOR := 4
2018-12-02 09:12:19 +00:00
BLVERSION_MINOR := 5
2018-08-13 09:58:24 +01:00
BUILD := build
2018-08-07 15:53:58 +01:00
OUTPUT := output
2018-08-13 09:58:24 +01:00
SOURCEDIR = bootloader
VPATH = $(dir $(wildcard ./$(SOURCEDIR)/*/)) $(dir $(wildcard ./$(SOURCEDIR)/*/*/))
2018-08-07 15:53:58 +01:00
2018-08-13 09:58:24 +01:00
OBJS = $(addprefix $(BUILD)/$(TARGET)/, \
2018-05-01 06:15:48 +01:00
start.o \
main.o \
2018-11-27 09:45:43 +00:00
fe_emmc_tools.o \
fe_info.o \
fe_tools.o \
config.o \
2018-05-01 06:15:48 +01:00
btn.o \
clock.o \
cluster.o \
fuse.o \
gpio.o \
heap.o \
hos.o \
2018-11-28 19:26:16 +00:00
hos_config.o \
secmon_exo.o \
2018-05-01 06:15:48 +01:00
i2c.o \
kfuse.o \
2018-06-24 20:42:46 +01:00
bq24193.o \
2018-05-01 06:15:48 +01:00
max7762x.o \
2018-06-24 20:42:46 +01:00
max17050.o \
2018-05-01 06:15:48 +01:00
mc.o \
nx_emmc.o \
sdmmc.o \
sdmmc_driver.o \
sdram.o \
tui.o \
util.o \
di.o \
gfx.o \
pinmux.o \
pkg1.o \
pkg2.o \
se.o \
tsec.o \
uart.o \
2018-11-27 09:45:43 +00:00
hw_init.o \
dirlist.o \
2018-05-01 06:15:48 +01:00
ini.o \
2018-08-21 02:14:31 +01:00
ianos.o \
smmu.o \
2018-05-01 06:15:48 +01:00
)
2018-08-07 15:53:58 +01:00
2018-08-13 09:58:24 +01:00
OBJS += $(addprefix $(BUILD)/$(TARGET)/, \
lz.o blz.o \
diskio.o ff.o ffunicode.o ffsystem.o \
elfload.o elfreloc_arm.o \
)
2018-05-01 06:15:48 +01:00
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
CUSTOMDEFINES := -DBLVERSIONMJ=$(BLVERSION_MAJOR) -DBLVERSIONMN=$(BLVERSION_MINOR)
CUSTOMDEFINES += -DMENU_LOGO_ENABLE #-DDEBUG
2018-08-21 02:14:31 +01:00
CFLAGS = $(ARCH) -O2 -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES)
2018-05-01 06:15:48 +01:00
LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections
2018-08-07 15:53:58 +01:00
MODULEDIRS := $(wildcard modules/*)
.PHONY: all clean $(MODULEDIRS)
2018-05-01 06:15:48 +01:00
2018-05-11 03:28:53 +01:00
all: $(TARGET).bin
2018-07-01 02:56:58 +01:00
@echo -n "Payload size is "
2018-08-07 15:53:58 +01:00
@wc -c < $(OUTPUT)/$(TARGET).bin
2018-07-01 02:56:58 +01:00
@echo "Max size is 126296 Bytes."
2018-05-01 06:15:48 +01:00
clean:
@rm -rf $(OBJS)
2018-05-11 03:28:53 +01:00
@rm -rf $(BUILD)
2018-08-07 15:53:58 +01:00
@rm -rf $(OUTPUT)
$(MODULEDIRS):
$(MAKE) -C $@ $(MAKECMDGOALS)
2018-05-01 06:15:48 +01:00
2018-08-13 09:58:24 +01:00
$(TARGET).bin: $(BUILD)/$(TARGET)/$(TARGET).elf $(MODULEDIRS)
2018-08-07 15:53:58 +01:00
$(OBJCOPY) -S -O binary $< $(OUTPUT)/$@
@printf ICTC$(BLVERSION_MAJOR)$(BLVERSION_MINOR) >> $(OUTPUT)/$@
2018-05-01 06:15:48 +01:00
2018-08-13 09:58:24 +01:00
$(BUILD)/$(TARGET)/$(TARGET).elf: $(OBJS)
$(CC) $(LDFLAGS) -T $(SOURCEDIR)/link.ld $^ -o $@
2018-05-01 06:15:48 +01:00
2018-08-13 09:58:24 +01:00
$(BUILD)/$(TARGET)/%.o: %.c
2018-05-01 06:15:48 +01:00
$(CC) $(CFLAGS) -c $< -o $@
2018-08-13 09:58:24 +01:00
$(BUILD)/$(TARGET)/%.o: %.S
2018-05-11 03:28:53 +01:00
@mkdir -p "$(BUILD)"
2018-08-13 09:58:24 +01:00
@mkdir -p "$(BUILD)/$(TARGET)"
2018-08-07 15:53:58 +01:00
@mkdir -p "$(OUTPUT)"
2018-05-01 06:15:48 +01:00
$(CC) $(CFLAGS) -c $< -o $@