Class: Canoe::Compiler
Instance Attribute Summary collapse
Instance Method Summary
collapse
#issue_command, #run_command
Constructor Details
#initialize(name, compiling_flags, linking_flags) ⇒ Compiler
@name: String @flgs: Array of String
15
16
17
18
19
|
# File 'lib/compiler.rb', line 15
def initialize(name, compiling_flags, linking_flags)
@name = name
@linking_flags = linking_flags
@compiling_flags = compiling_flags
end
|
Instance Attribute Details
#flags ⇒ Object
Returns the value of attribute flags.
10
11
12
|
# File 'lib/compiler.rb', line 10
def flags
@flags
end
|
#name ⇒ Object
Returns the value of attribute name.
10
11
12
|
# File 'lib/compiler.rb', line 10
def name
@name
end
|
Instance Method Details
#append_compiling_flag(flag) ⇒ Object
29
30
31
|
# File 'lib/compiler.rb', line 29
def append_compiling_flag(flag)
@compiling_flags << flag
end
|
#append_linking_flag(flag) ⇒ Object
33
34
35
|
# File 'lib/compiler.rb', line 33
def append_linking_flag(flag)
@linking_flags << flag
end
|
#compile(src, out) ⇒ Object
37
38
39
|
# File 'lib/compiler.rb', line 37
def compile(src, out)
issue_command "#{name} -o #{out} #{compiling_flags_as_str} -c #{src}"
end
|
#compiling_flags_as_str ⇒ Object
21
22
23
|
# File 'lib/compiler.rb', line 21
def compiling_flags_as_str
@compiling_flags.join ' '
end
|
#link_executable(out, objs) ⇒ Object
41
42
43
|
# File 'lib/compiler.rb', line 41
def link_executable(out, objs)
issue_command "#{name} -o #{out} #{objs.join(' ')} #{linking_flags_as_str}"
end
|
#link_shared(out, objs) ⇒ Object
45
46
47
|
# File 'lib/compiler.rb', line 45
def link_shared(out, objs)
issue_command "#{name} -shared -o #{out}.so #{objs.join(' ')} #{linking_flags_as_str}"
end
|
#linking_flags_as_str ⇒ Object
25
26
27
|
# File 'lib/compiler.rb', line 25
def linking_flags_as_str
@linking_flags.join ' '
end
|