summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-05-02 22:57:04 +0200
committerEugen Wissner <belka@caraus.de>2025-05-02 22:57:04 +0200
commitdcfd6b1515679cfbc75de12a17352d9d1eddceaf (patch)
treeb50acc98325fffd5d1168a9c89d64ed54dd4217d /Rakefile
parent768821c68980968f7ab37ef71f4389c4fcee9235 (diff)
downloadelna-dcfd6b1515679cfbc75de12a17352d9d1eddceaf.tar.gz
Properly tokenize declaration sections
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile24
1 files changed, 14 insertions, 10 deletions
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