Move assembly into the arch directory
This commit is contained in:
17
Rakefile
17
Rakefile
@@ -324,14 +324,19 @@ def relative_from_tmp(path)
|
||||
Pathname.new(path).relative_path_from(TMP).each_filename
|
||||
end
|
||||
|
||||
def architecture_instruction_set(architecture)
|
||||
architecture.gsub /[[:digit:]]+$/, ''
|
||||
end
|
||||
|
||||
CLEAN.include(TMP + 'riscv32')
|
||||
directory(TMP + 'riscv32')
|
||||
|
||||
rule '.s.o' => ->(match) {
|
||||
architecture, *path_components = relative_from_tmp(match).to_a
|
||||
path_components[-1] = path_components.last.ext('')
|
||||
instruction_set = architecture_instruction_set architecture
|
||||
|
||||
[File.join(path_components), TMP + architecture]
|
||||
[File.join('arch', instruction_set, path_components), TMP + architecture]
|
||||
} do |t|
|
||||
options = BuildTarget.new relative_from_tmp(t.name).first
|
||||
compiler = options.rootfs + "bin/#{options.target}-gcc"
|
||||
@@ -356,9 +361,15 @@ rule '.elna.o' => ->(match) {
|
||||
end
|
||||
|
||||
rule 'kernel.elf' => ->(match) {
|
||||
architecture_tmp = TMP + relative_from_tmp(match).first
|
||||
architecture = relative_from_tmp(match).first
|
||||
instruction_set = architecture_instruction_set architecture
|
||||
|
||||
FileList['*.s', '*.elna'].map { |source| (architecture_tmp + source).to_path + '.o' } << 'kernel.ld'
|
||||
arch_objects = FileList["arch/#{instruction_set}/*.s"]
|
||||
.map { |source| Pathname.new(source).relative_path_from("arch/#{instruction_set}").sub_ext('.s.o') }
|
||||
.map { |source| TMP + architecture + source }
|
||||
.map(&:to_path)
|
||||
|
||||
arch_objects + FileList['*.elna'].map { |source| (TMP + architecture + source).to_path + '.o' } << 'kernel.ld'
|
||||
} do |t|
|
||||
options = BuildTarget.new relative_from_tmp(t.name).first
|
||||
compiler = options.rootfs + "bin/#{options.target}-gcc"
|
||||
|
Reference in New Issue
Block a user