mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* common.mk (encs): added dependencies.
* enc/Makefile.in, enc/depend, enc/make_encmake.rb: moved serb code. * lib/mkmf.rb (depend_rules): now takes content string, not file name. * win32/enc-setup.mak: overrides default target. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ebfcc5d933
commit
6ed9bdd463
7 changed files with 82 additions and 70 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Tue Dec 18 01:15:44 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* common.mk (encs): added dependencies.
|
||||
|
||||
* enc/Makefile.in, enc/depend, enc/make_encmake.rb: moved serb code.
|
||||
|
||||
* lib/mkmf.rb (depend_rules): now takes content string, not file name.
|
||||
|
||||
* win32/enc-setup.mak: overrides default target.
|
||||
|
||||
Tue Dec 18 00:26:12 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* re.c (rb_reg_initialize): raise error if non-Unicode fixed
|
||||
|
|
|
@ -342,7 +342,8 @@ $(RBCONFIG): $(srcdir)/mkconfig.rb config.status $(PREP)
|
|||
encs: enc.mk
|
||||
$(MAKE) -f enc.mk
|
||||
|
||||
enc.mk: miniruby$(EXEEXT)
|
||||
enc.mk: miniruby$(EXEEXT) $(srcdir)/enc/make_encmake.rb \
|
||||
$(srcdir)/enc/Makefile.in $(srcdir)/enc/depend $(srcdir)/lib/mkmf.rb
|
||||
$(MINIRUBY) $(srcdir)/enc/make_encmake.rb $@
|
||||
|
||||
.PRECIOUS: $(MKFILES)
|
||||
|
|
|
@ -4,7 +4,6 @@ arch = @arch@
|
|||
EXTOUT = @EXTOUT@
|
||||
hdrdir = $(top_srcdir)/include
|
||||
arch_hdrdir = $(EXTOUT)/include/$(arch)
|
||||
VPATH = <% %w[$(arch_hdrdir)/ruby $(hdrdir)/ruby $(top_srcdir) $(srcdir)].join("@PATH_SEPARATOR@") %>
|
||||
ENCSODIR = $(EXTOUT)/$(arch)/enc
|
||||
DLEXT = @DLEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
|
@ -13,30 +12,15 @@ BUILTIN_ENCS = ascii.c \
|
|||
euc_jp.c sjis.c \
|
||||
unicode.c utf8.c
|
||||
|
||||
ENCOBJS = <%encs.map {|e|"#{e}.$(OBJEXT)"}.join(" \\\n\t ")+"\n"%>
|
||||
ENCSOS = <%encs.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")+"\n"%>
|
||||
empty =
|
||||
CC = @CC@
|
||||
OUTFLAG = @OUTFLAG@$(empty)
|
||||
CFLAGS = @CFLAGS@ @ARCH_FLAG@
|
||||
XCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(top_srcdir) @XCFLAGS@
|
||||
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(top_srcdir)
|
||||
DEFS = @DEFS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@
|
||||
XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS)
|
||||
LIBS = @LIBS@ $(EXTLIBS)
|
||||
LDSHARED = @LDSHARED@
|
||||
DLDFLAGS = @DLDFLAGS@ $(EXTLDFLAGS) @ARCH_FLAG@
|
||||
|
||||
#!#! if File.exist?(depend = File.join($srcdir, "depend"))
|
||||
#### depend ####
|
||||
#!#<% depend_rules(depend).join%>
|
||||
#!#! end
|
||||
#!#! encs.each do |e|
|
||||
#!#
|
||||
#!#$(ENCSODIR)/<%e%>.$(DLEXT): <%e%>.$(OBJEXT)
|
||||
#!# <%LINK_SO.gsub(/\n/, "\n\t")%>
|
||||
#!#! end
|
||||
#!#! encs.each do |e|
|
||||
#!#
|
||||
#!#<%e%>.$(OBJEXT): <% (RULE_SUBST || "%s") % "#{e}.c" %>
|
||||
#!#! end
|
||||
|
|
21
enc/depend
21
enc/depend
|
@ -1,3 +1,24 @@
|
|||
! encs = (Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - CONFIG["BUILTIN_ENCS"].split).each {|e| e.chomp!(".c")}
|
||||
|
||||
VPATH = <% %w[$(arch_hdrdir)/ruby $(hdrdir)/ruby $(top_srcdir) $(srcdir)].join(CONFIG["PATH_SEPARATOR"]) %>
|
||||
|
||||
ENCOBJS = <%encs.map {|e|"#{e}.$(OBJEXT)"}.join(" \\\n\t ")+"\n"%>
|
||||
|
||||
ENCSOS = <%encs.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")+"\n"%>
|
||||
|
||||
all: $(ENCSOS)
|
||||
|
||||
.c.$(OBJEXT):
|
||||
<%COMPILE_C%>
|
||||
|
||||
$(ENCOBJS): regenc.h oniguruma.h config.h defines.h
|
||||
|
||||
! encs.each do |e|
|
||||
|
||||
$(ENCSODIR)/<%e%>.$(DLEXT): <%e%>.$(OBJEXT)
|
||||
<%LINK_SO.gsub(/\n/, "\n\t")%>
|
||||
! end
|
||||
|
||||
! encs.each do |e|
|
||||
<%e%>.$(OBJEXT): <%e%>.c
|
||||
! end
|
||||
|
|
|
@ -3,21 +3,17 @@
|
|||
dir = File.expand_path("../..", __FILE__)
|
||||
$:.unshift(File.join(dir, "lib"))
|
||||
$:.unshift(dir)
|
||||
File.directory?("enc") || File.mkdir("enc")
|
||||
$:.unshift(".")
|
||||
require 'mkmf'
|
||||
require 'tool/serb'
|
||||
|
||||
encdir = File.join($top_srcdir, "enc")
|
||||
|
||||
encs = Dir.open(encdir) {|d| d.grep(/.+\.c\z/)}
|
||||
encs -= CONFIG["BUILTIN_ENCS"].split
|
||||
encs.each {|e| e.chomp!(".c")}
|
||||
mkin = File.read(File.join(encdir, "Makefile.in"))
|
||||
mkin.gsub!(/^\#!\# ?/, '')
|
||||
mkin.gsub!(/@(#{RbConfig::MAKEFILE_CONFIG.keys.join('|')})@/) {CONFIG[$1]}
|
||||
tmp = ''
|
||||
eval(serb(mkin, 'tmp'))
|
||||
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'))
|
||||
mkin << "\n#### depend ####\n\n" << depend_rules(tmp).join
|
||||
end
|
||||
open(ARGV[0], 'w') {|f|
|
||||
f.puts tmp
|
||||
f.puts mkin
|
||||
}
|
||||
|
|
74
lib/mkmf.rb
74
lib/mkmf.rb
|
@ -1273,48 +1273,46 @@ def depend_rules(depend)
|
|||
unless suffixes.empty?
|
||||
depout << ".SUFFIXES: ." + suffixes.uniq.join(" .") + "\n\n"
|
||||
end
|
||||
open(depend, "r") do |dfile|
|
||||
cont = implicit = nil
|
||||
impconv = proc do
|
||||
COMPILE_RULES.each {|rule| depout << (rule % implicit[0]) << implicit[1]}
|
||||
implicit = nil
|
||||
end
|
||||
ruleconv = proc do |line|
|
||||
if implicit
|
||||
if /\A\t/ =~ line
|
||||
implicit[1] << line
|
||||
next
|
||||
else
|
||||
impconv[]
|
||||
end
|
||||
end
|
||||
if m = /\A\.(\w+)\.(\w+)(?:\s*:)/.match(line)
|
||||
suffixes << m[1] << m[2]
|
||||
implicit = [[m[1], m[2]], [m.post_match]]
|
||||
cont = implicit = nil
|
||||
impconv = proc do
|
||||
COMPILE_RULES.each {|rule| depout << (rule % implicit[0]) << implicit[1]}
|
||||
implicit = nil
|
||||
end
|
||||
ruleconv = proc do |line|
|
||||
if implicit
|
||||
if /\A\t/ =~ line
|
||||
implicit[1] << line
|
||||
next
|
||||
elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
|
||||
line.gsub!(%r"(?<=\s)(?!\.)([^$(){}+=:\s\/\\,]+)(?=\s|\z)", &RULE_SUBST.method(:%))
|
||||
else
|
||||
impconv[]
|
||||
end
|
||||
depout << line
|
||||
end
|
||||
while line = dfile.gets()
|
||||
line.gsub!(/\.o\b/, ".#{$OBJEXT}")
|
||||
line.gsub!(/\$\((?:hdr|top)dir\)\/config.h/, $config_h) if $config_h
|
||||
line.gsub!(%r"\$\(hdrdir\)/(?!ruby/)", '\&ruby/')
|
||||
if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
|
||||
(cont ||= []) << line
|
||||
next
|
||||
elsif cont
|
||||
line = (cont << line).join
|
||||
cont = nil
|
||||
end
|
||||
ruleconv.call(line)
|
||||
if m = /\A\.(\w+)\.(\w+)(?:\s*:)/.match(line)
|
||||
suffixes << m[1] << m[2]
|
||||
implicit = [[m[1], m[2]], [m.post_match]]
|
||||
next
|
||||
elsif RULE_SUBST and /\A(?!\s*\w+\s*=)[$\w][^#]*:/ =~ line
|
||||
line.gsub!(%r"(?<=\s)(?!\.)([^$(){}+=:\s\/\\,]+)(?=\s|\z)", &RULE_SUBST.method(:%))
|
||||
end
|
||||
if cont
|
||||
ruleconv.call(cont.join)
|
||||
elsif implicit
|
||||
impconv.call
|
||||
depout << line
|
||||
end
|
||||
depend.each_line do |line|
|
||||
line.gsub!(/\.o\b/, ".#{$OBJEXT}")
|
||||
line.gsub!(/\$\((?:hdr|top)dir\)\/config.h/, $config_h) if $config_h
|
||||
line.gsub!(%r"\$\(hdrdir\)/(?!ruby(?![^:;/\s]))", '\&ruby/') if /^\s*\w+\s*=/ !~ line
|
||||
if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
|
||||
(cont ||= []) << line
|
||||
next
|
||||
elsif cont
|
||||
line = (cont << line).join
|
||||
cont = nil
|
||||
end
|
||||
ruleconv.call(line)
|
||||
end
|
||||
if cont
|
||||
ruleconv.call(cont.join)
|
||||
elsif implicit
|
||||
impconv.call
|
||||
end
|
||||
depout.flatten!
|
||||
depout
|
||||
|
@ -1581,7 +1579,7 @@ site-install-rb: install-rb
|
|||
|
||||
depend = File.join(srcdir, "depend")
|
||||
if File.exist?(depend)
|
||||
mfile.print("###\n", *depend_rules(depend))
|
||||
mfile.print("###\n", *depend_rules(File.read(depend)))
|
||||
else
|
||||
headers = %w[ruby.h defines.h]
|
||||
if RULE_SUBST
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
BUILTIN_ENCOBJS:
|
||||
|
||||
!include $(srcdir)/enc/Makefile.in
|
||||
|
||||
all:
|
||||
BUILTIN_ENCOBJS:
|
||||
@echo BUILTIN_ENCOBJS = $(BUILTIN_ENCS:.c=.obj) >> $(MAKEFILE)
|
||||
|
|
Loading…
Reference in a new issue