PROJECT=firmware AS=sdasz80 CC=sdcc CPP=sdcpp ASM=crt0.asm\ isr.asm\ delay.asm SRC=crc16.c\ bootloader.c\ font.c\ i2c.c\ input.c\ main.c\ tft.c\ tty.c\ menu.c OBJ=$(ASM:%.asm=build/%.rel)\ $(SRC:%.c=build/%.rel) IHX=build/$(PROJECT).ihx TARGET=build/$(PROJECT).hex INCLUDE=include CFLAGS=-mz80 -I$(INCLUDE) --Werror LDFLAGS=-mz80 --no-std-crt0\ --code-loc 0x0100\ --data-loc 0x8010\ -Wl-b_ISR_TABLE=0x0070\ -Wl-b_GSINIT=0x0080 ROM_CHIP=AT28C256 all : $(TARGET) $(OBJ): | build build: @mkdir -p build build/%.rel : asm/%.asm @echo ' (AS)' $< @$(CPP) -P -I$(INCLUDE) -DASSEMBLY $< > build/$(notdir $<) @$(AS) -g -o $@ build/$(notdir $<) build/%.rel : src/%.c @echo ' (CC)' $< @$(CC) $(CFLAGS) -c -o $@ $< $(IHX) : $(OBJ) @echo ' (LD)' $(OBJ) @$(CC) $(LDFLAGS) -o $@ $(OBJ) $(TARGET) : $(IHX) @hex2bin.py $< $@ .PHONE : flash flash : @minipro -y -sp $(ROM_CHIP) -w $(TARGET) .PHONY : clean clean : @find build -type f -delete