6 ECHO = $(ECHO1:0=@echo)
9 srcdir = miniruby = script_args = nil
10 opt = OptionParser.new do |o|
11 o.on('--srcdir=SRCDIR') {|v| srcdir = v}
12 o.on('--miniruby=MINIRUBY') {|v| miniruby = v}
13 o.on('--script-args=MINIRUBY') {|v| script_args = v}
16 srcdir ||= File.dirname(File.dirname(__FILE__))
19 ["exts", "ext", "--extstatic $(EXTSTATIC)"],
20 ["gems", ".bundle/gems", "--no-extstatic"],
22 exts[t] = [o, Dir.glob("#{srcdir}/#{d}/*/").map {|n| n[(srcdir.size+1)..-2]}]
25 MINIRUBY = <%=miniruby%>
26 SCRIPT_ARGS = <%=script_args.gsub("#", "\\#")%>
27 EXTMK_ARGS = $(SCRIPT_ARGS) --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
28 --make-flags="MINIRUBY='$(MINIRUBY)'"
34 % exts.each do |t, (o, dirs)|
36 % next if Dir.glob("#{srcdir}/#{d}/**/extconf.rb").empty?
37 <%=t%>: <%=d%>/exts.mk
39 $(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make='$(MAKE)' \
40 --command-output=$@ $(EXTMK_ARGS) <%=o%> \
45 .PHONY: FORCE all exts gems