Class: Rake::MakefileLoader

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
Inherits: Object
Defined in: lib/rake/loaders/makefile.rb


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}"

import ".depends.mf"

See Importing Dependencies for further details.

Constant Summary

::FileUtils - Included


FileUtilsExt - Included


Instance Method Summary

DSL - Included


Describes the next rake task.


Declare a set of files tasks to create the given directories on demand.


Declare a file task.


Declare a file creation task.


Import the partial Rakefiles fn.


Declare a task that performs its prerequisites in parallel.


Create a new rake namespace and use it for evaluating the given block.


Declare a rule for auto-tasks.


Declare a basic task.

FileUtilsExt - Included


Get/set the nowrite flag controlling output from the ::FileUtils utilities.


Check that the options do not contain options not listed in optdecl.


Send the message to the default rake output (which is $stderr).


Get/set the verbose flag controlling output from the ::FileUtils utilities.


Use this function to prevent potentially destructive ruby code from running when the :nowrite flag is set.

::FileUtils - Included


Run a Ruby interpreter with the given arguments.


Attempt to do a normal file link, but fall back to a copy if the link fails.


Run the system command cmd.


Split a file path into individual directory names.

#create_shell_runner, #set_verbose_option, #sh_show_command

Instance Method Details


This method is for internal use only.

Load the makefile dependencies in fn.

[ GitHub ]

# File 'lib/rake/loaders/makefile.rb', line 24

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) (private)

This method is for internal use only.

Process one logical line of makefile data.

[ GitHub ]

# File 'lib/rake/loaders/makefile.rb', line 37

def process_line(line) # :nodoc:
  file_tasks, args = line.split(":", 2)
  return if args.nil?
  dependents = args.split.map { |d| respace(d) }
  file_tasks.scan(/\S+/) do |file_task|
    file_task = respace(file_task)
    file file_task => dependents

#respace(str) (private)

This method is for internal use only.
[ GitHub ]

# File 'lib/rake/loaders/makefile.rb', line 47

def respace(str) # :nodoc:
  str.tr SPACE_MARK, " "