diff options
author | Thomas Albers Raviola <thomas@thomaslabs.org> | 2024-12-03 21:45:47 +0100 |
---|---|---|
committer | Thomas Albers Raviola <thomas@thomaslabs.org> | 2024-12-03 21:45:47 +0100 |
commit | d46862a5bd2319c595b11427f781201ca063d194 (patch) | |
tree | e83d3f40c60233a1da85334745b882f188b0be52 /Makefile | |
parent | 9cd14efb76a4ddbcd013f44d50dc1ff93d56c4ca (diff) |
Add bootloader
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 37 |
1 files changed, 20 insertions, 17 deletions
@@ -15,14 +15,16 @@ SRC=font.c\ tty.c\ menu.c -OBJ=$(ASM:%.asm=build/%.rel)\ - $(SRC:%.c=build/%.rel) +INCLUDE=include +BUILD=build -IHX=build/$(PROJECT).ihx -TARGET=build/$(PROJECT).hex -BOOTLOADER=build/boot/bootloader.hex +OBJ=$(ASM:%.asm=$(BUILD)/%.rel)\ + $(SRC:%.c=$(BUILD)/%.rel) + +IHX=$(BUILD)/$(PROJECT).ihx +TARGET=$(BUILD)/$(PROJECT).hex +BOOTLOADER=$(BUILD)/boot/bootloader.hex -INCLUDE=include CFLAGS=-mz80 -I$(INCLUDE) --Werror LDFLAGS=-mz80 --no-std-crt0\ --code-loc 0x0100\ @@ -34,17 +36,17 @@ ROM_CHIP=AT28C256 all : $(TARGET) -$(OBJ): | build +$(OBJ): | $(BUILD) -build: - @mkdir -p build +$(BUILD): + @mkdir -p $(BUILD) -build/%.rel : asm/%.asm +$(BUILD)/%.rel : asm/%.asm @echo ' (AS)' $< - @$(CPP) -P -I$(INCLUDE) -DASSEMBLY $< > build/$(notdir $<) - @$(AS) -g -o $@ build/$(notdir $<) + @$(CPP) -P -I$(INCLUDE) -DASSEMBLY $< > $(BUILD)/$(notdir $<) + @$(AS) -g -o $@ $(BUILD)/$(notdir $<) -build/%.rel : src/%.c +$(BUILD)/%.rel : src/%.c @echo ' (CC)' $< @$(CC) $(CFLAGS) -c -o $@ $< @@ -54,15 +56,16 @@ $(IHX) : $(OBJ) $(TARGET) : $(IHX) $(BOOTLOADER) @hex2bin.py -l 32768 $< $@ - @dd if=$(BOOTLOADER) of=$@ obs=1024 seek=28 conv=notrunc + @dd if=$(BOOTLOADER) of=$@ obs=1024 seek=28 conv=notrunc 2>/dev/null +.PHONY : $(BOOTLOADER) $(BOOTLOADER) : - make -C boot + @make -C boot -.PHONE : flash +.PHONY : flash flash : @minipro -y -sp $(ROM_CHIP) -w $(TARGET) .PHONY : clean clean : - @find build -type f -delete + @find $(BUILD) -type f -delete |