diff --git a/common.mk b/common.mk index 08bdd6bd32..0dfa2e4be9 100644 --- a/common.mk +++ b/common.mk @@ -211,8 +211,7 @@ exts: build-ext EXTS_MK = exts.mk $(EXTS_MK): ext/configure-ext.mk $(TIMESTAMPDIR)/.$(arch).time $(srcdir)/template/exts.mk.tmpl - $(MAKE) -f ext/configure-ext.mk V=$(V) MINIRUBY="$(MINIRUBY)" \ - EXTSTATIC=$(EXTSTATIC) \ + $(MAKE) -f ext/configure-ext.mk V=$(V) EXTSTATIC=$(EXTSTATIC) \ gnumake=$(gnumake) EXTLDFLAGS="$(EXTLDFLAGS)" srcdir="$(srcdir)" $(ECHO) generating makefile $@ $(Q)$(MINIRUBY) $(srcdir)/tool/generic_erb.rb -o $@ -c \ @@ -222,7 +221,8 @@ ext/configure-ext.mk: $(PREP) all-incs $(MKFILES) $(RBCONFIG) $(LIBRUBY) $(ECHO) generating makefiles $@ $(Q)$(MAKEDIRS) ext $(Q)$(MINIRUBY) $(srcdir)/tool/generic_erb.rb -o $@ -c \ - $(srcdir)/template/$(@F).tmpl --srcdir="$(srcdir)" + $(srcdir)/template/$(@F).tmpl --srcdir="$(srcdir)" \ + --miniruby="$(MINIRUBY)" --script-args='$(SCRIPT_ARGS)' configure-ext: $(EXTS_MK) diff --git a/template/configure-ext.mk.tmpl b/template/configure-ext.mk.tmpl index b8d4a67f7e..cf3f3b4e61 100644 --- a/template/configure-ext.mk.tmpl +++ b/template/configure-ext.mk.tmpl @@ -5,21 +5,25 @@ ECHO1 = $(V:1=@:) ECHO = $(ECHO1:0=@echo) <% -srcdir = miniruby = nil +srcdir = miniruby = script_args = nil opt = OptionParser.new do |o| o.on('--srcdir=SRCDIR') {|v| srcdir = v} o.on('--miniruby=MINIRUBY') {|v| miniruby = v} + o.on('--script-args=MINIRUBY') {|v| script_args = v} o.order!(ARGV) end srcdir ||= File.dirname(File.dirname(__FILE__)) exts = Dir.glob("#{srcdir}/ext/*/").map(&File.method(:basename)) %> +MINIRUBY = <%=miniruby%> +SCRIPT_ARGS = <%=script_args%> + all: % exts.each do |dir| all: ext/<%=dir%>/exts.mk ext/<%=dir%>/exts.mk: FORCE $(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make='$(MAKE)' --command-output=ext/<%=dir%>/exts.mk \ - --extension=<%=dir%> --extstatic $(EXTSTATIC) \ + $(SCRIPT_ARGS) --extension=<%=dir%> --extstatic $(EXTSTATIC) \ --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \ -- subconfigure % end