mgh: fix for default HDD DMA mode, that wasn't correctly set
[open-ps2-loader.git] / Makefile
blob9faab0041eb7ec48645423824309fb63d0b3c0a6
1 .SILENT:
3 DEBUG = 0
4 EESIO_DEBUG = 0
5 #comment following line to build without vmc
6 VMC = 1
7 CHILDPROOF = 0
8 RTL = 0
10 FT_DIR = thirdparty/freetype-2.3.12
11 FT_LIBDIR = $(FT_DIR)/objs
13 FRONTEND_OBJS = obj/pad.o obj/fntsys.o obj/renderman.o obj/menusys.o obj/system.o obj/debug.o obj/lang.o obj/config.o obj/hdd.o obj/dialogs.o \
14 obj/dia.o obj/ioman.o obj/texcache.o obj/themes.o obj/supportbase.o obj/usbsupport.o obj/ethsupport.o obj/hddsupport.o \
15 obj/appsupport.o obj/gui.o obj/textures.o obj/opl.o obj/atlas.o
17 GFX_OBJS = obj/usb_icon.o obj/hdd_icon.o obj/eth_icon.o obj/app_icon.o \
18 obj/cross_icon.o obj/triangle_icon.o obj/circle_icon.o obj/square_icon.o obj/select_icon.o obj/start_icon.o \
19 obj/left_icon.o obj/right_icon.o obj/up_icon.o obj/down_icon.o obj/L1_icon.o obj/L2_icon.o obj/R1_icon.o obj/R2_icon.o \
20 obj/load0.o obj/load1.o obj/load2.o obj/load3.o obj/load4.o obj/load5.o obj/load6.o obj/load7.o obj/logo.o obj/freesans.o \
21 obj/icon_sys.o obj/icon_icn.o
23 EECORE_OBJS = obj/ee_core.o \
24 obj/alt_ee_core.o obj/elfldr.o obj/kpatch_10K.o obj/imgdrv.o obj/eesync.o \
25 obj/usb_cdvdman.o obj/usb_4Ksectors_cdvdman.o obj/smb_cdvdman.o obj/smb_pcmcia_cdvdman.o \
26 obj/hdd_cdvdman.o obj/hdd_pcmcia_cdvdman.o obj/hdd_hdpro_cdvdman.o \
27 obj/cdvdfsv.o obj/usbd_ps2.o obj/usbd_ps3.o obj/usbhdfsd.o obj/cddev.o \
28 obj/ps2dev9.o obj/smsutils.o obj/smstcpip.o obj/ingame_smstcpip.o obj/smsmap.o obj/smbman.o obj/discid.o \
29 obj/ps2atad.o obj/hdpro_atad.o obj/poweroff.o obj/ps2hdd.o obj/genvmc.o obj/hdldsvr.o \
30 obj/udptty.o obj/iomanx.o obj/filexio.o obj/ps2fs.o obj/util.o obj/ioptrap.o obj/ps2link.o
32 ifeq ($(VMC),1)
33 EECORE_OBJS += obj/usb_mcemu.o obj/hdd_mcemu.o obj/smb_mcemu.o
34 endif
36 EE_BIN = opl.elf
37 EE_SRC_DIR = src/
38 EE_OBJS_DIR = obj/
39 EE_ASM_DIR = asm/
40 EE_OBJS = $(FRONTEND_OBJS) $(GFX_OBJS) $(EECORE_OBJS)
42 EE_LIBS = -L$(FT_LIBDIR) -L$(PS2SDK)/ports/lib -L$(GSKIT)/lib -lgskit -ldmakit -lgskit_toolkit -lpoweroff -lfileXio -lpatches -lpad -ljpeg -lpng -lz -ldebug -lm -lmc -lfreetype -lvux -lcdvd
43 #EE_LIBS = -L$(FT_LIBDIR) -L$(PS2SDK)/ports/lib -L$(GSKIT)/lib -lgskit -ldmakit -lgskit_toolkit -ldebug -lpoweroff -lfileXio -lpatches -lpad -lm -lmc -lfreetype
44 EE_INCS += -I$(PS2SDK)/ports/include -I$(GSKIT)/include -I$(GSKIT)/ee/dma/include -I$(GSKIT)/ee/gs/include -I$(GSKIT)/ee/toolkit/include -I$(FT_DIR)/include
46 ifeq ($(DEBUG),1)
47 EE_CFLAGS := -D__DEBUG -g
48 ifeq ($(EESIO_DEBUG),1)
49 EE_CFLAGS += -D__EESIO_DEBUG
50 endif
51 else
52 EE_CFLAGS := -O2
53 endif
55 ifeq ($(RTL),1)
56 EE_CFLAGS += -D__RTL
57 endif
59 ifeq ($(CHILDPROOF),1)
60 EE_CFLAGS += -D__CHILDPROOF
61 endif
63 ifeq ($(VMC),1)
64 EE_CFLAGS += -DVMC
65 VMC_FLAGS = VMC=1
66 else
67 VMC_FLAGS = VMC=0
68 endif
70 SMSTCPIP_INGAME_CFLAGS = INGAME_DRIVER=1
71 ifeq ($(DEBUG),1)
72 MOD_DEBUG_FLAGS = DEBUG=1
73 endif
74 ifeq ($(EESIO_DEBUG),1)
75 EECORE_DEBUG_FLAGS = EESIO_DEBUG=1
76 endif
77 ifeq ($(INGAME_DEBUG),1)
78 EECORE_DEBUG_FLAGS = LOAD_DEBUG_MODULES=1
79 CDVDMAN_DEBUG_FLAGS = USE_DEV9=1
80 SMSTCPIP_INGAME_CFLAGS =
81 else
82 ifeq ($(IOPCORE_DEBUG),1)
83 EECORE_DEBUG_FLAGS = LOAD_DEBUG_MODULES=1
84 CDVDMAN_DEBUG_FLAGS = IOPCORE_DEBUG=1
85 MCEMU_DEBUG_FLAGS = IOPCORE_DEBUG=1
86 SMSTCPIP_INGAME_CFLAGS =
87 endif
88 endif
91 all:
92 @mkdir -p obj
93 @mkdir -p asm
95 echo "Building Freetype..."
96 $(MAKE) -C $(FT_DIR) setup ps2 > /dev/null
97 $(MAKE) -C $(FT_DIR)
99 echo "Building Open PS2 Loader..."
100 echo " * Interface"
101 $(MAKE) $(EE_BIN)
103 ifeq ($(DEBUG),0)
104 echo "Stripping..."
105 ee-strip opl.elf
107 echo "Compressing..."
108 ps2-packer opl.elf OPNPS2LD.ELF > /dev/null
109 endif
111 childproof:
112 $(MAKE) CHILDPROOF=1 all
114 debug:
115 $(MAKE) DEBUG=1 all
117 ingame_debug:
118 $(MAKE) INGAME_DEBUG=1 DEBUG=1 all
120 eesio_debug:
121 $(MAKE) EESIO_DEBUG=1 DEBUG=1 all
123 iopcore_debug:
124 $(MAKE) IOPCORE_DEBUG=1 DEBUG=1 all
126 clean: sclean
127 echo " * Freetype..."
128 $(MAKE) -C $(FT_DIR) distclean
130 sclean:
131 echo "Cleaning..."
132 echo " * Interface"
133 rm -f $(EE_BIN) OPNPS2LD.ELF asm/*.* obj/*.*
134 echo " * EE core"
135 $(MAKE) -C ee_core clean
136 echo " * Elf Loader"
137 $(MAKE) -C elfldr clean
138 echo " * 10K kernel patches"
139 $(MAKE) -C kpatch_10K clean
140 echo " * imgdrv.irx"
141 $(MAKE) -C modules/iopcore/imgdrv clean
142 echo " * eesync.irx"
143 $(MAKE) -C modules/iopcore/eesync clean
144 echo " * cdvdman.irx"
145 $(MAKE) -C modules/iopcore/cdvdman -f Makefile.usb clean
146 $(MAKE) -C modules/iopcore/cdvdman -f Makefile.usb.4Ksectors clean
147 $(MAKE) -C modules/iopcore/cdvdman -f Makefile.smb clean
148 $(MAKE) -C modules/iopcore/cdvdman -f Makefile.smb.pcmcia clean
149 $(MAKE) -C modules/iopcore/cdvdman -f Makefile.hdd clean
150 $(MAKE) -C modules/iopcore/cdvdman -f Makefile.hdd.pcmcia clean
151 $(MAKE) -C modules/iopcore/cdvdman -f Makefile.hdd.hdpro clean
152 echo " * cdvdfsv.irx"
153 $(MAKE) -C modules/iopcore/cdvdfsv clean
154 echo " * cddev.irx"
155 $(MAKE) -C modules/iopcore/cddev clean
156 echo " * usbhdfsd.irx"
157 $(MAKE) -C modules/usb/usbhdfsd clean
158 echo " * ps2dev9.irx"
159 $(MAKE) -C modules/dev9 clean
160 echo " * SMSUTILS.irx"
161 $(MAKE) -C modules/network/SMSUTILS clean
162 echo " * SMSTCPIP.irx"
163 $(MAKE) -C modules/network/SMSTCPIP clean
164 echo " * SMSMAP.irx"
165 $(MAKE) -C modules/network/SMSMAP clean
166 echo " * discID.irx"
167 $(MAKE) -C modules/cdvd/discID clean
168 echo " * ps2atad.irx"
169 $(MAKE) -C modules/hdd/atad clean
170 echo " * hdpro_atad.irx"
171 $(MAKE) -C modules/hdd/hdpro_atad clean
172 echo " * ps2hdd.irx"
173 $(MAKE) -C modules/hdd/ps2hdd clean
174 ifeq ($(VMC),1)
175 echo " * ps2fs.irx"
176 $(MAKE) -C modules/ps2fs clean
177 echo " * mcemu.irx"
178 $(MAKE) -C modules/mcemu -f Makefile.usb clean
179 $(MAKE) -C modules/mcemu -f Makefile.hdd clean
180 $(MAKE) -C modules/mcemu -f Makefile.smb clean
181 endif
182 echo " * genvmc.irx"
183 $(MAKE) -C modules/vmc/genvmc clean
184 echo " * hdldsvr.irx"
185 $(MAKE) -C modules/hdd/hdldsvr clean
186 echo " * udptty.irx"
187 $(MAKE) -C modules/debug/udptty clean
188 echo " * ioptrap.irx"
189 $(MAKE) -C modules/debug/ioptrap clean
190 echo " * ps2link.irx"
191 $(MAKE) -C modules/debug/ps2link clean
192 echo " * pc tools"
193 $(MAKE) -C pc clean
195 rebuild: clean all
197 pc_tools:
198 echo "Building iso2opl, opl2iso and genvmc..."
199 $(MAKE) _WIN32=0 -C pc
201 pc_tools_win32:
202 echo "Building WIN32 iso2opl, opl2iso and genvmc..."
203 $(MAKE) _WIN32=1 -C pc
205 ee_core.s:
206 echo " * EE core"
207 $(MAKE) -C ee_core clean
208 $(MAKE) $(VMC_FLAGS) $(EECORE_DEBUG_FLAGS) -C ee_core
209 bin2s ee_core/ee_core.elf asm/ee_core.s eecore_elf
211 alt_ee_core.s:
212 echo " * alternative EE core"
213 $(MAKE) -C ee_core clean
214 $(MAKE) $(VMC_FLAGS) $(EECORE_DEBUG_FLAGS) -C ee_core -f Makefile.alt
215 bin2s ee_core/ee_core.elf asm/alt_ee_core.s alt_eecore_elf
217 elfldr.s:
218 echo " * Elf Loader"
219 $(MAKE) -C elfldr clean
220 $(MAKE) -C elfldr
221 bin2s elfldr/elfldr.elf asm/elfldr.s elfldr_elf
223 kpatch_10K.s:
224 echo " * 10K kernel patches"
225 $(MAKE) -C kpatch_10K
226 bin2s kpatch_10K/kpatch.elf asm/kpatch_10K.s kpatch_10K_elf
228 imgdrv.s:
229 echo " * imgdrv.irx"
230 $(MAKE) -C modules/iopcore/imgdrv
231 bin2s modules/iopcore/imgdrv/imgdrv.irx asm/imgdrv.s imgdrv_irx
233 eesync.s:
234 echo " * eesync.irx"
235 $(MAKE) -C modules/iopcore/eesync
236 bin2s modules/iopcore/eesync/eesync.irx asm/eesync.s eesync_irx
238 usb_cdvdman.s:
239 echo " * usb_cdvdman.irx"
240 $(MAKE) $(VMC_FLAGS) $(CDVDMAN_DEBUG_FLAGS) -C modules/iopcore/cdvdman -f Makefile.usb rebuild
241 bin2s modules/iopcore/cdvdman/cdvdman.irx asm/usb_cdvdman.s usb_cdvdman_irx
243 usb_4Ksectors_cdvdman.s:
244 echo " * usb_4Ksectors_cdvdman.irx"
245 $(MAKE) $(VMC_FLAGS) $(CDVDMAN_DEBUG_FLAGS) -C modules/iopcore/cdvdman -f Makefile.usb.4Ksectors rebuild
246 bin2s modules/iopcore/cdvdman/cdvdman.irx asm/usb_4Ksectors_cdvdman.s usb_4Ksectors_cdvdman_irx
248 smb_cdvdman.s:
249 echo " * smb_cdvdman.irx"
250 $(MAKE) $(VMC_FLAGS) $(CDVDMAN_DEBUG_FLAGS) -C modules/iopcore/cdvdman -f Makefile.smb rebuild
251 bin2s modules/iopcore/cdvdman/cdvdman.irx asm/smb_cdvdman.s smb_cdvdman_irx
253 smb_pcmcia_cdvdman.s:
254 echo " * smb_pcmcia_cdvdman.irx"
255 $(MAKE) $(VMC_FLAGS) $(CDVDMAN_DEBUG_FLAGS) -C modules/iopcore/cdvdman -f Makefile.smb.pcmcia rebuild
256 bin2s modules/iopcore/cdvdman/cdvdman.irx asm/smb_pcmcia_cdvdman.s smb_pcmcia_cdvdman_irx
258 hdd_cdvdman.s:
259 echo " * hdd_cdvdman.irx"
260 $(MAKE) $(VMC_FLAGS) $(CDVDMAN_DEBUG_FLAGS) -C modules/iopcore/cdvdman -f Makefile.hdd rebuild
261 bin2s modules/iopcore/cdvdman/cdvdman.irx asm/hdd_cdvdman.s hdd_cdvdman_irx
263 hdd_pcmcia_cdvdman.s:
264 echo " * hdd_pcmcia_cdvdman.irx"
265 $(MAKE) $(VMC_FLAGS) $(CDVDMAN_DEBUG_FLAGS) -C modules/iopcore/cdvdman -f Makefile.hdd.pcmcia rebuild
266 bin2s modules/iopcore/cdvdman/cdvdman.irx asm/hdd_pcmcia_cdvdman.s hdd_pcmcia_cdvdman_irx
268 hdd_hdpro_cdvdman.s:
269 echo " * hdd_hdpro_cdvdman.irx"
270 $(MAKE) $(VMC_FLAGS) $(CDVDMAN_DEBUG_FLAGS) -C modules/iopcore/cdvdman -f Makefile.hdd.hdpro rebuild
271 bin2s modules/iopcore/cdvdman/cdvdman.irx asm/hdd_hdpro_cdvdman.s hdd_hdpro_cdvdman_irx
273 cdvdfsv.s:
274 echo " * cdvdfsv.irx"
275 $(MAKE) -C modules/iopcore/cdvdfsv
276 bin2s modules/iopcore/cdvdfsv/cdvdfsv.irx asm/cdvdfsv.s cdvdfsv_irx
278 cddev.s:
279 echo " * cddev.irx"
280 $(MAKE) -C modules/iopcore/cddev
281 bin2s modules/iopcore/cddev/cddev.irx asm/cddev.s cddev_irx
283 usb_mcemu.s:
284 echo " * usb_mcemu.irx"
285 $(MAKE) $(MCEMU_DEBUG_FLAGS) -C modules/mcemu -f Makefile.usb rebuild
286 bin2s modules/mcemu/mcemu.irx asm/usb_mcemu.s usb_mcemu_irx
288 hdd_mcemu.s:
289 echo " * hdd_mcemu.irx"
290 $(MAKE) $(MCEMU_DEBUG_FLAGS) -C modules/mcemu -f Makefile.hdd rebuild
291 bin2s modules/mcemu/mcemu.irx asm/hdd_mcemu.s hdd_mcemu_irx
293 smb_mcemu.s:
294 echo " * smb_mcemu.irx"
295 $(MAKE) $(MCEMU_DEBUG_FLAGS) -C modules/mcemu -f Makefile.smb rebuild
296 bin2s modules/mcemu/mcemu.irx asm/smb_mcemu.s smb_mcemu_irx
298 usbd_ps2.s:
299 bin2s $(PS2SDK)/iop/irx/usbd.irx asm/usbd_ps2.s usbd_ps2_irx
301 usbd_ps3.s:
302 bin2s modules/usb/usbd/usbd.irx asm/usbd_ps3.s usbd_ps3_irx
304 usbhdfsd.s:
305 echo " * usbhdfsd.irx"
306 $(MAKE) -C modules/usb/usbhdfsd
307 bin2s modules/usb/usbhdfsd/usbhdfsd.irx asm/usbhdfsd.s usbhdfsd_irx
309 ps2dev9.s:
310 echo " * ps2dev9.irx"
311 $(MAKE) -C modules/dev9
312 bin2s modules/dev9/ps2dev9.irx asm/ps2dev9.s ps2dev9_irx
314 smsutils.s:
315 echo " * SMSUTILS.irx"
316 $(MAKE) -C modules/network/SMSUTILS
317 bin2s modules/network/SMSUTILS/SMSUTILS.irx asm/smsutils.s smsutils_irx
319 smstcpip.s:
320 echo " * SMSTCPIP.irx"
321 $(MAKE) -C modules/network/SMSTCPIP -f Makefile rebuild
322 bin2s modules/network/SMSTCPIP/SMSTCPIP.irx asm/smstcpip.s smstcpip_irx
324 ingame_smstcpip.s:
325 echo " * in-game SMSTCPIP.irx"
326 $(MAKE) $(SMSTCPIP_INGAME_CFLAGS) -C modules/network/SMSTCPIP rebuild
327 bin2s modules/network/SMSTCPIP/SMSTCPIP.irx asm/ingame_smstcpip.s ingame_smstcpip_irx
329 smsmap.s:
330 echo " * SMSMAP.irx"
331 $(MAKE) -C modules/network/SMSMAP
332 bin2s modules/network/SMSMAP/SMSMAP.irx asm/smsmap.s smsmap_irx
334 smbman.s:
335 bin2s $(PS2SDK)/iop/irx/smbman.irx asm/smbman.s smbman_irx
337 discid.s:
338 echo " * discID.irx"
339 $(MAKE) -C modules/cdvd/discID
340 bin2s modules/cdvd/discID/discID.irx asm/discid.s discid_irx
342 ps2atad.s:
343 echo " * ps2atad.irx"
344 $(MAKE) -C modules/hdd/atad
345 bin2s modules/hdd/atad/ps2atad.irx asm/ps2atad.s ps2atad_irx
347 hdpro_atad.s:
348 echo " * hdpro_atad.irx"
349 $(MAKE) -C modules/hdd/hdpro_atad
350 bin2s modules/hdd/hdpro_atad/hdpro_atad.irx asm/hdpro_atad.s hdpro_atad_irx
352 poweroff.s:
353 bin2s $(PS2SDK)/iop/irx/poweroff.irx asm/poweroff.s poweroff_irx
355 ps2hdd.s:
356 echo " * ps2hdd.irx"
357 $(MAKE) -C modules/hdd/ps2hdd
358 bin2s modules/hdd/ps2hdd/ps2hdd.irx asm/ps2hdd.s ps2hdd_irx
360 genvmc.s:
361 echo " * genvmc.irx"
362 $(MAKE) $(MOD_DEBUG_FLAGS) -C modules/vmc/genvmc
363 bin2s modules/vmc/genvmc/genvmc.irx asm/genvmc.s genvmc_irx
365 hdldsvr.s:
366 echo " * hdldsvr.irx"
367 $(MAKE) -C modules/hdd/hdldsvr
368 bin2s modules/hdd/hdldsvr/hdldsvr.irx asm/hdldsvr.s hdldsvr_irx
370 udptty.s:
371 echo " * udptty.irx"
372 $(MAKE) -C modules/debug/udptty
373 bin2s modules/debug/udptty/udptty.irx asm/udptty.s udptty_irx
375 ioptrap.s:
376 echo " * ioptrap.irx"
377 $(MAKE) -C modules/debug/ioptrap
378 bin2s modules/debug/ioptrap/ioptrap.irx asm/ioptrap.s ioptrap_irx
380 ps2link.s:
381 echo " * ps2link.irx"
382 $(MAKE) -C modules/debug/ps2link
383 bin2s modules/debug/ps2link/ps2link.irx asm/ps2link.s ps2link_irx
385 ps2fs.s:
386 echo " * ps2fs.irx"
387 $(MAKE) -C modules/ps2fs
388 bin2s modules/ps2fs/ps2fs.irx asm/ps2fs.s ps2fs_irx
390 iomanx.s:
391 bin2s $(PS2SDK)/iop/irx/iomanX.irx asm/iomanx.s iomanx_irx
393 filexio.s:
394 bin2s $(PS2SDK)/iop/irx/fileXio.irx asm/filexio.s filexio_irx
396 load0.s:
397 bin2s gfx/load0.png asm/load0.s load0_png
399 load1.s:
400 bin2s gfx/load1.png asm/load1.s load1_png
402 load2.s:
403 bin2s gfx/load2.png asm/load2.s load2_png
405 load3.s:
406 bin2s gfx/load3.png asm/load3.s load3_png
408 load4.s:
409 bin2s gfx/load4.png asm/load4.s load4_png
411 load5.s:
412 bin2s gfx/load5.png asm/load5.s load5_png
414 load6.s:
415 bin2s gfx/load6.png asm/load6.s load6_png
417 load7.s:
418 bin2s gfx/load7.png asm/load7.s load7_png
420 logo.s:
421 bin2s gfx/logo.png asm/logo.s logo_png
423 usb_icon.s:
424 bin2s gfx/usb.png asm/usb_icon.s usb_png
426 hdd_icon.s:
427 bin2s gfx/hdd.png asm/hdd_icon.s hdd_png
429 eth_icon.s:
430 bin2s gfx/eth.png asm/eth_icon.s eth_png
432 app_icon.s:
433 bin2s gfx/app.png asm/app_icon.s app_png
435 cross_icon.s:
436 bin2s gfx/cross.png asm/cross_icon.s cross_png
438 triangle_icon.s:
439 bin2s gfx/triangle.png asm/triangle_icon.s triangle_png
441 circle_icon.s:
442 bin2s gfx/circle.png asm/circle_icon.s circle_png
444 square_icon.s:
445 bin2s gfx/square.png asm/square_icon.s square_png
447 select_icon.s:
448 bin2s gfx/select.png asm/select_icon.s select_png
450 start_icon.s:
451 bin2s gfx/start.png asm/start_icon.s start_png
453 left_icon.s:
454 bin2s gfx/left.png asm/left_icon.s left_png
456 right_icon.s:
457 bin2s gfx/right.png asm/right_icon.s right_png
459 up_icon.s:
460 bin2s gfx/up.png asm/up_icon.s up_png
462 down_icon.s:
463 bin2s gfx/down.png asm/down_icon.s down_png
465 L1_icon.s:
466 bin2s gfx/L1.png asm/L1_icon.s L1_png
468 L2_icon.s:
469 bin2s gfx/L2.png asm/L2_icon.s L2_png
471 R1_icon.s:
472 bin2s gfx/R1.png asm/R1_icon.s R1_png
474 R2_icon.s:
475 bin2s gfx/R2.png asm/R2_icon.s R2_png
477 freesans.s:
478 bin2s thirdparty/FreeSans_basic_latin.ttf asm/freesans.s freesansfont_raw
480 icon_sys.s:
481 bin2s gfx/icon.sys asm/icon_sys.s icon_sys
483 icon_icn.s:
484 bin2s gfx/opl.icn asm/icon_icn.s icon_icn
486 $(EE_OBJS_DIR)%.o : $(EE_SRC_DIR)%.c
487 $(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@
489 $(EE_OBJS_DIR)%.o : %.s
490 $(EE_AS) $(EE_ASFLAGS) $(EE_ASM_DIR)$< -o $@
493 include $(PS2SDK)/samples/Makefile.pref
494 include $(PS2SDK)/samples/Makefile.eeglobal