# You have to add .bmp to your .SUFFIXES, to use DrawIcon.
.SUFFIXES: .c .asm .rel .bin .app .bmp

# Add your icon.rel(s) (the converted bmp's) at the end of the rels statement
rels = icontest.rel ../../lib/crt.rel skyline.rel
appname = icontest

.c.rel:
	avcp -I../../inc $*.c | avcc > $*.asm
	avas $*.asm

# I almost use -i -c with bmp2asm, since it will create compressed Icons,
# if possible. Otherwise it will create normal Icons.
.bmp.rel:
	bmp2asm -i -c $*.bmp $*.asm
	avas $*.asm

.asm.rel:
	avas $*.asm

$(appname).app:$(appname).bin $(appname).def icon.bmp
	avmkapp $(appname).def

# avicons.rel is only needed for DrawSystemIcon - not for DrawIcon.
# If you don't use DrawSystemicon, just remove the following avicons.rel
# reference.
$(appname).bin:$(rels)
	avlink -o$(appname) ../../lib/avicons.rel $(rels)


install:
	avapp -p2 -r$(appname).app

clean:
	rm -f *.map
	rm -f *.bin
	rm -f *.rel
	rm -f *.asm
	rm -f *.app
