method
depend_rules
v1_9_3_125 -
Show latest stable
- Class:
Object
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 1764
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 Related methods
- Instance methods
- !~
- <=>
- ===
- =~
- CSV
- DelegateClass
- Digest
- __getobj__
- __setobj__
- check_signedness
- check_sizeof
- chmod
- class
- clone
- convertible_int
- cp
- create_header
- create_makefile
- dclone
- default_src_encoding
- define_singleton_method
- depend_rules
- dir_config
- display
- dummy_makefile
- dup
- enable_config
- enum_for
- eql?
- extend
- find_executable
- find_header
- find_library
- find_type
- freeze
- frozen?
- hash
- have_const
- have_framework
- have_func
- have_header
- have_library
- have_macro
- have_struct_member
- have_type
- have_var
- help
- httpd
- initialize_clone
- initialize_copy
- initialize_dup
- inspect
- install
- instance_of?
- instance_variable_defined?
- instance_variable_get
- instance_variable_set
- instance_variables
- is_a?
- kind_of?
- ln
- method
- mkdir
- mkmf
- mv
- nil?
- object_id
- pretty_print
- pretty_print_cycle
- psych_to_yaml
- public_method
- public_send
- respond_to?
- respond_to_missing?
- rm
- rmdir
- send
- setup
- singleton_class
- singleton_methods
- sysread
- taint
- tainted?
- tap
- timeout
- to_enum
- to_s
- to_yaml
- to_yaml_properties
- touch
- trust
- try_const
- try_type
- untaint
- untrust
- untrusted?
- wait_writable
- with_config
- xmp
- Class methods
- yaml_tag
- Private methods
-
remove_instance_variable