1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enc/depend, enc/make_encmake.rb: use erb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-12-22 18:35:53 +00:00
parent 872899fa58
commit cd42707d86
3 changed files with 41 additions and 38 deletions

View file

@ -1,4 +1,4 @@
Sun Dec 23 03:26:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sun Dec 23 03:35:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* version.h: use patchlevel if revision is not set.
@ -8,6 +8,8 @@ Sun Dec 23 03:26:48 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (encs, ext/ripper/ripper.c): MAKEFLAGS needs -.
* enc/depend, enc/make_encmake.rb: use erb.
Sun Dec 23 01:56:18 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_mode_enc): do not set encoding unless explicitly

View file

@ -1,49 +1,49 @@
! encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS
! encs.each {|e| e.chomp!(".c")}
! encs = encs.sort_by {|e| e.split(/(\d+)/).map {|n| Integer(n) rescue n}}
% encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS
% encs.each {|e| e.chomp!(".c")}
% encs = encs.sort_by {|e| e.split(/(\d+)/).map {|n| Integer(n) rescue n}}
VPATH = <% %w[$(arch_hdrdir)/ruby $(hdrdir)/ruby $(top_srcdir) $(srcdir)].join(CONFIG["PATH_SEPARATOR"]) %>
LIBPATH = <%libpathflag($DEFLIBPATH)%>
VPATH = <%=%w[$(arch_hdrdir)/ruby $(hdrdir)/ruby $(top_srcdir) $(srcdir)].join(CONFIG["PATH_SEPARATOR"])%>
LIBPATH = <%=libpathflag($DEFLIBPATH)%>
ENCOBJS = <%encs.map {|e|"#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%"\n" if encs.size>1%>
ENCDEFS = <%encs.map {|e|"#{e}.def"}.join(" \\\n\t ") if DEFFILE%><%"\n" if encs.size>1%>
ENCSOS = <%encs.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%>
ENCOBJS = <%=encs.map {|e|"#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if encs.size>1%>
ENCDEFS = <%=encs.map {|e|"#{e}.def"}.join(" \\\n\t ") if DEFFILE%><%="\n" if encs.size>1%>
ENCSOS = <%=encs.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%>
all: $(ENCSOS)
! COMPILE_RULES.each do |rule|
<% rule % %w[c $(OBJEXT)] %>
<%COMPILE_C%>
% COMPILE_RULES.each do |rule|
<%= rule % %w[c $(OBJEXT)] %>
<%=COMPILE_C%>
! end
! unless encs.empty?
% end
% unless encs.empty?
$(ENCOBJS): regenc.h oniguruma.h config.h defines.h
! encs.each do |e|
<%e%>.so: $(ENCSODIR)/<%e%>.$(DLEXT)
! end
% encs.each do |e|
<%=e%>.so: $(ENCSODIR)/<%=e%>.$(DLEXT)
% end
! end
! link_so = LINK_SO.gsub(/\n/, "\n\t")
! encs.each do |e|
! deps = "#{e}.$(OBJEXT)"
! deps << " #{e}-$(arch).def" if DEFFILE
$(ENCSODIR)/<%e%>.$(DLEXT): <%deps%>
<%link_so.sub(/\$\(OBJS\)/, deps)%>
% end
% link_so = LINK_SO.gsub(/\n/, "\n\t")
% encs.each do |e|
% deps = "#{e}.$(OBJEXT)"
% deps << " #{e}-$(arch).def" if DEFFILE
$(ENCSODIR)/<%=e%>.$(DLEXT): <%=deps%>
<%=link_so.sub(/\$\(OBJS\)/, deps)%>
! end
! if DEFFILE
! encs.each do |e|
<%e%>-$(arch).def: enc.mk
% end
% if DEFFILE
% encs.each do |e|
<%=e%>-$(arch).def: enc.mk
echo EXPORTS > $@
echo <%EXPORT_PREFIX%>Init_<%e%> >> $@
echo <%=EXPORT_PREFIX%>Init_<%=e%> >> $@
! end
! end
! encs.each do |e|
<%e%>.$(OBJEXT): <%e%>.c
! end
% end
% end
% encs.each do |e|
<%=e%>.$(OBJEXT): <%=e%>.c
% end
clean:
$(RM) $(ENCSOS)

View file

@ -5,10 +5,10 @@ $:.unshift(File.join(dir, "lib"))
$:.unshift(dir)
$:.unshift(".")
require 'mkmf'
require 'tool/serb'
require 'erb'
if /--builtin-encs=/ =~ ARGV[0]
BUILTIN_ENCS = $'.split.each {|e| e.sub!(/(?:\.\w+)?\z/, '.c')}
BUILTIN_ENCS = $'.split.map {|e| File.basename(e, '.*') << '.c'}
ARGV.shift
else
BUILTIN_ENCS = []
@ -19,8 +19,9 @@ DEFFILE = (true if CONFIG["DLDFLAGS"].sub!(/\s+-def:\$\(DEFFILE\)\s+/, ' '))
mkin = File.read(File.join($srcdir, "Makefile.in"))
mkin.gsub!(/@(#{CONFIG.keys.join('|')})@/) {CONFIG[$1]}
if File.exist?(depend = File.join($srcdir, "depend"))
tmp = ''
eval(serb(File.read(depend), 'tmp'), binding, depend)
erb = ERB.new(File.read(depend), nil, '%')
erb.filename = depend
tmp = erb.result(binding)
mkin << "\n#### depend ####\n\n" << depend_rules(tmp).join
end
open(ARGV[0], 'wb') {|f|