Fixed some build system stuff

This commit is contained in:
Joppe Blondel
2026-10-07 14:42:54 +02:00
parent da02d8c855
commit 5637db47fd
3 changed files with 9 additions and 28 deletions
+5 -14
View File
@@ -10,10 +10,10 @@ FILES := bios
SOURCES := $(addprefix ./, $(addsuffix .asm, $(FILES)))
TARGETS := $(addprefix $(BUILDDIR)/, $(addsuffix .bin, $(FILES)))
TOPTARGETS := all clean size
TOPTARGETS := all clean
$(TOPTARGETS): $(SUBDIRS)
all: $(BUILDDIR) $(BUILDDIR)/rom.bin size
all: $(BUILDDIR) $(BUILDDIR)/rom.bin
clean:
rm -rf $(BUILDDIR)
@@ -25,17 +25,7 @@ $(BUILDDIR)/%.bin: ./%.asm $(BUILDDIR)/memory.inc
echo '>$<'
$(ASM) $(ASMFLAGS) $< $@
size:
@for file in $(TARGETS); do \
if [ -f "$$file" ]; then \
echo "$$file: $$(wc -c < "$$file") bytes"; \
else \
echo "$$file: Not built yet (run 'make')"; \
fi \
done
$(MAKE) -C apps/basic size --no-print-directory
$(BUILDDIR)/basic.bin:
$(BUILDDIR)/basic.bin: $(BUILDDIR)/memory.inc
$(MAKE) -C apps/basic $(or $(MAKECMDGOALS),all) --no-print-directory
$(BUILDDIR)/memory.inc: memory.mk
@@ -44,6 +34,8 @@ $(BUILDDIR)/memory.inc: memory.mk
/^[A-Z][A-Z0-9_]*[[:space:]]*:=[[:space:]]*/ { print $$1 " .equ " $$3 }' $< > $@
$(BUILDDIR)/rom.bin: $(BUILDDIR)/bios.bin $(BUILDDIR)/basic.bin
echo "bios: $(shell wc -c < $(BUILDDIR)/bios.bin) / $$(($(BIOS_ROM_SIZE)+0))"
echo "basic: $(shell wc -c < $(BUILDDIR)/basic.bin) / $$(($(BASIC_ROM_SIZE)+0))"
objcopy --pad-to=$$(($(BIOS_ROM_START)+$(BIOS_ROM_SIZE))) \
-I binary $(BUILDDIR)/bios.bin -O binary $(BUILDDIR)/bios_padded.bin
objcopy --pad-to=$(BASIC_ROM_SIZE) \
@@ -52,4 +44,3 @@ $(BUILDDIR)/rom.bin: $(BUILDDIR)/bios.bin $(BUILDDIR)/basic.bin
.PHONY: $(TOPTARGETS) $(SUBDIRS)