aboutsummaryrefslogtreecommitdiffstats
path: root/ext/-test-/auto_ext.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-29 03:08:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-29 03:08:45 +0000
commita9db53ef7732ca58c96a6ba0c7e88ab7ebe96dd6 (patch)
tree243c52fc6b4bde0a87e4ee7e16d2734902e9805e /ext/-test-/auto_ext.rb
parent0c409a1938b19480d279bf9ffded2eaaf84caabc (diff)
downloadruby-a9db53ef7732ca58c96a6ba0c7e88ab7ebe96dd6.tar.gz
auto_ext.rb
* ext/-test-/auto_ext.rb (auto_ext): utitily method to create extension libraries for tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/-test-/auto_ext.rb')
-rw-r--r--ext/-test-/auto_ext.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/-test-/auto_ext.rb b/ext/-test-/auto_ext.rb
new file mode 100644
index 0000000000..5f840c4841
--- /dev/null
+++ b/ext/-test-/auto_ext.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: false
+def auto_ext(feat = $0[%r[/ext/-test-/(.*)/extconf.rb\z], 1], inc: false)
+ $INCFLAGS << " -I$(topdir) -I$(top_srcdir)" if inc
+ $srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
+ inits = $srcs.map {|s| File.basename(s, ".*")}
+ inits.delete("init")
+ inits.map! {|s|"X(#{s})"}
+ $defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
+ create_makefile(feat)
+end