forked from ps2homebrew/wLaunchELF
-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
261 lines (221 loc) · 6.29 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#.SILENT:
# ---{ BUILD CONFIGURATION }--- #
MMCE ?= 0
DS34 ?= 0
SMB ?= 0
TMANIP ?= 1
ETH ?= 1
EXFAT ?= 0
DVRP ?= 0
IOP_RESET ?= 1
XFROM ?= 0
UDPTTY ?= 0
MX4SIO ?= 0
SIO2MAN ?= 0
PPC_UART ?= 0
SIO_DEBUG ?= 0
DEBUG ?= 0
LCDVD ?= LEGACY#or LATEST
# ----------------------------- #
.SILENT:
BIN_NAME = $(HAS_EXFAT)$(HAS_DS34)$(HAS_ETH)$(HAS_MX4SIO)$(HAS_MMCE)$(HAS_SMB)$(HAS_DVRP)$(HAS_XFROM)$(HAS_EESIO)$(HAS_UDPTTY)$(HAS_PPCTTY)$(HAS_IOP_RESET)
ifeq ($(DEBUG), 0)
EE_BIN = UNC-BOOT$(BIN_NAME).ELF
EE_BIN_PKD = BOOT$(BIN_NAME).ELF
else
EE_BIN = UNC-BOOT.ELF
EE_BIN_PKD = BOOT.ELF
endif
EE_OBJS = main.o config.o elf.o draw.o loader_elf.o filer.o \
poweroff_irx.o iomanx_irx.o filexio_irx.o ps2atad_irx.o ps2dev9_irx.o \
ps2hdd_irx.o ps2fs_irx.o usbd_irx.o mcman_irx.o mcserv_irx.o \
cdvd_irx.o vmc_fs_irx.o ps2kbd_irx.o \
hdd.o hdl_rpc.o hdl_info_irx.o editor.o timer.o jpgviewer.o icon.o lang.o \
font_uLE.o makeicon.o chkesr.o allowdvdv_irx.o
EE_INCS := -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include -Iinclude
EE_LDFLAGS := -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ports/lib -Liop/oldlibs/libcdvd/lib -s
EE_LIBS = -lgskit -ldmakit -ljpeg -lmc -lhdd -lkbd -lmf \
-lcdvd -lc -lfileXio -lpatches -lpoweroff -ldebug
EE_CFLAGS := -mgpopt -G10240 -G0 -DNEWLIB_PORT_AWARE -D_EE
BIN2S = @bin2s
ifeq ($(SMB),1)
EE_OBJS += smbman.o
HAS_SMB = -SMB
EE_CFLAGS += -DSMB
endif
ifeq ($(LCDVD),LEGACY)
$(info -- Building with legacy libcdvd)
EE_CFLAGS += -DLIBCDVD_LEGACY
CDVD_SOURCE = iop/cdvd.irx
EE_INCS += -Iiop/oldlibs/libcdvd/ee
EE_LIBS += -lcdvdfs
else
EE_CFLAGS += -DLIBCDVD_LATEST
CDVD_SOURCE = iop/__precompiled/cdfs.irx
endif
ifeq ($(XFROM),1)
HAS_XFROM = -XFROM
EE_CFLAGS += -DXFROM
endif
ifeq ($(DS34),1)
EE_OBJS += ds34usb.o libds34usb.a ds34bt.o libds34bt.a pad_ds34.o
HAS_DS34 = -DS34
EE_CFLAGS += -DDS34
else
EE_OBJS += pad.o
endif
ifeq ($(DVRP),1)
EE_OBJS += dvrdrv_irx.o dvrfile_irx.o
EE_CFLAGS += -DDVRP
HAS_DVRP = -DVRP
endif
ifeq ($(MMCE),1)
EE_OBJS += mmceman_irx.o
EE_CFLAGS += -DMMCE
HAS_MMCE = -MMCE
SIO2MAN = 1
endif
ifeq ($(MX4SIO),1)
ifneq ($(EXFAT),1)
$(error MX4SIO Requested on build without BDM)
else
EE_OBJS += mx4sio_bd.o
EE_CFLAGS += -DMX4SIO
HAS_MX4SIO = -MX4SIO
SIO2MAN = 1
endif
endif
ifeq ($(SIO2MAN),1)
EE_OBJS += sio2man.o padman.o
EE_CFLAGS += -DHOMEBREW_SIO2MAN
EE_LIBS += -lpadx
else
EE_LIBS += -lpad
endif
ifeq ($(SIO_DEBUG),1)
EE_CFLAGS += -DSIO_DEBUG
HAS_EESIO = -SIO_DEBUG
endif
ifeq ($(PPC_UART),1)
EE_CFLAGS += -DPOWERPC_UART
HAS_PPCTTY = -PPCTTY
EE_OBJS += ppctty.o
ifeq ($(UDPTTY),1)
$(error Both PPCTTY and UDPTTY enabled simultaneously)
endif
endif
ifeq ($(IOP_RESET),0)
EE_CFLAGS += -DNO_IOP_RESET
HAS_IOP_RESET = -NO_IOP_RESET
endif
ifeq ($(ETH),1)
EE_OBJS += ps2smap_irx.o ps2ftpd_irx.o ps2host_irx.o ps2netfs_irx.o ps2ip_irx.o
EE_CFLAGS += -DETH
else
HAS_ETH = -NO_NETWORK
endif
ifeq ($(UDPTTY),1)
ifneq ($(ETH),1)
$(error UDPTTY requested on build without network modules)
else
EE_OBJS += udptty.o
HAS_UDPTTY = -UDPTTY
EE_CFLAGS += -DUDPTTY -DCOMMON_PRINTF
endif
endif
ifeq ($(TMANIP),1)
EE_CFLAGS += -DTMANIP
endif
ifeq ($(TMANIP),2)
EE_CFLAGS += -DTMANIP
EE_CFLAGS += -DTMANIP_MORON
endif
ifeq ($(EXFAT),1)
EE_OBJS += bdm_irx.o bdmfs_fatfs_irx.o usbmass_bd_irx.o
EE_CFLAGS += -DEXFAT
HAS_EXFAT = -EXFAT
else
EE_OBJS += usbhdfsd_irx.o
endif
ifeq ($(DEFAULT_COLORS),1)
@echo using default colors
else
EE_CFLAGS += -DCUSTOM_COLORS
endif
ifeq ($(IOPTRAP),1)
EE_OBJS += ioptrap_irx.o
EE_CFLAGS += -DIOPTRAP
endif
EE_OBJS_DIR = obj/
EE_ASM_DIR = asm/
EE_SRC_DIR = src/
EE_OBJS := $(EE_OBJS:%=$(EE_OBJS_DIR)%) # remap all EE_OBJ to obj subdir
all: githash.h $(EE_BIN_PKD)
info:
$(info available build options:)
$(info EXFAT enable BDM and EXFAT support for it)
$(info ETH include network features?)
$(info DS34 include PS3/PS4 controller support)
$(info MX4SIO support for SDCard connected to memory card slot 2)
$(info MMCE support for direct SDCard access on SD2PSX or memcardpro2)
$(info ----------)
$(info IOPTRAP load exception handler module to IOP)
$(info UDPTTY transfer stdout to UDP broadcast)
$(info PPC_UART transfer stdout to DECKARD UART)
$(info SIO_DEBUG transfer EE stdout to EE UART)
.PHONY: all run reset clean rebuild isoclean iso
$(EE_BIN_PKD): $(EE_BIN)
ps2-packer $< $@
ifeq ($(IOP_RESET),0)
@echo "-------------{COMPILATION PERFORMED WITHOUT IOP RESET}-------------"
endif
$(EE_OBJS_DIR):
mkdir $@
$(EE_ASM_DIR):
mkdir $@
run: all
ps2client -h 192.168.0.10 -t 1 execee host:$(EE_BIN)
reset: clean
ps2client -h 192.168.0.10 reset
githash.h:
printf '#ifndef ULE_VERDATE\n#define ULE_VERDATE "' > $@ && \
git show -s --format=%cd --date=local | tr -d "\n" >> $@ && \
printf '"\n#endif\n' >> $@
printf '#ifndef GIT_HASH\n#define GIT_HASH "' >> $@ && \
git rev-parse --short HEAD | tr -d "\n" >> $@ && \
printf '"\n#endif\n' >> $@
clean:
$(MAKE) -C loader clean
$(MAKE) -C iop/hdl_info clean
$(MAKE) -C iop/ps2host clean
$(MAKE) -C iop/vmc_fs clean
$(MAKE) -C iop/AllowDVDV clean
$(MAKE) -C iop/oldlibs/libcdvd clean
$(MAKE) -C iop/oldlibs/ps2ftpd clean
@rm -f githash.h $(EE_BIN) $(EE_BIN_PKD)
@rm -rf $(EE_OBJS_DIR)
@rm -rf $(EE_ASM_DIR)
@rm -f iop/*.irx
rebuild: clean all
info2:
$(info -------- wLaunchELF 4.43x_isr --------)
$(info EE_BIN = $(EE_BIN))
$(info EE_BIN_PKD = $(EE_BIN_PKD))
$(info EE_OBJS = $(EE_OBJS))
$(info TMANIP=$(TMANIP), SIO_DEBUG=$(SIO_DEBUG), DS34=$(DS34), ETH=$(ETH))
$(info EXFAT=$(EXFAT), XFROM=$(XFROM), UDPTTY=$(UDPTTY), MX4SIO=$(MX4SIO))
$(info MMCE=$(MMCE), IOP_RESET=$(IOP_RESET))
#special recipe for compiling and dumping obj to subfolder
$(EE_OBJS_DIR)%.o: $(EE_SRC_DIR)%.c | $(EE_OBJS_DIR)
@echo -e "\033[1m CC - $@\033[0m"
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
$(EE_OBJS_DIR)%.o: $(EE_ASM_DIR)%.s | $(EE_OBJS_DIR)
@echo -e "\033[1m ASM - $@\033[0m"
$(EE_AS) $(EE_ASFLAGS) $< -o $@
$(EE_OBJS_DIR)%.o: $(EE_SRC_DIR)%.cpp | $(EE_OBJS_DIR)
@echo -e "\033[1m CXX - $@\033[0m"
$(EE_CXX) $(EE_CXXFLAGS) $(EE_INCS) -c $< -o $@
#'\033[1m \033[0m'
include embed.make
include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal