This commit is contained in:
janis 2026-06-05 08:15:29 +02:00
parent c9c3f239c8
commit ff22a96106
Signed by: janis
SSH key fingerprint: SHA256:bB1qbbqmDXZNT0KKD5c2Dfjg53JGhj7B3CFcLIzSqq8

34
stages/Makefile Normal file
View file

@ -0,0 +1,34 @@
BUILD = build
all: $(BUILD)/stage1-hex1 $(BUILD)/stage1-elf $(BUILD)/stage0
stage0-hex0: $(BUILD)/stage0-hex0
# We need an initial compiler to convert the hex0.in file into an executable that can be used to generate the stage0 compiler.
$(BUILD)/stage0-bootstrap: hex0/hex0.in
for x in `sed '/^;/d;s/;.*//;s/ *//' hex0/hex0.in`; do printf \\x$$x; done > $@
chmod +x $@
# We use the stage0-bootstrap compiler to generate the stage0-hex0 compiler.
$(BUILD)/stage0-hex0: $(BUILD)/stage0-bootstrap
$< < hex0/hex0.in > $@
chmod +x $@
# Finally, we use the stage0-hex0 compiler to generate the stage0 compiler, which should be identical to the stage0-hex0 compiler.
$(BUILD)/stage0: $(BUILD)/stage0-hex0
$< < hex0/hex0.in > $@
chmod +x $@
verify-hex0: $(BUILD)/stage0
cmp $(BUILD)/stage0 $(BUILD)/stage0-hex0
$(BUILD)/stage1-elf: $(BUILD)/stage0
$< < hex1/elf.in > $@
chmod +x $@
$(BUILD)/stage1-hex1.text: $(BUILD)/stage0
$< < hex1/hex1.in > $@
$(BUILD)/stage1-hex1: $(BUILD)/stage1-elf $(BUILD)/stage1-hex1.text
$(BUILD)/stage1-elf $(BUILD)/stage1-hex1 $(BUILD)/stage1-hex1.text