class Rake::MakefileLoader
Makefile loader to be used with the import file loader.
Public Instance Methods
load(fn)
click to toggle source
Load the makefile dependencies in fn
.
# File lib/ceedling/makefile.rb, line 13 def load(fn) open(fn) do |mf| lines = mf.read lines.gsub!(/#[^\n]*\n/m, "") # remove comments lines.gsub!(/\\\n/, ' ') # string together line continuations into single line lines.split("\n").each do |line| process_line(line) end end end
Private Instance Methods
process_line(line)
click to toggle source
Process one logical line of makefile data.
# File lib/ceedling/makefile.rb, line 27 def process_line(line) # split on presence of task demaractor followed by space (i.e don't get confused by a colon in a win path) file_tasks, args = line.split(/:\s/) return if args.nil? # split at non-escaped space boundary between files (i.e. escaped spaces in paths are left alone) dependents = args.split(/\b\s+/) # replace escaped spaces and clean up any extra whitespace dependents.map! { |path| path.gsub(/\\ /, ' ').strip } file_tasks.strip.split.each do |file_task| file file_task => dependents end end