mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* tool/update-deps: Support GNU Make 4.0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8ef4bdcddc
commit
a73d8cd103
2 changed files with 38 additions and 14 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Fri Nov 14 17:36:48 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* tool/update-deps: Support GNU Make 4.0.
|
||||||
|
|
||||||
Fri Nov 14 16:59:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Nov 14 16:59:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* gc.c (default_proc_for_compat_func): check arguments number and
|
* gc.c (default_proc_for_compat_func): check arguments number and
|
||||||
|
|
|
@ -21,26 +21,42 @@ def read_make_deps(cwd)
|
||||||
dependencies = {}
|
dependencies = {}
|
||||||
make_p = `make -p all miniruby ruby golf 2> /dev/null`
|
make_p = `make -p all miniruby ruby golf 2> /dev/null`
|
||||||
dirstack = [cwd]
|
dirstack = [cwd]
|
||||||
make_p.scan(%r{Entering directory `(.*)'|Leaving directory `(.*)'|^([/0-9a-zA-Z._-]+):(.*)}) {
|
curdir = nil
|
||||||
if $1
|
make_p.scan(%r{Entering directory ['`](.*)'|^\# (GNU Make) |^CURDIR := (.*)|^([/0-9a-zA-Z._-]+):(.*)|^# (Finished Make data base on) |Leaving directory ['`](.*)'}) {
|
||||||
enter_dir = Pathname($1)
|
directory_enter = $1
|
||||||
|
data_base_start = $2
|
||||||
|
data_base_curdir = $3
|
||||||
|
rule_target = $4
|
||||||
|
rule_sources = $5
|
||||||
|
data_base_end = $6
|
||||||
|
directory_leave = $7
|
||||||
|
#p $~
|
||||||
|
if directory_enter
|
||||||
|
enter_dir = Pathname(directory_enter)
|
||||||
#p [:enter, enter_dir]
|
#p [:enter, enter_dir]
|
||||||
dirstack.push enter_dir
|
dirstack.push enter_dir
|
||||||
elsif $2
|
elsif data_base_start
|
||||||
leave_dir = Pathname($2)
|
curdir = nil
|
||||||
|
elsif data_base_curdir
|
||||||
|
curdir = Pathname(data_base_curdir)
|
||||||
|
elsif rule_target && rule_sources
|
||||||
|
target = rule_target
|
||||||
|
deps = rule_sources
|
||||||
|
deps = deps.scan(%r{[/0-9a-zA-Z._-]+})
|
||||||
|
next if /\.o\z/ !~ target.to_s
|
||||||
|
next if /\A\./ =~ target.to_s # skip rules such as ".c.o"
|
||||||
|
#p [curdir, target, deps]
|
||||||
|
dependencies[(curdir||dirstack.last) + target] ||= []
|
||||||
|
dependencies[(curdir||dirstack.last) + target] |= deps.map {|dep| (curdir||dirstack.last) + dep }
|
||||||
|
elsif data_base_end
|
||||||
|
curdir = nil
|
||||||
|
elsif directory_leave
|
||||||
|
leave_dir = Pathname(directory_leave)
|
||||||
#p [:leave, leave_dir]
|
#p [:leave, leave_dir]
|
||||||
if leave_dir != dirstack.last
|
if leave_dir != dirstack.last
|
||||||
warn "unexpected leave_dir : #{dirstack.last.inspect} != #{leave_dir.inspect}"
|
warn "unexpected leave_dir : #{dirstack.last.inspect} != #{leave_dir.inspect}"
|
||||||
end
|
end
|
||||||
dirstack.pop
|
dirstack.pop
|
||||||
else
|
|
||||||
target = $3
|
|
||||||
deps = $4
|
|
||||||
deps = deps.scan(%r{[/0-9a-zA-Z._-]+})
|
|
||||||
next if /\.o\z/ !~ target.to_s
|
|
||||||
next if /\A\./ =~ target.to_s # skip rules such as ".c.o"
|
|
||||||
dependencies[dirstack.last + target] ||= []
|
|
||||||
dependencies[dirstack.last + target] |= deps.map {|dep| dirstack.last + dep }
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
dependencies
|
dependencies
|
||||||
|
@ -106,7 +122,10 @@ def concentrate(dependencies, cwd)
|
||||||
dependencies.keys.sort.each {|target|
|
dependencies.keys.sort.each {|target|
|
||||||
sources = dependencies[target]
|
sources = dependencies[target]
|
||||||
target = target.relative_path_from(cwd)
|
target = target.relative_path_from(cwd)
|
||||||
sources = sources.map {|s| s.relative_path_from(cwd) }
|
sources = sources.map {|s|
|
||||||
|
rel = s.relative_path_from(cwd)
|
||||||
|
rel
|
||||||
|
}
|
||||||
if %r{\A\.\.(/|\z)} =~ target.to_s
|
if %r{\A\.\.(/|\z)} =~ target.to_s
|
||||||
warn "out of tree target: #{target}"
|
warn "out of tree target: #{target}"
|
||||||
next
|
next
|
||||||
|
@ -146,6 +165,7 @@ end
|
||||||
def main
|
def main
|
||||||
cwd = Pathname.pwd
|
cwd = Pathname.pwd
|
||||||
make_deps = read_make_deps(cwd)
|
make_deps = read_make_deps(cwd)
|
||||||
|
#pp make_deps
|
||||||
make_deps = concentrate(make_deps, cwd)
|
make_deps = concentrate(make_deps, cwd)
|
||||||
#pp make_deps
|
#pp make_deps
|
||||||
actual_deps = read_actual_deps(cwd)
|
actual_deps = read_actual_deps(cwd)
|
||||||
|
|
Loading…
Reference in a new issue