summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile30
1 files changed, 10 insertions, 20 deletions
diff --git a/Rakefile b/Rakefile
index d35b267..743fc21 100644
--- a/Rakefile
+++ b/Rakefile
@@ -67,29 +67,15 @@ file 'build/build.ninja' => ['build'] do |t|
rule link2
command = ld -o $out --dynamic-linker /lib32/ld-linux-riscv32-ilp32d.so.1 /usr/lib/crt1.o /usr/lib/crti.o -lc $in /usr/lib/crtn.o
- rule boot1
- command = build/boot/stage1/cl < \$in > \$out
-
- rule valid1
- command = build/valid/stage1/cl < \$in > \$out
+ rule bootstrap
+ command = $bootstrap < \$in > \$out
NINJA
- STAGES.each do |stage|
- stage_number = stage.delete_prefix('stage').to_i
-
- f << <<~NINJA
-
- rule valid#{stage_number}
- command = build/valid/stage#{stage_number}/cl < \$in > \$out
-
- rule boot#{stage_number}
- command = build/boot/stage#{stage_number}/cl < \$in > \$out
- NINJA
- end
f << <<~NINJA
build build/boot/stage1/cl: cc boot/stage1.s
+ build build/valid/stage1/cl.s: bootstrap boot/stage1.s | build/boot/stage1/cl
+ bootstrap = build/boot/stage1/cl
- build build/valid/stage1/cl.s: boot1 boot/stage1.s | build/boot/stage1/cl
build build/valid/stage1/cl.o: as build/valid/stage1/cl.s
build build/valid/stage1/cl: link1 build/valid/stage1/cl.o
NINJA
@@ -106,11 +92,15 @@ file 'build/build.ninja' => ['build'] do |t|
valid_stage = "build/valid/stage#{stage_number}"
f << <<~NINJA
- build #{boot_stage}/cl.s: valid#{stage_number.pred} boot/stage#{stage_number}/cl.elna | build/valid/stage#{stage_number.pred}/cl
+ build #{boot_stage}/cl.s: bootstrap boot/stage#{stage_number}/cl.elna | build/valid/stage#{stage_number.pred}/cl
+ bootstrap = build/valid/stage#{stage_number.pred}/cl
+
build #{boot_stage}/cl.o: as #{boot_stage}/cl.s
build #{boot_stage}/cl: #{link} #{boot_stage}/cl.o
- build #{valid_stage}/cl.s: boot#{stage_number} boot/stage#{stage_number}/cl.elna | #{boot_stage}/cl
+ build #{valid_stage}/cl.s: bootstrap boot/stage#{stage_number}/cl.elna | #{boot_stage}/cl
+ bootstrap = build/boot/stage#{stage_number}/cl
+
build #{valid_stage}/cl.o: as #{valid_stage}/cl.s
build #{valid_stage}/cl: #{link} #{valid_stage}/cl.o
NINJA