Class: Rake::MakefileLoader

Inherits:
Object
  • Object
show all
Includes:
DSL
Defined in:
lib/rake/loaders/makefile.rb

Overview

Makefile loader to be used with the import file loader. Use this to import dependencies from make dependency tools:

require 'rake/loaders/makefile'

file ".depends.mf" => [SRC_LIST] do |t|
  sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
end

import ".depends.mf"

See Importing Dependencies for further details.

Constant Summary collapse

SPACE_MARK =

:nodoc:

"\0"

Constants included from FileUtilsExt

FileUtilsExt::DEFAULT

Constants included from FileUtils

FileUtils::LN_SUPPORTED, FileUtils::RUBY

Instance Method Summary collapse

Methods included from FileUtilsExt

#nowrite, #rake_check_options, #rake_merge_option, #rake_output_message, #verbose, #when_writing

Methods included from FileUtils

#ruby, #safe_ln, #sh, #split_all

Instance Method Details

#load(fn) ⇒ Object

Load the makefile dependencies in fn.



23
24
25
26
27
28
29
30
31
# File 'lib/rake/loaders/makefile.rb', line 23

def load(fn) # :nodoc:
  lines = File.read fn
  lines.gsub!(/\\ /, SPACE_MARK)
  lines.gsub!(/#[^\n]*\n/m, "")
  lines.gsub!(/\\\n/, ' ')
  lines.each_line do |line|
    process_line(line)
  end
end