class Build::Makefile

This parser parses just enough to correctly process dependency files generated by compilers.

Constants

VERSION

Attributes

rules[R]

Public Class Methods

load_file(path) click to toggle source
# File lib/build/makefile.rb, line 50
def self.load_file(path)
        input = File.read(path)

        self.parse(input)
end
new(rules) click to toggle source
# File lib/build/makefile.rb, line 30
def initialize(rules)
        @rules = rules
end
parse(string) click to toggle source
# File lib/build/makefile.rb, line 94
def self.parse(string)
        scanner = StringScanner.new(string)

        dependencies = {}
        Parser::parse(scanner) do |statement|
                if statement[0] == :rule
                        dependencies[statement[1]] = statement[2]
                end
        end

        self.new(dependencies)
end

Public Instance Methods

[](target) click to toggle source
# File lib/build/makefile.rb, line 36
def [] target
        dependencies = @rules[target.relative_path]
        
        if dependencies
                Files::Paths.new(
                        dependencies.collect{|dep| Files::Path.new(dep).to_absolute(target.root)}
                )
        end
end
include?(target) click to toggle source
# File lib/build/makefile.rb, line 46
def include? target
        @rules.include? target
end