extmk.rb: extract CLEANFILES and DISTCLEANFILES

* ext/extmk.rb (extract_makefile): extract CLEANFILES and
  DISTCLEANFILES regardless previous configration succeeded, as
  ext/tk/extconf.rb makes config_list file always.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-01-21 04:22:07 +00:00
Родитель 4908827022
Коммит dcdbe0f22a
1 изменённых файлов: 4 добавлений и 3 удалений

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

@ -83,6 +83,8 @@ end
def extract_makefile(makefile, keep = true)
m = File.read(makefile)
s = m[/^CLEANFILES[ \t]*=[ \t](.*)/, 1] and $cleanfiles = s.split
s = m[/^DISTCLEANFILES[ \t]*=[ \t](.*)/, 1] and $distcleanfiles = s.split
if !(target = m[/^TARGET[ \t]*=[ \t]*(\S*)/, 1])
return keep
end
@ -127,7 +129,6 @@ def extract_makefile(makefile, keep = true)
end
$objs = (m[/^OBJS[ \t]*=[ \t](.*)/, 1] || "").split
$srcs = (m[/^SRCS[ \t]*=[ \t](.*)/, 1] || "").split
$distcleanfiles = (m[/^DISTCLEANFILES[ \t]*=[ \t](.*)/, 1] || "").split
$LOCAL_LIBS = m[/^LOCAL_LIBS[ \t]*=[ \t]*(.*)/, 1] || ""
$LIBPATH = Shellwords.shellwords(m[/^libpath[ \t]*=[ \t]*(.*)/, 1] || "") - %w[$(libdir) $(topdir)]
true
@ -201,7 +202,7 @@ def extmake(target)
$extconf_h = nil
ok &&= extract_makefile(makefile)
old_objs = $objs
old_cleanfiles = $distcleanfiles
old_cleanfiles = $distcleanfiles | $cleanfiles
conf = ["#{$srcdir}/makefile.rb", "#{$srcdir}/extconf.rb"].find {|f| File.exist?(f)}
if (!ok || ($extconf_h && !File.exist?($extconf_h)) ||
!(t = modified?(makefile, MTIMES)) ||
@ -274,7 +275,7 @@ def extmake(target)
args += ["static"] unless $clean
$extlist.push [$static, target, $target, $preload]
end
FileUtils.rm_f(old_cleanfiles - $distcleanfiles)
FileUtils.rm_f(old_cleanfiles - $distcleanfiles - $cleanfiles)
FileUtils.rm_f(old_objs - $objs)
unless $configure_only or system($make, *args)
$ignore or $continue or return false