
PROGNAME	:= Micro Lua DS
OFILES		+=
ADD_LIBS	+=


#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif

include $(DEVKITARM)/ds_rules

export TARGET		:=	$(shell basename $(CURDIR))
export TOPDIR		:=	$(CURDIR)


.PHONY: arm7/$(TARGET).elf arm9/$(TARGET).elf

#---------------------------------------------------------------------------------
# EFS is the path to the EFS binary
# NITRO_FILES is the path to the folder to the included as the filesystem
#---------------------------------------------------------------------------------
EFS		:= $(CURDIR)/efs.exe
export NITRO_FILES		:= $(CURDIR)/efsroot
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
TEXT1 		:= Squishy Bird DS
TEXT2 		:= by Headshotnoby
#TEXT3 		:= MP3 support by Headshot
LOGO		:= -o $(CURDIR)/logo.bmp
ICON 		:= -b $(CURDIR)/logo.bmp
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
all: $(TARGET).nds

#---------------------------------------------------------------------------------
$(TARGET).nds	:	arm7/$(TARGET).elf arm9/$(TARGET).elf
$(TARGET).nds	: 	$(shell find $(NITRO_FILES))
	@echo Compiling ARM7 and ARM9
	ndstool -c $@ -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf $(LOGO) $(ICON) "$(TEXT1);$(TEXT2);$(TEXT3)" -d $(NITRO_FILES)
	#$(EFS) $(notdir $@)

#---------------------------------------------------------------------------------
arm7/$(TARGET).elf:
	@echo Compiling ARM7
	@$(MAKE) -C arm7

#---------------------------------------------------------------------------------
arm9/$(TARGET).elf:
	@echo Compiling ARM9
	@$(MAKE) -C arm9

#---------------------------------------------------------------------------------
clean:
	@$(MAKE) -C arm9 clean
	@$(MAKE) -C arm7 clean
	@rm -f $(TARGET).nds $(TARGET).arm7 $(TARGET).arm9
