2017-01-22 21:50:23 -05:00
|
|
|
V = 0
|
2020-12-29 02:42:24 -05:00
|
|
|
V0 = $(V:0=)
|
2017-01-22 21:50:23 -05:00
|
|
|
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)"],
|
2020-06-19 01:02:46 -04:00
|
|
|
["gems", ".bundle/gems", "--no-extstatic"],
|
2017-04-23 12:19:22 -04:00
|
|
|
].each do |t, d, o|
|
|
|
|
exts[t] = [o, Dir.glob("#{srcdir}/#{d}/*/").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%>
|
2020-06-06 03:44:14 -04:00
|
|
|
SCRIPT_ARGS = <%=script_args.gsub("#", "\\#")%>
|
2017-01-28 00:02:41 -05:00
|
|
|
EXTMK_ARGS = $(SCRIPT_ARGS) --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \
|
2018-02-18 20:45:17 -05:00
|
|
|
--make-flags="MINIRUBY='$(MINIRUBY)'"
|
2017-01-26 03:19:34 -05:00
|
|
|
|
2022-04-06 07:25:53 -04:00
|
|
|
all: exts gems
|
2017-01-26 03:19:34 -05:00
|
|
|
exts:
|
|
|
|
gems:
|
2017-01-22 23:22:23 -05:00
|
|
|
|
2017-04-23 12:19:22 -04:00
|
|
|
% exts.each do |t, (o, dirs)|
|
|
|
|
% dirs.each do |d|
|
2020-06-19 01:42:26 -04:00
|
|
|
% next if Dir.glob("#{srcdir}/#{d}/**/extconf.rb").empty?
|
2017-04-23 12:19:22 -04:00
|
|
|
<%=t%>: <%=d%>/exts.mk
|
|
|
|
<%=d%>/exts.mk: FORCE
|
2017-01-26 03:19:34 -05:00
|
|
|
$(Q)$(MINIRUBY) $(srcdir)/ext/extmk.rb --make='$(MAKE)' \
|
2017-04-23 12:19:22 -04:00
|
|
|
--command-output=$@ $(EXTMK_ARGS) <%=o%> \
|
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:
|