1 # Copyright 2008-2009 Segher Boessenkool <segher@kernel.crashing.org>
2 # This code is licensed to you under the terms of the GNU GPL, version 2;
3 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
8 # What toolchain prefix should we use
11 # Where are the tools (http://git.infradead.org/users/segher/wii.git)
12 TOOLS ?= $(HOME)/wii/segher
14 # End of configuration.
18 # Set CC, LD, OBJCOPY based on CROSS, unless they are set already
20 ifeq ($(origin CC), default)
21 CC := $(CROSS)gcc -m32
23 ifeq ($(origin LD), default)
26 OBJCOPY ?= $(CROSS)objcopy
29 # The compiler flags we need.
31 CFLAGS := -Wall -W -Os -ffreestanding -mno-eabi -mno-sdata -mcpu=750
34 # Build with "V=1" to see the commands executed; be quiet otherwise.
40 MAKEFLAGS += --no-print-directory
44 targets := rlbp.bin rlbj.bin rlbe.bin
46 ppms := $(targets:%.bin=%-icon.ppm) rlb-banner.ppm
47 assets := title.bin $(ppms)
49 loader := ../loader/loader.bin
52 titleid = $(shell perl titleid.pl $(1))
56 D=$(call titleid,$(1)); \
57 $(TOOLS)/twintig $$D $@ toc-$1
63 $(targets): %.bin: toc-% FILE_V28 $(assets)
65 $(Q)$(call twintig,$*)
67 FILE_V28: head.bin exploit.bin $(loader)
70 $(Q)$(TOOLS)/lego-cksum $@
74 $(Q)$(OBJCOPY) -Obinary $< $@
76 exploit.bin: exploit.elf
78 $(Q)$(OBJCOPY) -Obinary $< $@
80 exploit.elf: lego.lds exploit.o
84 head.elf: head.lds head.o
90 $(Q)$(CC) $(CFLAGS) -c $< -o $@
94 $(Q)$(CC) $(CFLAGS) -c $< -o $@
96 title.bin: ../.version
98 $(Q)perl make-title-bin.pl > $@
101 $(Q)$(MAKE) -C .. .version
103 $(ppms): %.ppm: %.png
108 $(Q)$(MAKE) -C ../loader
113 -rm -f $(targets) FILE_V28
114 -rm -f exploit.bin exploit.elf exploit.o
115 -rm -f head.bin head.elf head.o