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