
EE_PREFIX = ee-
EE_CC = $(EE_PREFIX)gcc
EE_OBJCOPY = $(EE_PREFIX)objcopy

EE_INCS = -I$(PS2SDK)/ee/include -I$(PS2SDK)/common/include -I$(PS2SDK)/sbv/include
EE_CFLAGS = -D_EE -O2 -G0 -Wall $(EE_INCS)

EE_LDFLAGS = -nostartfiles -Tlinkfile -L$(PS2SDK)/ee/lib -L$(PS2SDK)/sbv/lib -L. -s
#EE_LIBS = -lpatches -lfileXio -lc -lkernel
EE_LIBS = -lcdvd -lpad -lpatches -lc -lkernel 


all: launcher2.elf

#EE_OBJS += usbhdfsd.o usbd.o iomanx.o  filexio.o
EE_OBJS += usbhdfsd.o usbd.o iomanx.o init.o

init.s:
	bin2s init.irx init.s init_irx
init.o: init.s
	ee-as -G0 init.s -o init.o
usbd.o:
	ee-as -G0 usbd.s -o usbd.o
usbhdfsd.o:
	ee-as -G0 usbhdfsd.s -o usbhdfsd.o
iomanx.o:
	ee-as -G0 iomanx.s -o iomanx.o
filexio.o:
	ee-as -G0 filexio.s -o filexio.o

#launcher.elf: launcher.c usbd.o usbhdfsd.o iomanx.o filexio.o
launcher2.elf: launcher2.c usbd.o usbhdfsd.o iomanx.o init.o
	$(EE_CC) -mno-crt0 $(EE_CFLAGS) $(EE_LDFLAGS) $< -o $@ $(EE_OBJS) $(EE_LIBS)
#	$(EE_CC) $(EE_CFLAGS) $(EE_LDFLAGS) $< crt0.s -o $@ $(EE_OBJS) $(EE_LIBS)
	
clean:
	rm -f *.elf *.o init.s



