[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / defs / separated_version.mk
blob72ee093da73663717c99c78031679b2320c55799
1 # ******** FOR DEVELEPERS ONLY ********
2 # Separate version.o into a shared library which varies every
3 # revisions, in order to make the rest shareable.
5 include $(firstword $(wildcard GNUmakefile Makefile))
7 ifneq ($(filter @executable_path/%,$(DLDFLAGS)),)
8 RUBY_VERSION_SO = $(subst ruby,ruby_version,$(LIBRUBY_SO))
9 RUBY_VERSION_DLDFLAGS := $(patsubst @executable_path/%/$(LIBRUBY_SO),@loader_path/$(RUBY_VERSION_SO),$(DLDFLAGS)) -exported_symbol=Init_version
10 else ifneq ($(findstring -soname,$(DLDFLAGS)),)
11 RUBY_VERSION_SO = $(subst ruby,ruby_version,$(LIBRUBY_SO))
12 RUBY_VERSION_DLDFLAGS := $(subst ruby,ruby_version,$(DLDFLAGS)) -Wl,-rpath-link,'$${ORIGIN}'
13 else
14 ERROR
15 endif
17 ifneq ($(RUBY_VERSION_SO),)
19 version.$(OBJEXT): XCFLAGS := $(subst -fvisibility=hidden,,$(XCFLAGS))
21 MINIOBJS += version.$(OBJEXT)
22 DLDOBJS += $(RUBY_VERSION_SO)
23 LIBRUBYARG_SHARED := -lruby_version $(LIBRUBYARG_SHARED)
24 $(LIBRUBY_SO): COMMONOBJS := $(filter-out version.$(OBJEXT),$(COMMONOBJS))
25 $(LIBRUBY_A): COMMONOBJS := $(sort version.$(OBJEXT) $(COMMONOBJS))
27 $(LIBRUBY_SO): $(RUBY_VERSION_SO)
29 $(RUBY_VERSION_SO): version.$(OBJEXT)
30 $(ECHO) linking shared-library $@
31 $(LDSHARED) $(RUBY_VERSION_DLDFLAGS) version.$(OBJEXT) $(OUTFLAG)$@
32 -$(Q) $(MINIRUBY) -e 'ARGV.each{|link|' \
33 -e 'File.delete link rescue nil' \
34 -e 'File.symlink "$(RUBY_VERSION_SO)", link' \
35 -e '}' \
36 $(subst ruby,ruby_version,$(LIBRUBY_ALIASES)) || true
38 endif