summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-09-05 17:17:28 +0200
committerEugen Wissner <belka@caraus.de>2025-09-05 17:17:28 +0200
commite0ac57dc1d27831b374b7540256d4e4285284492 (patch)
tree8d09810e283a79fd80a4c45a823d1906983c6376 /Rakefile
parent48882522746873d48b563ec66321ef99a51badbc (diff)
downloadelna-e0ac57dc1d27831b374b7540256d4e4285284492.tar.gz
Add string literals
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile18
1 files changed, 8 insertions, 10 deletions
diff --git a/Rakefile b/Rakefile
index e6dc163..2b61d70 100644
--- a/Rakefile
+++ b/Rakefile
@@ -6,8 +6,6 @@
require 'open3'
require 'rake/clean'
-SYSROOT = '../eugenios/build/sysroot'
-QEMU = 'qemu-riscv32'
STAGES = Dir.glob('boot/stage*.elna').collect { |stage| File.basename stage, '.elna' }.sort
CLEAN.include 'build/boot', 'build/valid'
@@ -19,6 +17,10 @@ def compile(input, output)
sh ENV.fetch('CC', 'gcc'), '-nostdlib', '-o', output, input
end
+def run(exe)
+ ENV.fetch('QEMU', '').split << exe
+end
+
task default: :boot
desc 'Final stage'
@@ -31,9 +33,8 @@ task boot: "boot/#{STAGES.last}.elna" do |t|
source = groupped['.elna']
cat_arguments = ['cat', source]
- compiler_arguments = [QEMU, '-L', SYSROOT, exe]
diff_arguments = ['diff', '-Nur', '--text', expected, '-']
- Open3.pipeline(cat_arguments, compiler_arguments, diff_arguments)
+ Open3.pipeline(cat_arguments, run(exe), diff_arguments)
end
desc 'Convert previous stage language into the current stage language'
@@ -60,8 +61,7 @@ STAGES.each do |stage|
exe, source = t.prerequisites
cat_arguments = ['cat', source]
- compiler_arguments = [QEMU, '-L', SYSROOT, exe]
- last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, compiler_arguments)
+ last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, run(exe))
IO.copy_stream last_stdout, t.name
end
@@ -70,8 +70,7 @@ STAGES.each do |stage|
exe, source = t.prerequisites
cat_arguments = ['cat', source]
- compiler_arguments = [QEMU, '-L', SYSROOT, exe]
- last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, compiler_arguments)
+ last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, run(exe))
IO.copy_stream last_stdout, t.name
end
@@ -85,8 +84,7 @@ file 'build/valid/stage1.s' => ['build/boot/stage1', 'boot/stage1.s', 'build/val
source, exe, = t.prerequisites.partition { |prerequisite| prerequisite.end_with? '.s' }
cat_arguments = ['cat', *source]
- compiler_arguments = [QEMU, '-L', SYSROOT, *exe]
- last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, compiler_arguments)
+ last_stdout, wait_threads = Open3.pipeline_r(cat_arguments, run(exe.first))
IO.copy_stream last_stdout, t.name
end