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

Merge pull request #4571 from shuujii/consider--MP-flag-specified-when-parsing-.d-file

Consider `-MP` flag specified when parsing `.d` file
parents 15563713 66909dfe
......@@ -127,13 +127,40 @@ module MRuby
end
private
#
# === Example of +.d+ file
#
# ==== Without <tt>-MP</tt> compiler flag
#
# /build/host/src/array.o: \
# /src/array.c \
# /include/mruby/common.h \
# /include/mruby/value.h \
# /src/value_array.h
#
# ==== With <tt>-MP</tt> compiler flag
#
# /build/host/src/array.o: \
# /src/array.c \
# /include/mruby/common.h \
# /include/mruby/value.h \
# /src/value_array.h
#
# /include/mruby/common.h:
#
# /include/mruby/value.h:
#
# /src/value_array.h:
#
def get_dependencies(file)
file = file.ext('d') unless File.extname(file) == '.d'
deps = []
if File.exist?(file)
File.read(file).gsub("\\\n ", "").scan(/^\S+:\s+(.+)$/).flatten.map {|s| s.split(' ') }.flatten
else
[]
end + [ MRUBY_CONFIG ]
File.foreach(file){|line| deps << $1 if /^ +(.*?)(?: *\\)?$/ =~ line}
deps.uniq!
end
deps << MRUBY_CONFIG
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