diff options
Diffstat (limited to 'boot/Makefile')
-rw-r--r-- | boot/Makefile | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/boot/Makefile b/boot/Makefile new file mode 100644 index 0000000..2fff22d --- /dev/null +++ b/boot/Makefile @@ -0,0 +1,50 @@ +AS=sdasz80 +CC=sdcc +CPP=sdcpp + +ASM=crt0.asm +SRC=crc16.c\ + bootloader.c + +INCLUDE=../include +BUILD=../build/boot + +OBJ=$(ASM:%.asm=$(BUILD)/%.rel)\ + $(SRC:%.c=$(BUILD)/%.rel) + +IHX=$(BUILD)/bootloader.ihx +TARGET=$(BUILD)/bootloader.hex + +CFLAGS=-mz80 -I$(INCLUDE) --Werror +LDFLAGS=-mz80 --no-std-crt0\ + --code-loc 0x8100\ + --data-loc 0xC000\ + --stack-loc 0x0000\ + -Wl-b_GSINIT=0x8080 + +all : $(TARGET) + +$(OBJ): | $(BUILD) + +$(BUILD) : + @mkdir -p $(BUILD) + +$(BUILD)/%.rel : %.asm + @echo ' (AS)' $< + @$(CPP) -P -I$(INCLUDE) -DASSEMBLY $< > $(BUILD)/$(notdir $<) + @$(AS) -g -o $@ $(BUILD)/$(notdir $<) + +$(BUILD)/%.rel : %.c + @echo ' (CC)' $< + @$(CC) $(CFLAGS) -c -o $@ $< + +$(IHX) : $(OBJ) + @echo ' (LD)' $(OBJ) + @$(CC) $(LDFLAGS) -o $@ $(OBJ) + +$(TARGET) : $(IHX) + @hex2bin.py $< $@ + +.PHONY : clean +clean : + @find $(BUILD) -type f -delete |