From dcfd6b1515679cfbc75de12a17352d9d1eddceaf Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 2 May 2025 22:57:04 +0200 Subject: Properly tokenize declaration sections --- Rakefile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'Rakefile') diff --git a/Rakefile b/Rakefile index 4398ef8..2bc2683 100644 --- a/Rakefile +++ b/Rakefile @@ -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') + + file target_object.to_s => [assembly_source, 'build'] do |t| + sh CROSS_GCC, '-c', '-o', t.name, assembly_source + end +end - sh CROSS_GCC, '-nostdlib', '-o', t.name, *source +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 -- cgit v1.2.3