Class: Shog::Kconfig

Inherits:
Object show all
Defined in:
lib/rule/kconfig.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKconfig

Returns a new instance of Kconfig.



9
10
11
# File 'lib/rule/kconfig.rb', line 9

def initialize
  @ldflags = []
end

Class Method Details

.parse(file) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rule/kconfig.rb', line 26

def self.parse(file)
  config = {}
  for line in IO.readlines(file)
    next if line.start_with?("#")
    if line =~ /^CONFIG_(.*?)=(.*)$/
      key = $1.to_sym
      val = $2
      case val
      when "y" then val = true
      when /^\d+$/ then val = val.to_i
      when /^\"(.*)\"$/ then val = $1
      end
      config[key] = val
    end
  end
  config
end

Instance Method Details

#idObject



5
6
7
# File 'lib/rule/kconfig.rb', line 5

def id
  :kconfig
end

#ruleObject



13
14
15
16
17
18
# File 'lib/rule/kconfig.rb', line 13

def rule
  {
    "command" => "KCONFIG_CONFIG=$out conf --oldconfig -s $in",
    "description" => "Generate .config file",
  }
end

#target(params) ⇒ Object



20
21
22
23
24
# File 'lib/rule/kconfig.rb', line 20

def target(params)
  output = PathSet.new(Path.make(params[:output]))
  input = PathSet.new(Path.make(params[:input]))
  {:rule => "kconfig", :input => input, :output => output}
end