class Shog::Kconfig

Public Class Methods

new() click to toggle source
# File lib/rule/kconfig.rb, line 9
def initialize
  @ldflags = []
end
parse(file) click to toggle source
# 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

Public Instance Methods

id() click to toggle source
# File lib/rule/kconfig.rb, line 5
def id
  :kconfig
end
rule() click to toggle source
# File lib/rule/kconfig.rb, line 13
def rule
  {
    "command" => "KCONFIG_CONFIG=$out conf --oldconfig -s $in",
    "description" => "Generate .config file",
  }
end
target(params) click to toggle source
# 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