feat\!: migrate to LWTOOLS build system

This commit is contained in:
2025-08-31 13:44:00 -05:00
parent 9c668967d5
commit c67176e99a
4 changed files with 71 additions and 48 deletions

View File

@@ -8,26 +8,45 @@
# Project Defaults & Folders
# ------------------------------------------------------------------------------
TARGET := boot.bin
TARGET := boot
TARGROM := $(TARGET).bin
SRCDIR := src/
MAINSRC := $(SRCDIR)boot.s
BUILDDIR := build/
SRCS := $(wildcard $(SRCDIR)*.s)
OBJS := $(patsubst $(SRCDIR)%.s,$(BUILDDIR)%.o,$(SRCS))
INCS := $(wildcard $(SRCDIR)*.inc)
# ------------------------------------------------------------------------------
# Toolchain Definitions
# ------------------------------------------------------------------------------
AS := asm6809
AS := lwasm
LD := lwlink
FIX := mot2bin
ASFLAGS := -f obj
LDFLAGS := -f srec -m map.txt -s linkscript
# ------------------------------------------------------------------------------
# Rules and Phony Targets
# ------------------------------------------------------------------------------
all: $(TARGET)
all: $(TARGROM)
$(TARGET): $(SRCS) $(INCS)
$(AS) -o $(TARGET) $(MAINSRC)
# Fix srec into flashable bin file
$(TARGROM): $(TARGET).s19
$(FIX) -out $@ $<
# Link objects
$(TARGET).s19: $(OBJS)
$(LD) $(LDFLAGS) -o $@ $<
# Assemble objects
$(OBJS): $(BUILDDIR)%.o : $(SRCDIR)%.s
-@mkdir -p $(BUILDDIR)
$(AS) $(ASFLAGS) -o $@ $<
.IGNORE: clean
clean:
rm -v $(TARGET)
@echo 'Cleaning up intermediary files...'
@rm -rv $(TARGROM) $(TARGET).s19 $(BUILDDIR)