Parent

Methods

Makefile::Conditional

Attributes

append[RW]

Public Class Methods

new(lval) click to toggle source
# File lib/makeconf/makefile.rb, line 162
def initialize(lval)
  @lval = lval
  @append = [ 'CFLAGS', 'LDFLAGS', 'LDADD' ].include?(lval)
  @buf = []
end

Public Instance Methods

ifeq(condvar, conds) click to toggle source
# File lib/makeconf/makefile.rb, line 168
def ifeq(condvar, conds)
  check = conds.clone

  if @append == true
    op = '+= '
  else
    op = '='
  end

  default = nil
  if check.has_key?(:default)
    default = check[:default].clone
    check.delete :default
  end

  keys = check.keys.sort
  k0 = keys.shift
  @buf.push "ifeq (#{condvar},#{k0})"
  @buf.push "#{@lval}#{op}#{check[k0]}"
  keys.each do |k|
    @buf.push "else ifeq (#{condvar},#{k})"
    @buf.push "#{@lval}#{op}#{check[k]}"
  end
  unless default.nil? and default != ''
    @buf.push "else"
    @buf.push "#{@lval}#{op}#{default}"
  end
  @buf.push "endif"
  return self
end
to_make() click to toggle source
# File lib/makeconf/makefile.rb, line 199
def to_make
  s = "# Compute the conditional variable $(#{@lval})\n"
  @buf.each { |line| s += line + "\n" }
  s += "\n"
  s
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.