Switched to sdcc based toolchain

This commit is contained in:
2021-06-18 23:18:33 +02:00
parent 3047e36053
commit 66f9451983
3 changed files with 56 additions and 39 deletions

View File

@@ -1,16 +1,34 @@
BUILDDIR=.build
_BIN= loader.bin
BIN = $(patsubst %,$(BUILDDIR)/%,$(_BIN))
AS = sdasz80
LD = sdldz80
OBJCOPY = sdobjcopy
BUILD = .build
TARGET = loader
ASFLAGS = -plosff
SRC = \
src/loader.s \
OBJ = $(addprefix $(BUILD)/, $(notdir $(SRC:.s=.rel)))
vpath %.s $(sort $(dir $(SRC)))
.PHONY: all clean
all: $(BUILDDIR) $(BIN)
all: $(BUILD) $(BUILD)/$(TARGET).bin
$(BUILDDIR)/%.bin: src/%.z80 | $(BUILDDIR)
@zasm -w -i $< -o $@
$(BUILD)/%.rel: %.s Makefile | $(BUILD)
$(AS) $(ASFLAGS) $@ $<
$(BUILDDIR):
@mkdir $(BUILDDIR)
$(BUILD)/$(TARGET).ihx: $(OBJ)
$(LD) -i $@ $(OBJ) -b MAIN=0x1100
%.bin: %.ihx
$(OBJCOPY) -I ihex -O binary $< $@
$(BUILD):
mkdir $@
clean:
@rm -df $(BUILDDIR)/*.bin $(BUILDDIR)/*.lst .build
rm -fr $(BUILD)