diff options
Diffstat (limited to 'Rakefile')
| -rw-r--r-- | Rakefile | 37 |
1 files changed, 25 insertions, 12 deletions
@@ -22,31 +22,44 @@ def assemble_stage(output, compiler, source) end desc 'Final stage' -task default: ['build/stage2', 'boot/stage2.elna'] do |t| - assembler, exe = t.prerequisites.partition { |prerequisite| prerequisite.end_with? '.elna' } +task default: ['build/stage2b', 'build/stage2b.s', 'boot/stage2.elna'] do |t| + exe, previous_output, source = t.prerequisites - File.open File::NULL, 'w' do |output| - assemble_stage output, exe, assembler - end + cat_arguments = ['cat', source] + compiler_arguments = [QEMU, '-L', SYSROOT, exe] + diff_arguments = ['diff', '-Nur', previous_output, '-'] + Open3.pipeline(cat_arguments, compiler_arguments, diff_arguments) end directory 'build' desc 'Initial stage' -file 'build/stage1' => ['boot/echo-boot.s', 'boot/common-boot.s', 'build'] do |t| - assembler = t.prerequisites.filter { |prerequisite| prerequisite.end_with? '.s' } +file 'build/stage1' => ['boot/stage1.s', 'boot/common-boot.s', 'build'] do |t| + source = t.prerequisites.filter { |prerequisite| prerequisite.end_with? '.s' } + + sh CROSS_GCC, '-nostdlib', '-o', t.name, *source +end - sh CROSS_GCC, '-nostdlib', '-o', t.name, *assembler +file 'build/stage2a.s' => ['build/stage1', 'boot/stage2.elna'] do |t| + source, exe = t.prerequisites.partition { |prerequisite| prerequisite.end_with? '.elna' } + + File.open t.name, 'w' do |output| + assemble_stage output, exe, source + end +end + +file 'build/stage2a' => ['build/stage2a.s', 'boot/common-boot.s'] do |t| + sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites end -file 'build/stage2.s' => ['build/stage1', 'boot/stage2.elna'] do |t| - assembler, exe = t.prerequisites.partition { |prerequisite| prerequisite.end_with? '.elna' } +file 'build/stage2b.s' => ['build/stage2a', 'boot/stage2.elna'] do |t| + source, exe = t.prerequisites.partition { |prerequisite| prerequisite.end_with? '.elna' } File.open t.name, 'w' do |output| - assemble_stage output, exe, assembler + assemble_stage output, exe, source end end -file 'build/stage2' => ['build/stage2.s', 'boot/common-boot.s'] do |t| +file 'build/stage2b' => ['build/stage2b.s', 'boot/common-boot.s'] do |t| sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites end |
