homebrewfilter/nand-loader/Makefile.loader
2016-08-14 19:14:42 +02:00

55 lines
1.2 KiB
Makefile

ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
include $(DEVKITPPC)/wii_rules
PREFIX = powerpc-eabi-
AR = $(PREFIX)ar
AS = $(PREFIX)as
CC = $(PREFIX)gcc
CXX = $(PREFIX)g++
LD = $(PREFIX)ld
OBJCOPY = $(PREFIX)objcopy
RANLIB = $(PREFIX)ranlib
STRIP = $(PREFIX)strip
MACHDEP = -mcpu=750 -mno-eabi -mhard-float
CFLAGS = $(MACHDEP) -O1 -Werror -Wall -pipe -ffunction-sections -finline-functions-called-once -mno-sdata
LDFLAGS = $(MACHDEP) -n -nostartfiles -nostdlib -Wl,-T,openstub.ld -L.
ASFLAGS = -D_LANGUAGE_ASSEMBLY -DHW_RVL
TARGET_LINKED = boot.elf
TARGET = loader.bin
CFILES = ios.c utils.c cache.c main.c
OBJS = app_booter.o crt0.o memory.o ios.o utils.o cache.o main.o
DEPDIR = .deps
all: $(TARGET)
%.o: %.s
@echo " ASSEMBLE $<"
@$(CC) $(CFLAGS) $(DEFINES) $(ASFLAGS) -c $< -o $@
%.o: %.S
@echo " ASSEMBLE $<"
@$(CC) $(CFLAGS) $(DEFINES) $(ASFLAGS) -c $< -o $@
%.o: %.c
@echo " COMPILE $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $< -o $@
$(TARGET_LINKED): $(OBJS)
@echo " LINK $@"
@$(CC) -g -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
$(TARGET): $(TARGET_LINKED)
@echo " OBJCOPY $@"
@$(OBJCOPY) -O binary $< $@
clean:
rm -rf $(TARGET_LINKED) $(TARGET) $(OBJS) $(DEPDIR)