Let sub-directory exts depend on their parent ext

* ext/extmk.rb: Let sub-directory exts depend on their parent ext.

* template/exts.mk.tmpl: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mrkn 2018-12-01 09:29:14 +00:00
Родитель d1f8694171
Коммит 5cae104e51
2 изменённых файлов: 26 добавлений и 6 удалений

Просмотреть файл

@ -722,7 +722,16 @@ begin
end
targets.each do |tgt|
exts.each do |d|
mf.puts "#{d[0..-2]}#{tgt}:\n\t$(Q)#{submake} $(MFLAGS) V=$(V) $(@F)"
d = d[0..-2]
t = "#{d}#{tgt}"
if /^(dist|real)?clean$/ =~ tgt
deps = exts.select {|e|e.start_with?(d)}.map {|e|"#{e[0..-2]}#{tgt}"} - [t]
pd = ' ' + deps.join(' ') unless deps.empty?
else
pext = File.dirname(d)
pd = " #{pext}/#{tgt}" if exts.include?("#{pext}/.")
end
mf.puts "#{t}:#{pd}\n\t$(Q)#{submake} $(MFLAGS) V=$(V) $(@F)"
end
end
mf.puts "\n""extso:\n"

Просмотреть файл

@ -128,14 +128,25 @@ libencs:
ext/extinit.<%=objext%>:
$(Q)$(MAKE)<%=mflags%> V=$(V) EXTINITS="$(EXTINITS)" $@
% targets.product(macros["extensions"].map {|e|e.chomp("/.")}) do |t, e|
<%=e%>/<%=t%>:
% if /^(dist|real)clean$/ =~ t
% exts = macros["extensions"].map {|e|e.chomp("/.")}.sort
% targets.each do |tgt|
% exts.each do |d|
% t = "#{d}/#{tgt}"
% if /^(dist|real)?clean$/ =~ tgt
% deps = exts.select {|e|e.start_with?("#{d}/")}.map {|e|"#{e}/#{tgt}"}
% pd = ' ' + deps.join(' ') unless deps.empty?
% else
% pext = File.dirname(d)
% pd = " #{pext}/#{tgt}" if exts.include?(pext)
% end
<%=t%>:<%=pd%>
% if /^(dist|real)clean$/ =~ tgt
$(ECHO) $(@F)ing $(@D)
% end
% end
$(Q)<%= submake %><%=mflags%> V=$(V) $(@F)
% if /^(dist|real)clean$/ =~ t
% if /^(dist|real)clean$/ =~ tgt
$(Q)$(RMDIRS) $(@D)
% end
% end
% end