Method: Buildable#initialize
- Defined in:
- lib/makeconf/buildable.rb
#initialize(options) ⇒ Buildable
Returns a new instance of Buildable.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/makeconf/buildable.rb', line 10 def initialize() raise ArgumentError unless .kind_of?(Hash) default = { :id => [:id], :enable => true, :buildable => true, :distributable => true, :installable => true, :extension => '', :cflags => [], :ldflags => [], :ldadd => [], :rpath => '', :topdir => '', :depends => [], } default.each do |k,v| instance_variable_set('@' + k.to_s, v) end @output = id @output_type = nil # filled in by the derived class # Local and system header dependencies for each @sources file # These are filled in by Compiler.makedepends() @localdep = {} @sysdep = {} # Filled in by sources=() @sources = [] @source_code = {} # Parse options # FIXME- consider adding support for: #%w{name enable distributable installable extension # topdir rpath} log.debug "Buildable options: " + .pretty_inspect .each do |k,v| log.debug "k=#{k} v=#{v.to_s}" case k when :id @id = v when :cc @cc = v.clone when :cflags @cflags = v @cflags = [ @cflags ] if @cflags.kind_of?(String) when :ldflags @ldflags = v when :ldadd @ldadd.push(v).flatten! when :project @project = v when :buildable @buildable = v when :sources v = [ v ] if v.kind_of?(String) @sources = v else throw "Unrecognized option -- #{k}: #{v}" end end log.debug "Buildable parsed as: " + self.pretty_inspect #FIXME: move some of these to the switch statement # # Parse simple textual child elements # %w{cflags ldflags ldadd depends sources}.each do |k| # instance_variable_set('@' + k, yaml[k]) if yaml.has_key? k # end end |