-
-
Notifications
You must be signed in to change notification settings - Fork 93
/
Makefile
147 lines (136 loc) · 6.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
DIR = $(DEVKITPPC)/bin
BIN2S = $(DIR)/bin2s
CC = $(DIR)/powerpc-eabi-gcc
LD = $(DIR)/powerpc-eabi-ld
OBJDUMP = $(DIR)/powerpc-eabi-objdump
OBJCOPY = $(DIR)/powerpc-eabi-objcopy
DEST = ../swiss/source/patches
DISASM = disassembly
all: dvdpatch hddpatch sdpatch usbpatch wkfpatch
dvdpatch: clean build-dvd
hddpatch: clean build-ideexi-v1 clean build-ideexi-v2
sdpatch: clean build-sd
usbpatch: clean build-usb
wkfpatch: clean build-wkf
clean:
@rm -rf *.o
@rm -rf $(DISASM)/*
@-rmdir $(DISASM)
@mkdir $(DISASM)
build-sd:
@echo Building SD Patch ...
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/base.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c sdgecko/sd.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/frag.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/igr.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/usbgecko.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/dvdqueue.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/dvdinterface.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/adp.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/Stream.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/__DSPHandler.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/appldr_start.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/appldr.c
@$(LD) -o sd.elf base.o igr.o frag.o sd.o dvdinterface.o dvdqueue.o usbgecko.o adp.o Stream.o __DSPHandler.o appldr_start.o appldr.o --section-start .text=0x80001000 --gc-sections
@rm -rf *.o
@$(OBJDUMP) -D sd.elf > $(DISASM)/sd_disasm.txt
@$(OBJCOPY) -O binary sd.elf sd.bin
@$(BIN2S) sd.bin > sd_final.s
@mv -f sd_final.s $(DEST)/SlotAB-SD.s
@rm *.bin
@rm *.elf
build-ideexi-v1:
@echo Building IDE-EXI-v1 Patch ...
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/base.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c ide-exi/hddread.c -DIDE_EXI_V1
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/frag.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/igr.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/usbgecko.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/dvdqueue.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/dvdinterface.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/adp.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/Stream.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/__DSPHandler.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/appldr_start.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/appldr.c
@$(LD) -o ideexi_v1.elf base.o igr.o frag.o hddread.o dvdinterface.o dvdqueue.o usbgecko.o adp.o Stream.o __DSPHandler.o appldr_start.o appldr.o --section-start .text=0x80001000 -gc-sections
@rm -rf *.o
@$(OBJDUMP) -D ideexi_v1.elf > $(DISASM)/ideexi_v1_disasm.txt
@$(OBJCOPY) -O binary ideexi_v1.elf ideexi_v1.bin
@$(BIN2S) ideexi_v1.bin > ideexi_v1_final.s
@mv -f ideexi_v1_final.s $(DEST)/SlotAB-IDEEXI_V1.s
@rm *.bin
@rm *.elf
build-ideexi-v2:
@echo Building IDE-EXI-v2 Patch ...
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/base.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c ide-exi/hddread.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/frag.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/igr.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/usbgecko.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/dvdqueue.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/dvdinterface.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/adp.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/Stream.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/__DSPHandler.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/appldr_start.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/appldr.c
@$(LD) -o ideexi_v2.elf base.o igr.o frag.o hddread.o dvdinterface.o dvdqueue.o usbgecko.o adp.o Stream.o __DSPHandler.o appldr_start.o appldr.o --section-start .text=0x80001000 -gc-sections
@rm -rf *.o
@$(OBJDUMP) -D ideexi_v2.elf > $(DISASM)/ideexi_v2_disasm.txt
@$(OBJCOPY) -O binary ideexi_v2.elf ideexi_v2.bin
@$(BIN2S) ideexi_v2.bin > ideexi_v2_final.s
@mv -f ideexi_v2_final.s $(DEST)/SlotAB-IDEEXI_V2.s
@rm *.bin
@rm *.elf
build-dvd:
@echo Building DVD Patch ...
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c dvd/base.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c dvd/dvd.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c sdgecko/sd.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/frag.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/usbgecko.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/dvdqueue.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/igr.c
@$(LD) -o dvd.elf base.o igr.o frag.o sd.o dvd.o dvdqueue.o usbgecko.o --section-start .text=0x80001800
@rm -rf *.o
@$(OBJDUMP) -D dvd.elf > $(DISASM)/dvd_disasm.txt
@$(OBJCOPY) -O binary dvd.elf dvd.bin
@$(BIN2S) dvd.bin > dvd_final.s
@mv -f dvd_final.s $(DEST)/DVDPatch.s
@rm *.bin
@rm *.elf
build-usb:
@echo Building USBGecko Patch ...
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/base.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c usbgecko/usbgecko.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/dvdqueue.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/dvdinterface.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/adp.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/Stream.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/__DSPHandler.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/appldr_start.S
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/appldr.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/frag.c
@$(CC) -O1 -ffunction-sections -mmultiple -mstring -c base/igr.c
@$(LD) -o usbgecko.elf base.o igr.o usbgecko.o dvdqueue.o dvdinterface.o adp.o Stream.o __DSPHandler.o appldr_start.o appldr.o frag.o --section-start .text=0x80001000 --gc-sections
@rm -rf *.o
@$(OBJDUMP) -D usbgecko.elf > $(DISASM)/usb_disasm.txt
@$(OBJCOPY) -O binary usbgecko.elf usbgecko.bin
@$(BIN2S) usbgecko.bin > usbgecko_final.s
@mv -f usbgecko_final.s $(DEST)/USBGeckoRead.s
@rm *.bin
@rm *.elf
build-wkf:
@echo Building WKF Patch ...
@$(CC) -O1 -c wkf/base.S
@$(CC) -O1 -c wkf/wkf.c
@$(CC) -O1 -c base/usbgecko.c
@$(LD) -o wkf.elf base.o wkf.o usbgecko.o --section-start .text=0x80001800
@rm -rf *.o
@$(OBJDUMP) -D wkf.elf > $(DISASM)/wkf_disasm.txt
@$(OBJCOPY) -O binary wkf.elf wkf.bin
@$(BIN2S) wkf.bin > wkf.s
@mv -f wkf.s $(DEST)/wkfPatch.s
@rm *.bin
@rm *.elf