Support simple variable assignment

This commit is contained in:
2025-09-01 09:57:18 +02:00
parent 627975775c
commit 44fa140769
8 changed files with 1454 additions and 505 deletions

View File

@@ -44,13 +44,15 @@ task :convert do
end
end
rule /^build\/[[:alpha:]]+\/stage[[:digit:]]+$/ => ->(match) {
"#{match}.s"
} do |t|
sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
end
STAGES.each do |stage|
previous = stage.delete_prefix('stage').to_i.pred
file "build/valid/#{stage}" => "build/valid/#{stage}.s" do |t|
sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
end
file "build/valid/#{stage}.s" => ["build/boot/#{stage}", "boot/#{stage}.elna"] do |t|
exe, source = t.prerequisites
@@ -61,10 +63,6 @@ STAGES.each do |stage|
IO.copy_stream last_stdout, t.name
end
file "build/boot/#{stage}" => "build/boot/#{stage}.s" do |t|
sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
end
file "build/boot/#{stage}.s" => ["build/valid/stage#{previous}", "boot/#{stage}.elna"] do |t|
exe, source = t.prerequisites
@@ -80,12 +78,6 @@ end
# Stage 1.
#
file 'build/valid/stage1' => ['build/valid', 'build/valid/stage1.s'] do |t|
source = t.prerequisites.select { |prerequisite| prerequisite.end_with? '.s' }
sh CROSS_GCC, '-nostdlib', '-o', t.name, *source
end
file 'build/valid/stage1.s' => ['build/boot/stage1', 'boot/stage1.s', 'build/valid'] do |t|
source, exe, = t.prerequisites.partition { |prerequisite| prerequisite.end_with? '.s' }