Unverified Commit 9757616c authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #5079 from wataash/fix-dep-parse

Fix *.d parsing with gcc 9.3.0
parents 5bfb70e9 e8723a4f
...@@ -139,6 +139,15 @@ module MRuby ...@@ -139,6 +139,15 @@ module MRuby
# /include/mruby/value.h \ # /include/mruby/value.h \
# /src/value_array.h # /src/value_array.h
# #
# ==== Without <tt>-MP</tt> compiler flag (gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0)
#
# /build/host/src/array.o: /src/array.c \
# /include/mruby.h /include/mrbconf.h \
# /include/mruby/common.h \
# ...
# /include/mruby/range.h \
# /src/value_array.h
#
# ==== With <tt>-MP</tt> compiler flag # ==== With <tt>-MP</tt> compiler flag
# #
# /build/host/src/array.o: \ # /build/host/src/array.o: \
...@@ -155,11 +164,18 @@ module MRuby ...@@ -155,11 +164,18 @@ module MRuby
# #
def get_dependencies(file) def get_dependencies(file)
file = file.ext('d') unless File.extname(file) == '.d' file = file.ext('d') unless File.extname(file) == '.d'
deps = [] return [MRUBY_CONFIG] unless File.exist?(file)
if File.exist?(file)
File.foreach(file){|line| deps << $1 if /^ +(.*?)(?: *\\)?$/ =~ line} deps = "".gsub("\\\n ", "").split("\n").map do |dep_line|
deps.uniq! # dep_line:
end # - "/build/host/src/array.o: /src/array.c /include/mruby/common.h ..."
# - ""
# - "/include/mruby/common.h:"
dep_line.scan(/^\S+:\s+(.+)$/).flatten.map { |s| s.split(' ') }.flatten
# => ["/src/array.c", "/include/mruby/common.h" , ...]
# []
# []
end.flatten.uniq
deps << MRUBY_CONFIG deps << MRUBY_CONFIG
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment