#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------

ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitPro")
endif

ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>/devkitPro/devkitPPC")
endif

include $(DEVKITPRO)/wut/share/wut_rules

WUPS_ROOT	?=	$(DEVKITPRO)/wups

WUPSSPECS	:=	-T$(WUPS_ROOT)/share/wups.ld -specs=$(WUPS_ROOT)/share/wups.specs

#---------------------------------------------------------------------------------
%.wps: %.elf
	@cp $< $*.strip.elf
	@$(STRIP) -g $*.strip.elf
	@elf2rpl $*.strip.elf $@
	@echo 'PL' | dd of=$@ bs=1 seek=9 count=2 conv=notrunc status=none
	@rm $*.strip.elf
	@echo built ... $(notdir $@)