Class: Rubex::CompilerConfig
- Inherits:
-
Object
- Object
- Rubex::CompilerConfig
- Defined in:
- lib/rubex/compiler_config.rb
Overview
Class for storing configuration of the compiler (gcc) that will compile
the generated C code. This includes file names, compiler flags and other
options required by Rubex.
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#objs ⇒ Object
Returns the value of attribute objs.
-
#srcs ⇒ Object
Returns the value of attribute srcs.
Instance Method Summary collapse
-
#add_dep(file_name) ⇒ Object
add dependency on file so extconf will recognise it.
- #add_link(link_str) ⇒ Object
- #flush ⇒ Object
-
#initialize ⇒ CompilerConfig
constructor
A new instance of CompilerConfig.
- #link_flags ⇒ Object
Constructor Details
#initialize ⇒ CompilerConfig
Returns a new instance of CompilerConfig.
8 9 10 11 12 |
# File 'lib/rubex/compiler_config.rb', line 8 def initialize @links = [] @srcs = [] @objs = [] end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
6 7 8 |
# File 'lib/rubex/compiler_config.rb', line 6 def debug @debug end |
#objs ⇒ Object
Returns the value of attribute objs.
6 7 8 |
# File 'lib/rubex/compiler_config.rb', line 6 def objs @objs end |
#srcs ⇒ Object
Returns the value of attribute srcs.
6 7 8 |
# File 'lib/rubex/compiler_config.rb', line 6 def srcs @srcs end |
Instance Method Details
#add_dep(file_name) ⇒ Object
add dependency on file so extconf will recognise it.
29 30 31 32 |
# File 'lib/rubex/compiler_config.rb', line 29 def add_dep(file_name) @srcs << "#{file_name}.c" @objs << "#{file_name}.o" end |
#add_link(link_str) ⇒ Object
14 15 16 |
# File 'lib/rubex/compiler_config.rb', line 14 def add_link link_str @links << link_str end |
#flush ⇒ Object
22 23 24 25 26 |
# File 'lib/rubex/compiler_config.rb', line 22 def flush @links = [] @srcs = [] @objs = [] end |
#link_flags ⇒ Object
18 19 20 |
# File 'lib/rubex/compiler_config.rb', line 18 def link_flags @links.map { |l| l.dup.prepend('-l') }.join(' ') end |