2017-01-22 21:50:23 -05:00
|
|
|
V = 0
|
|
|
|
Q1 = $(V:1=)
|
|
|
|
Q = $(Q1:0=@)
|
|
|
|
ECHO1 = $(V:1=@:)
|
|
|
|
ECHO = $(ECHO1:0=@echo)
|
|
|
|
|
|
|
|
<%
|
2017-01-22 23:22:23 -05:00
|
|
|
srcdir = miniruby = script_args = nil
|
2017-01-22 21:50:23 -05:00
|
|
|
opt = OptionParser.new do |o|
|
|
|
|
o.on('--srcdir=SRCDIR') {|v| srcdir = v}
|
|
|
|
o.on('--miniruby=MINIRUBY') {|v| miniruby = v}
|
2017-01-22 23:22:23 -05:00
|
|
|
o.on('--script-args=MINIRUBY') {|v| script_args = v}
|
2017-01-22 21:50:23 -05:00
|
|
|
o.order!(ARGV)
|
|
|
|
end
|
|
|
|
srcdir ||= File.dirname(File.dirname(__FILE__))
|
2017-01-26 03:19:34 -05:00
|
|
|
exts = {}
|
2017-01-28 00:02:41 -05:00
|
|
|
[
|
|
|
|
["exts", "ext", "--extstatic $(EXTSTATIC)"],
|
|
|
|
["gems", "gems", "--no-extstatic"],
|
|
|
|
].each do |t, dir, opt|
|
|
|
|
exts[t] = [opt, Dir.glob("#{srcdir}/#{dir}/*/").map {|n| n[(srcdir.size+1)..-2]}]
|
2017-01-26 03:19:34 -05:00
|
|
|
end
|
2017-01-22 21:50:23 -05:00
|
|
|
%>
|
2017-01-22 23:22:23 -05:00
|
|
|
MINIRUBY = <%=miniruby%>
|
|
|
|
SCRIPT_ARGS = <%=script_args%>
|
2017-01-28 00:02:41 -05:00
|
|
|
EXTMK_ARGS = $(SCRIPT_ARGS) --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
|
2017-03-03 01:22:47 -05:00
|
|
|
--make-flags='MINIRUBY=$(MINIRUBY)'
|
2017-01-26 03:19:34 -05:00
|
|
|
|
|
|
|
all: exts gems
|
|
|
|
exts:
|
|
|
|
gems:
|
2017-01-22 23:22:23 -05:00
|
|
|
|
2017-01-28 00:02:41 -05:00
|
|
|
% exts.each do |t, (opt, dirs)|
|
2017-01-26 03:19:34 -05:00
|
|
|
% dirs.each do |dir|
|
|
|
|
<%=t%>: <%=dir%>/exts.mk
|
|
|
|
<%=dir%>/exts.mk: FORCE
|
|
|
|
$(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make='$(MAKE)' \
|
2017-01-28 00:02:41 -05:00
|
|
|
--command-output=$@ $(EXTMK_ARGS) <%=opt%> \
|
2017-01-28 00:31:25 -05:00
|
|
|
-- configure $(@D)
|
2017-01-26 03:19:34 -05:00
|
|
|
% end
|
2017-01-22 21:50:23 -05:00
|
|
|
% end
|
|
|
|
|
2017-01-26 03:19:34 -05:00
|
|
|
.PHONY: FORCE all exts gems
|
2017-01-22 22:43:43 -05:00
|
|
|
FORCE:
|