Sha256: 3e4d09109bb6b26e3f1a720e298fe417c27dca2f8217959032e13699b5b26754

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

#!/usr/bin/env ruby

module Rake

  # Makefile loader to be used with the import file loader.
  class MakefileLoader

    # Load the makefile dependencies in +fn+.
    def load(fn)
      open(fn) do |mf|
        lines = mf.read
        lines.gsub!(/#[^\n]*\n/m, "")
        lines.gsub!(/\\\n/, ' ')
        lines.split("\n").each do |line|
          process_line(line)
        end
      end
    end

    private

    # Process one logical line of makefile data.
    def process_line(line)
      file_task, args = line.split(':')
      return if args.nil?
      file_task.strip!
      dependents = args.split
      file file_task => dependents
    end
  end

  # Install the handler
  Rake.application.add_loader('mf', MakefileLoader.new)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jimweirich-rake-0.8.1.6 lib/rake/loaders/makefile.rb