From dcdbe0f22a92a7b90fd4541fb2feaaae8a2d703a Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 21 Jan 2015 04:22:07 +0000 Subject: 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 --- ext/extmk.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ext') diff --git a/ext/extmk.rb b/ext/extmk.rb index a7eea62a27..98fd76ca68 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -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 -- cgit v1.2.3