summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-21 04:22:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-21 04:22:07 +0000
commitdcdbe0f22a92a7b90fd4541fb2feaaae8a2d703a (patch)
treef1c4ff888f504309ab49269030d427b99b971a49 /ext
parent4908827022c18d05fadaf54798fedd77452ef865 (diff)
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
Diffstat (limited to 'ext')
-rwxr-xr-xext/extmk.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/extmk.rb b/ext/extmk.rb
index a7eea62..98fd76c 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