include $(ROOT)/usr/include/make/GBAdefs

TARGETS = emi.bwf

ASFILES = crt0.s
CFILES = Main.c Data.c 
HEADERS = Main.h rom_header.s

default: $(TARGETS)

LLDOPTS = -Ttext $(MK_VIEWER_START) -Tbss 0x03000000 -L$(ROOT)/usr/lib/gba -L$(ROOT)/usr/lib/sc 
LLDLIBS = -lagbsyscall -lmyfunc -les -lisfs -lios -lc -lvio_usb -lios -lc
LCINCS = -I$(ROOT)/usr/include/gba -I$(ROOT)/usr/include

LDIRT += emi.mrg app.elf *.tik *.bwf *.app *.tmd *.titleKey *.met emi.elf

include $(COMMONRULES)

app.elf: $(OBJECTS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)

emi.mrg: app.elf $(ROOT)/usr/bin/sc/lr.elf
	$(MERGE) -g app.elf -n $(ROOT)/usr/bin/sc/lr.elf -o emi.mrg

emi.bwf: emi.mrg
	$(PUBLISH) -n emi -v -l emi.mrg
