From 5b7f983b3912a8d0fbeaf22f7fe0e2c5f1e0ff01 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 4 Oct 2026 12:56:13 +0200 Subject: Generate a dependency tree for rake --- rakelib/compiler.rake | 32 ++++++++++++++++++++++++++++++++ rakelib/doc.rake | 1 - rakelib/gcc.rake | 1 - 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 rakelib/compiler.rake (limited to 'rakelib') diff --git a/rakelib/compiler.rake b/rakelib/compiler.rake new file mode 100644 index 0000000..f443407 --- /dev/null +++ b/rakelib/compiler.rake @@ -0,0 +1,32 @@ +# This Source Code Form is subject to the terms of the Mozilla Public License, +# v. 2.0. If a copy of the MPL was not distributed with this file, You can +# obtain one at https://mozilla.org/MPL/2.0/. -} +# frozen_string_literal: true + +require 'rake/loaders/makefile' +require 'rake/clean' + +CLEAN.include 'build/gcc' + +Rake.application.add_loader('d', Rake::MakefileLoader.new) +FileList['build/gcc/**/*.d'].each { |file| import file } + +rule(/gcc\/.+\.o$/ => ->(file) { + source = Pathname.new('source') + + Pathname.new(file).relative_path_from('build/gcc').sub_ext('.elna') + + [source, 'build/host/install/bin/gelna'] +}) do |t| + Pathname.new(t.name).dirname.mkpath + + sh t.prerequisites.last, '-c', '-MD', '-MP', '-O0', '-g', '-I', 'source', '-o', t.name, t.source.to_s +end + +file 'build/gcc/elna' => FileList['source/**/*.elna'].reject { |file| + file != file.downcase +}.map { |file| + Pathname.new('build/gcc') + + Pathname.new(file).relative_path_from('source').sub_ext('.o') +} do |t| + sh 'build/host/install/bin/gcc', '-o', t.name, *t.prerequisites +end diff --git a/rakelib/doc.rake b/rakelib/doc.rake index 7838871..5f40107 100644 --- a/rakelib/doc.rake +++ b/rakelib/doc.rake @@ -3,7 +3,6 @@ # obtain one at https://mozilla.org/MPL/2.0/. # frozen_string_literal: true -require 'pathname' require 'rake/clean' CLEAN.include 'build/doc' diff --git a/rakelib/gcc.rake b/rakelib/gcc.rake index 30175eb..7ee9f5c 100644 --- a/rakelib/gcc.rake +++ b/rakelib/gcc.rake @@ -7,7 +7,6 @@ require 'fileutils' require 'uri' require 'net/http' require 'open3' -require 'pathname' # Use Homebrew GCC if available (it uses libstdc++, avoiding # macOS-specific libc++ incompatibilities in GCC's own sources). -- cgit v1.2.3