diff options
Diffstat (limited to 'template/exts.mk.tmpl')
-rw-r--r-- | template/exts.mk.tmpl | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/template/exts.mk.tmpl b/template/exts.mk.tmpl index 924abeb2fb..ac6b280188 100644 --- a/template/exts.mk.tmpl +++ b/template/exts.mk.tmpl @@ -19,18 +19,17 @@ opt = OptionParser.new do |o| o.on('--configure-exts=FILE') {|v| confexts = v} o.order!(ARGV) end -confexts &&= File.read(confexts).scan(/^exts: (.*\.mk)/).flatten rescue nil +confexts &&= File.read(confexts).scan(/^(?:ext|gem)s: (.*\.mk)/).flatten rescue nil confexts ||= [] macros["old_extensions"] = [] contpat = /(?>(?>[^\\\n]|\\.)*\\\n)*(?>[^\\\n]|\\.)*/ Dir.glob("{ext,.bundle/gems}/*/exts.mk") do |e| - gem = /\Agems(?=\/)/ =~ e + gem = e.start_with?(".bundle/gems/") s = File.read(e) - s.scan(/^(extensions|SUBMAKEOPTS|EXT[A-Z]+|MFLAGS|NOTE_[A-Z]+)[ \t]*=[ \t]*(#{contpat})$/o) do |n, v| + s.scan(/^(extensions|SUBMAKEOPTS|EXT[A-Z]+|MFLAGS|MESSAGE_(?:BEGIN|END)|NOTE_[A-Z]+)[ \t]*=[ \t]*(#{contpat})$/o) do |n, v| v.gsub!(/\\\n[ \t]*/, ' ') next if v.empty? - next if gem and n != "extensions" n = "old_extensions" if n == "extensions" and !confexts.include?(e) v = v.split m = macros[n] ||= [] @@ -70,6 +69,13 @@ Dir.glob("{ext,.bundle/gems}/*/exts.mk") do |e| end end deps.uniq! + +# NOTE: Only if extensions are configured as static and dynamic heterogeneously +# (e.g. --with-static-linked-ext=foo or ext/Setup can mix static and dynamic +# extensions), EXTOBJS may contain both extinit.o and dmyext.o. In such case, +# prefer extinit.o, which does actual Init_${ext} function calls for statically +# linked extensions, and drop dmyext.o, which does nothing but just to make the +# linker happy. if objs = macros["EXTOBJS"] and objs.any? {|e|e.start_with?("ext/extinit.")} objs.delete_if {|e|e.start_with?("dmyext.")} end @@ -133,7 +139,7 @@ distclean: % end libencs: - $(Q)$(MAKE)<%=mflags%> -f enc.mk V=$(V) $@ + $(Q)$(MAKE)<%=mflags%> -f enc.mk V=$(V) MINIRUBY="$(MINIRUBY)" $@ ext/extinit.<%=objext%>: $(Q)$(MAKE)<%=mflags%> V=$(V) EXTINITS="$(EXTINITS)" $@ @@ -155,8 +161,8 @@ ext/extinit.<%=objext%>: % end $(Q)<%= submake %><%=mflags%> V=$(V) $(@F) % if /^(dist|real)clean$/ =~ tgt - $(Q)$(RM) $(@D)/exts.mk - $(Q)$(RMDIRS) $(@D) + $(Q)$(RM) <%=t[%r[\A(?:\.[^/]+/)?(?:[^/]+/){2}]]%>exts.mk + -$(Q)$(RMDIRS) $(@D) % end % end % end |