diff options
Diffstat (limited to 'Rakefile')
| -rw-r--r-- | Rakefile | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -6,7 +6,6 @@ require 'open3' require 'rake/clean' -CROSS_GCC = '../eugenios/build/rootfs/bin/riscv32-unknown-linux-gnu-gcc' SYSROOT = '../eugenios/build/sysroot' QEMU = 'qemu-riscv32' STAGES = Dir.glob('boot/stage*.elna').collect { |stage| File.basename stage, '.elna' }.sort @@ -16,6 +15,10 @@ CLEAN.include 'build/boot', 'build/valid' directory 'build/boot' directory 'build/valid' +def compile(input, output) + sh ENV.fetch('CC', 'gcc'), '-nostdlib', '-o', output, input +end + task default: :boot desc 'Final stage' @@ -47,7 +50,7 @@ end rule /^build\/[[:alpha:]]+\/stage[[:digit:]]+$/ => ->(match) { "#{match}.s" } do |t| - sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites + compile(*t.prerequisites, t.name) end STAGES.each do |stage| @@ -91,5 +94,5 @@ end file 'build/boot/stage1' => ['build/boot', 'boot/stage1.s'] do |t| source = t.prerequisites.select { |prerequisite| prerequisite.end_with? '.s' } - sh CROSS_GCC, '-nostdlib', '-o', t.name, *source + compile(*source, t.name) end |
