APIdock / Ruby
/
method

depend_rules

ruby latest stable - Class: Object

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1_9_3_392) is shown here.

depend_rules(depend)
public

Processes the data contents of the "depend" file. Each line of this file is expected to be a file name.

Returns the output of findings, in Makefile format.

# File lib/mkmf.rb, line 1772
def depend_rules(depend)
 suffixes = []
 depout = []
 cont = implicit = nil
 impconv = proc do
 COMPILE_RULES.each {|rule| depout << (rule % implicit[0]) << implicit[1]}
 implicit = nil
 end
 ruleconv = proc do |line|
 if implicit
 if /\A\t/ =~ line
 implicit[1] << line
 next
 else
 impconv[]
 end
 end
 if m = /\A\.(\w+)\.(\w+)(?:\s*:)/.match(line)
 suffixes << m[1] << m[2]
 implicit = [[m[1], m[2]], [m.post_match]]
 next
 elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
 line.gsub!(%(\s)(?!\.)([^$(){}+=:\s\/\,円]+)(?=\s|\z)") {1ドル + RULE_SUBST % 2ドル}
 end
 depout << line
 end
 depend.each_line do |line|
 line.gsub!(/\.o\b/, ".#{$OBJEXT}")
 line.gsub!(/\$\((?:hdr|top)dir\)\/config.h/, $config_h)
 line.gsub!(%\$\(hdrdir\)/(?!ruby(?![^:;/\s]))(?=[-\w]+\.h)", '\&ruby/')
 if $nmake && /\A\s*\$\(RM|COPY\)/ =~ line
 line.gsub!(%[-\w\./]{2,}"){$&.tr("/", "\\")}
 line.gsub!(/(\$\((?!RM|COPY)[^:)]+)(?=\))/, '1円:/=\')
 end
 if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
 (cont ||= []) << line
 next
 elsif cont
 line = (cont << line).join
 cont = nil
 end
 ruleconv.call(line)
 end
 if cont
 ruleconv.call(cont.join)
 elsif implicit
 impconv.call
 end
 unless suffixes.empty?
 depout.unshift(".SUFFIXES: ." + suffixes.uniq.join(" .") + "\n\n")
 end
 depout.unshift("$(OBJS): $(RUBY_EXTCONF_H)\n\n") if $extconf_h
 depout.flatten!
 depout
end

AltStyle によって変換されたページ (->オリジナル) /