
# You can change the following to suit your ps2dev environment.
EE_PREFIX = ee-
EE_CC = $(EE_PREFIX)gcc
EE_OBJCOPY = $(EE_PREFIX)objcopy

# Change this to suit your host environment.
CC = gcc
CFLAGS = -O2 -ansi -Wall

# Don't change anything below this line.
EE_INCS = -I$(PS2LIB)/ee/include -I$(PS2LIB)/common/include
EE_CFLAGS = -D_EE -O2 -G0 -Wall $(EE_INCS)

EE_LDFLAGS = -nostartfiles -Tlinkfile -L$(PS2LIB)/ee/lib -s
EE_LIBS = -lkernel

all: titleman

titleman: titleman.c payload.h
	$(CC) $(CFLAGS) $< -o $@

payload.h: payload.bin bin2c
	./bin2c $< $@

payload.bin: payload.elf
	$(EE_OBJCOPY) -I elf32-littlemips -O binary $< $@

payload.elf: payload.c
	$(EE_CC) $(EE_CFLAGS) $(EE_LDFLAGS) $< -o $@ $(EE_LIBS)

bin2c: bin2c.c
	$(CC) $(CFLAGS) $< -o $@

clean:
	rm -f payload.elf payload.bin payload.h bin2c titleman
