Properly tokenize declaration sections

This commit is contained in:
2025-05-02 22:57:04 +02:00
parent 768821c689
commit dcfd6b1515
5 changed files with 357 additions and 165 deletions

View File

@ -36,11 +36,17 @@ end
directory 'build'
desc 'Initial stage'
file 'build/stage1' => ['boot/stage1.s', 'boot/common-boot.s', 'boot/tokenizer.s', 'build'] do |t|
source = t.prerequisites.filter { |prerequisite| prerequisite.end_with? '.s' }
Dir.glob('boot/*.s').each do |assembly_source|
target_object = Pathname.new('build') + Pathname.new(assembly_source).basename.sub_ext('.o')
sh CROSS_GCC, '-nostdlib', '-o', t.name, *source
file target_object.to_s => [assembly_source, 'build'] do |t|
sh CROSS_GCC, '-c', '-o', t.name, assembly_source
end
end
desc 'Initial stage'
file 'build/stage1' => ['build/tokenizer.o', 'build/stage1.o', 'build/common-boot.o'] do |t|
sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
end
file 'build/stage2a.s' => ['build/stage1', 'boot/stage2.elna'] do |t|
@ -51,8 +57,10 @@ file 'build/stage2a.s' => ['build/stage1', 'boot/stage2.elna'] do |t|
end
end
file 'build/stage2a' => ['build/stage2a.s', 'boot/common-boot.s'] do |t|
sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
['build/stage2a', 'build/stage2b'].each do |exe|
file exe => [exe.ext('.s'), 'build/common-boot.o'] do |t|
sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
end
end
file 'build/stage2b.s' => ['build/stage2a', 'boot/stage2.elna'] do |t|
@ -62,7 +70,3 @@ file 'build/stage2b.s' => ['build/stage2a', 'boot/stage2.elna'] do |t|
assemble_stage output, exe, source
end
end
file 'build/stage2b' => ['build/stage2b.s', 'boot/common-boot.s'] do |t|
sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
end