Sha256: 355c8e2d15c38e3a8f4582d4280828eec219eeb9cdcc6343158ed934ba50b45a

Contents?: true

Size: 781 Bytes

Versions: 42

Compression:

Stored size: 781 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_tasks, args = line.split(':')
      return if args.nil?
      dependents = args.split
      file_tasks.strip.split.each do |file_task|
        file file_task => dependents
      end
    end
  end

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

Version data entries

42 entries across 42 versions & 6 rubygems

Version Path
elliottcable-echoe-3.1.1 vendor/rake/lib/rake/loaders/makefile.rb
elliottcable-echoe-3.1.2 vendor/rake/lib/rake/loaders/makefile.rb
jimweirich-rake-0.8.1.10 lib/rake/loaders/makefile.rb
jimweirich-rake-0.8.1.11 lib/rake/loaders/makefile.rb
jimweirich-rake-0.8.1.7 lib/rake/loaders/makefile.rb
jimweirich-rake-0.8.1.8 lib/rake/loaders/makefile.rb
jimweirich-rake-0.8.1.9 lib/rake/loaders/makefile.rb
jimweirich-rake-0.8.2.99 lib/rake/loaders/makefile.rb
jimweirich-rake-0.8.2 lib/rake/loaders/makefile.rb
jimweirich-rake-0.8.3.1 lib/rake/loaders/makefile.rb
jimweirich-rake-0.8.3 lib/rake/loaders/makefile.rb
shoesgem-0.1514.0 shoes/ruby/lib/rake/loaders/makefile.rb
shoesgem-0.1480.0 shoes/ruby/lib/rake/loaders/makefile.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/lib/rake/loaders/makefile.rb
shoesgem-0.1469.0 shoes/ruby/lib/rake/loaders/makefile.rb
shoesgem-0.1430.0 shoes/ruby/lib/rake/loaders/makefile.rb
shoesgem-0.1429.0 shoes/ruby/lib/rake/loaders/makefile.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/lib/rake/loaders/makefile.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rake-0.8.3/lib/rake/loaders/makefile.rb
shoesgem-0.1428.0 shoes/ruby/lib/rake/loaders/makefile.rb