* 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:
nobu 2007-12-17 16:15:46 +00:00
Родитель ebfcc5d933
Коммит 6ed9bdd463
7 изменённых файлов: 82 добавлений и 70 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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]}
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(mkin, '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
}

Просмотреть файл

@ -1273,7 +1273,6 @@ 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]}
@ -1297,10 +1296,10 @@ def depend_rules(depend)
end
depout << line
end
while line = dfile.gets()
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/)", '\&ruby/')
line.gsub!(%r"\$\(hdrdir\)/(?!ruby(?![^:;/\s]))", '\&ruby/') if /^\s*\w+\s*=/ !~ line
if /(?:^|[^\\])(?:\\\\)*\\$/ =~ line
(cont ||= []) << line
next
@ -1315,7 +1314,6 @@ def depend_rules(depend)
elsif implicit
impconv.call
end
end
depout.flatten!
depout
end
@ -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)