summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-04-25 23:12:36 +0200
committerEugen Wissner <belka@caraus.de>2025-04-25 23:12:36 +0200
commitfee1781a5bb097b28056a43138713095dfa47a4a (patch)
tree730cb8975a59c905b472046134f2accfdb14673b /Rakefile
parent2e0c958aa30e831ee766efd63f3d6dfa84069e1b (diff)
downloadelna-fee1781a5bb097b28056a43138713095dfa47a4a.tar.gz
Change label and jump (now goto) syntax
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile37
1 files changed, 25 insertions, 12 deletions
diff --git a/Rakefile b/Rakefile
index 86ca2e1..5976113 100644
--- a/Rakefile
+++ b/Rakefile
@@ -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