# Makefile for aica_fw.h

BIN2C = $(KOS_BASE)/utils/bin2c/bin2c

all: aica_fw.h

aica_fw.h: prog.bin
	$(BIN2C) prog.bin aica_fw.hex
	@echo "static unsigned char play[] = {" | cat - aica_fw.hex > aica_fw.h
	@echo "};" >> aica_fw.h
	@rm aica_fw.hex

prog.bin: prog.elf
	$(DC_ARM7OBJCOPY) -O binary prog.elf prog.bin

prog.elf: crt0.o main.o aica.o play.o
	$(DC_ARM7CC) -Wl,-Ttext,0x00000000 -nostartfiles -nostdlib -e reset -o prog.elf crt0.o main.o aica.o play.o -lgcc

%.o: %.c
	$(DC_ARM7CC) $(DC_ARM7CFLAGS) -c $< -o $@

%.o: %.s
	$(DC_ARM7AS) $(DC_ARM7AFLAGS) $< -o $@

clean:
	-rm -f *.o *.bin *.elf aica_fw.h aica_fw.hex

