From e0ac57dc1d27831b374b7540256d4e4285284492 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 5 Sep 2025 17:17:28 +0200 Subject: Add string literals --- Rakefile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'Rakefile') 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 -- cgit v1.2.3