Module: Gaudi::ToolOperations

Included in:
Commandlines, Gaudi::Tasks::Build
Defined in:
lib/gaudi/helpers/operations.rb

Overview

Methods for creating and managing tool command lines

Instance Method Summary collapse

Instance Method Details

#assembler_options(src, component, system_config) ⇒ Object

Returns the assembler command line options merging the options from all cofniguration files


58
59
60
61
62
63
64
65
# File 'lib/gaudi/helpers/operations.rb', line 58

def assembler_options src,component,system_config
  config=system_config.platform_config(component.platform)
  output=object_file(src,component,system_config)
  opts= config['assembler_options'].split(' ')
  opts<< "#{config['assembler_out']}#{output}"
  opts+= prefixed_objects(component.include_paths,config['assembler_include'])
  opts<< src
end

#command_line(cmd, cmdfile, prefix) ⇒ Object

returns the commandline for cmd as an Array


92
93
94
95
96
97
98
99
100
# File 'lib/gaudi/helpers/operations.rb', line 92

def command_line cmd,cmdfile,prefix
  cmdline= [cmd]
  if prefix && !prefix.empty?
    cmdline<< "#{prefix}#{cmdfile}"
  else
    cmdline+= File.readlines(cmdfile).map{|l| l.strip}
  end
  cmdline
end

#compiler_options(src, component, system_config) ⇒ Object

Returns the compiler command line options merging the options from all cofniguration files


47
48
49
50
51
52
53
54
55
# File 'lib/gaudi/helpers/operations.rb', line 47

def compiler_options src,component,system_config
  config=system_config.platform_config(component.platform)
  output=object_file(src,component,system_config)
  extended_opts="compiler_options_#{src.pathmap('%x')}"
  opts= config.fetch("compiler_options_#{src.pathmap('%x')}",config.fetch("compiler_options","")).split(' ')
  opts+= prefixed_objects(component.include_paths,config['compiler_include'])
  opts<< "#{config['compiler_out']}\"#{output}\""
  opts<< src
end

#librarian_options(component, system_config) ⇒ Object

Returns the librarian command line options merging the options from all cofniguration files


68
69
70
71
72
73
74
75
76
# File 'lib/gaudi/helpers/operations.rb', line 68

def librarian_options component,system_config
  config=system_config.platform_config(component.platform)
  options= config['library_options'].split(' ')
  #output file
  options<< "#{config['library_out']}#{library(component,system_config)}"
  #add the object files
  objects=component.sources.map{|src| object_file(src,component,system_config)}
  options+=prefixed_objects(objects,config['library_in'])
end

#linker_options(component, system_config) ⇒ Object

Returns the linker command line options merging the options from all configuration files


79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/gaudi/helpers/operations.rb', line 79

def linker_options component,system_config
  config=system_config.platform_config(component.platform)
  options= config.fetch('linker_options','').split(' ')
  options<< "#{config['linker_out']}\"#{executable(component,system_config)}\""
  objects=component.sources.map{|src| object_file(src,component,system_config)}
  component.dependencies.each{|dep| objects+=dep.sources.map{|src| object_file(src,dep,system_config)}}
  objects.uniq!
  options+= prefixed_objects(objects,config["linker_in"])
  shared_libs=component.shared_dependencies.map{|dep| library(dep,system_config)}
  options+= prefixed_objects(shared_libs,config["linker_shared"]) 
  options+= prefixed_objects(component.external_libraries,config["linker_lib"])
end

#prefixed_objects(objects, prefix_flag) ⇒ Object

adds a prefix to a list of filenames/objects


102
103
104
# File 'lib/gaudi/helpers/operations.rb', line 102

def prefixed_objects objects,prefix_flag
  objects.map{|lo| "#{prefix_flag}#{lo}"}
end