EE_BIN = ORI_BOOT.ELF
EE_OBJS = main.o pad.o config.o elf.o draw.o loader.o  filer.o cd.o\
	poweroff.o iomanx.o filexio.o ps2atad.o ps2dev9.o smsutils.o ps2ip.o ps2smap.o ps2hdd.o\
	ps2fs.o ps2netfs.o usbd.o usbhdfsd.o cdvd.o ps2ftpd.o ps2host.o vmcfs.o fakehost.o  \
	ps2kbd.o hdd.o hdl_rpc.o hdl_info.o editor.o timer.o jpgviewer.o icon.o lang.o\
	font_uLE.o makeicon.o chkesr_rpc.o chkesr.o

EE_INCS := -I$(PS2DEV)/gsKit/include -I$(PS2DEV)/libjpg/include\
	-I$(PS2SDK)/sbv/include -I$(PS2DEV)/libcdvd/ee

EE_LDFLAGS := -L$(PS2DEV)/gsKit/lib -L$(PS2DEV)/libjpg\
	-L$(PS2SDK)/sbv/lib -L$(PS2DEV)/libcdvd/lib -s
EE_LIBS = -lpad -lgskit -ldmakit -ljpg -lmc -lhdd -lcdvdfs -lkbd -lmf -lc  -lfileXio -lpatches -lpoweroff  -ldebug -lc

EE_OUTPUT=BOOT.ELF

all:	$(EE_BIN)

all: $(EE_OUTPUT)
$(EE_OUTPUT) : $(EE_BIN)
		$(PS2PACKER)/ps2-packer $(EE_BIN) $(EE_OUTPUT)
		rm -f $(EE_BIN)

run: all
	ps2client -h 192.168.0.10 -t 1 execee host:BOOT.ELF
reset: clean
	ps2client -h 192.168.0.10 reset

usbd.s:
	bin2s $(PS2SDK)/iop/irx/usbd.irx usbd.s usbd_irx

usbhdfsd.s:
	bin2s $(PS2DEV)/usbhdfsd/bin/usbhdfsd.irx usbhdfsd.s usb_mass_irx

cdvd.s:
	bin2s $(PS2DEV)/libcdvd/lib/cdvd.irx cdvd.s cdvd_irx

poweroff.s:
	bin2s $(PS2SDK)/iop/irx/poweroff.irx poweroff.s poweroff_irx

iomanx.s:
	bin2s $(PS2SDK)/iop/irx/iomanX.irx iomanx.s iomanx_irx

filexio.s:
	bin2s $(PS2SDK)/iop/irx/fileXio.irx filexio.s filexio_irx

ps2dev9.s:
	bin2s $(PS2SDK)/iop/irx/ps2dev9.irx ps2dev9.s ps2dev9_irx

ps2ip.s:
	bin2s $(PS2DEV)/SMS/drv/SMSTCPIP/bin/SMSTCPIP.irx ps2ip.s ps2ip_irx

ps2smap.s:
	bin2s $(PS2DEV)/SMS/drv/SMSMAP/SMSMAP.irx ps2smap.s ps2smap_irx

smsutils.s:
	bin2s $(PS2DEV)/SMS/drv/SMSUTILS/SMSUTILS.irx smsutils.s smsutils_irx

ps2ftpd.s:
	bin2s $(PS2DEV)/ps2ftpd/bin/ps2ftpd.irx ps2ftpd.s ps2ftpd_irx

ps2atad.s:
	bin2s $(PS2SDK)/iop/irx/ps2atad.irx ps2atad.s ps2atad_irx

ps2hdd.s:
	bin2s $(PS2SDK)/iop/irx/ps2hdd.irx ps2hdd.s ps2hdd_irx

ps2fs.s:
	bin2s $(PS2SDK)/iop/irx/ps2fs.irx ps2fs.s ps2fs_irx

ps2netfs.s:
	bin2s $(PS2SDK)/iop/irx/ps2netfs.irx ps2netfs.s ps2netfs_irx

fakehost.s:
	bin2s $(PS2SDK)/iop/irx/fakehost.irx fakehost.s fakehost_irx

hdl_info.s:
	$(MAKE) -C hdl_info
	bin2s hdl_info/hdl_info.irx hdl_info.s hdl_info_irx

ps2host.s:
	$(MAKE) -C ps2host
	bin2s ps2host/ps2host.irx ps2host.s ps2host_irx

vmcfs.s:
	$(MAKE) -C vmcfs
	bin2s vmcfs/bin/vmcfs.irx vmcfs.s vmcfs_irx

loader.s:
	$(MAKE) -C loader
	bin2s loader/loader.elf loader.s loader_elf

ps2kbd.s:
	bin2s $(PS2SDK)/iop/irx/ps2kbd.irx ps2kbd.s ps2kbd_irx

chkesr.s:
	$(MAKE) -C chkesr
	bin2s chkesr/chkesr.irx chkesr.s chkesr_irx

clean:
	$(MAKE) -C hdl_info clean
	$(MAKE) -C ps2host clean
	$(MAKE) -C loader clean
	$(MAKE) -C vmcfs clean
	$(MAKE) -C chkesr clean
	rm -f *.o *.a *.s *BOOT.ELF

include $(PS2SDK)/samples/Makefile.pref
include $(PS2SDK)/samples/Makefile.eeglobal
