summaryrefslogtreecommitdiff
path: root/defs/separated_version.mk
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-18 06:35:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-18 06:35:38 +0000
commit3ee370ae9c75ba81da5043051017e483ff234ee6 (patch)
tree3cfefd5b10d7cd699715424555c68748c55213cf /defs/separated_version.mk
parent79ca0925b4eebc2863c9d49ca2fac0ec753fe32b (diff)
separated_version.mk [ci skip]
* defs/separated_version.mk: FOR DEVELEPERS ONLY. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'defs/separated_version.mk')
-rw-r--r--defs/separated_version.mk38
1 files changed, 38 insertions, 0 deletions
diff --git a/defs/separated_version.mk b/defs/separated_version.mk
new file mode 100644
index 0000000..9211b11
--- /dev/null
+++ b/defs/separated_version.mk
@@ -0,0 +1,38 @@
+# ******** FOR DEVELEPERS ONLY ********
+# Separate version.o into a shared library which varies every
+# revisions, in order to make the rest sharable.
+
+include $(firstword $(wildcard GNUmakefile Makefile))
+
+ifneq ($(filter @executable_path/%,$(DLDFLAGS)),)
+RUBY_VERSION_SO = $(subst ruby,ruby_version,$(LIBRUBY_SO))
+RUBY_VERSION_DLDFLAGS := $(patsubst @executable_path/%/$(LIBRUBY_SO),@loader_path/$(RUBY_VERSION_SO),$(DLDFLAGS)) -exported_symbol=Init_version
+else ifneq ($(findstring -soname,$(DLDFLAGS)),)
+RUBY_VERSION_SO = $(subst ruby,ruby_version,$(LIBRUBY_SO))
+RUBY_VERSION_DLDFLAGS := $(subst ruby,ruby_version,$(DLDFLAGS))
+else
+ERROR
+endif
+
+ifneq ($(RUBY_VERSION_SO),)
+
+version.$(OBJEXT): XCFLAGS := $(subst -fvisibility=hidden,,$(XCFLAGS))
+
+MINIOBJS += version.$(OBJEXT)
+DLDOBJS += $(RUBY_VERSION_SO)
+LIBRUBYARG_SHARED := -lruby_version $(LIBRUBYARG_SHARED)
+$(LIBRUBY_SO): COMMONOBJS := $(filter-out version.$(OBJEXT),$(COMMONOBJS))
+$(LIBRUBY_A): COMMONOBJS := $(sort version.$(OBJEXT) $(COMMONOBJS))
+
+$(LIBRUBY_SO): $(RUBY_VERSION_SO)
+
+$(RUBY_VERSION_SO): version.$(OBJEXT)
+ $(ECHO) linking shared-library $@
+ $(LDSHARED) $(RUBY_VERSION_DLDFLAGS) -Wl,-rpath-link,'$${ORIGIN}' version.$(OBJEXT) $(OUTFLAG)$@
+ -$(Q) $(MINIRUBY) -e 'ARGV.each{|link|' \
+ -e 'File.delete link rescue nil' \
+ -e 'File.symlink "$(RUBY_VERSION_SO)", link' \
+ -e '}' \
+ $(subst ruby,ruby_version,$(LIBRUBY_ALIASES)) || true
+
+endif