
PSPSDK=$(shell psp-config --pspsdk-path)

PSPDEV=$(shell psp-config --pspdev-path)/bin
INCLUDE=$(PSPSDK)/include

copy-all: clean all

all:
	$(PSPDEV)/psp-gcc -I $(INCLUDE) -O2 -W -Wall -G0 -fno-pic -mno-abicalls -w -S main.c -o main.s

	$(PSPDEV)/psp-as main.s -o main.o

	$(PSPDEV)/psp-ld --no-warn-mismatch -T psp20bin.x main.o -o main.elf -lc
	$(PSPDEV)/psp-strip -s main.elf
	$(PSPDEV)/psp-objcopy -O binary main.elf tetris.bin

clean:
	rm -rf *~ *.elf *.bin *.s *.bin