diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | common.mk | 2 | ||||
-rw-r--r-- | enc/Makefile.in | 3 | ||||
-rw-r--r-- | enc/depend | 25 | ||||
-rw-r--r-- | enc/make_encmake.rb | 31 |
5 files changed, 53 insertions, 16 deletions
@@ -1,3 +1,11 @@ +Tue Aug 12 14:25:09 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * enc/Makefile.in (.SUFFIXES): renamed to .trans. + + * enc/make_encmake.rb: added --encs and --no-encs options. + + * enc/depend (TRANSVPATH): fix for nmake. + Tue Aug 12 14:19:53 2008 Minero Aoki <aamine@loveruby.net> * lib/net/https.rb: supress syntax warning. @@ -381,7 +381,7 @@ encs: enc.mk $(LIBRUBY) $(PREP) transdb.h enc.mk: $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \ $(srcdir)/lib/mkmf.rb $(RBCONFIG) - $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" $@ + $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" $@ $(ENCS) .PRECIOUS: $(MKFILES) diff --git a/enc/Makefile.in b/enc/Makefile.in index cc3d99d39..460ec320d 100644 --- a/enc/Makefile.in +++ b/enc/Makefile.in @@ -42,13 +42,14 @@ ldflags = $(LDFLAGS) dldflags = @DLDFLAGS@ archflag = @ARCH_FLAG@ DLDFLAGS = $(ldflags) $(dldflags) $(archflag) +RUBY = $(MINIRUBY) WORKDIRS = $(ENCSODIR) $(TRANSSODIR) enc enc/trans RM = @RM@ MAKEDIRS = @MAKEDIRS@ -.SUFFIXES: .erb.c +.SUFFIXES: .trans all: make-workdir diff --git a/enc/depend b/enc/depend index 2eeb058d9..35cf6939b 100644 --- a/enc/depend +++ b/enc/depend @@ -1,6 +1,8 @@ % deffile = (true if /\$\(DEFFILE\)/ =~ CONFIG["LINK_SO"]) % encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS % encs.each {|e| e.chomp!(".c")} +% encs.reject! {|e| !ENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}} if !ENC_PATTERNS.empty? +% encs.reject! {|e| NOENC_PATTERNS.any? {|p| File.fnmatch?(p, e)}} % alphanumeric_order = proc {|e| e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten} % encs = encs.sort_by(&alphanumeric_order) % encs.unshift(encs.delete("encdb")) @@ -19,11 +21,14 @@ % atrans = atrans.sort_by(&alphanumeric_order) % trans = trans.sort_by(&alphanumeric_order) % trans.unshift(trans.delete("transdb")) +% trans |= atrans % trans.map! {|e| "trans/#{e}"} % dependencies = encs + trans % cleanlibs = Shellwords.shellwords(CONFIG["cleanlibs"] || "") % cleanobjs = Shellwords.shellwords(CONFIG["cleanobjs"] || "") % rule_subst = CONFIG["RULE_SUBST"] || "%s" +% transvpath = rule_subst.dup.sub!(/\{[^{}]+\}/, '$(TRANSVPATH)/') || "enc/trans/%s" +% transvpath_prefix = rule_subst.dup.sub!(/\{[^{}]+\}/, '{$(TRANSVPATH)}') || "" % if File::ALT_SEPARATOR % pathrep = proc {|path| path.gsub('/', File::ALT_SEPARATOR).gsub(/\$\(([@<?*]\w?|\w+)\)/, "$(\\1:/=\\#{File::ALT_SEPARATOR})")} % else @@ -42,7 +47,9 @@ ENCCLEANOBJS = <%=cleanobjs.map {|clean| clean.gsub(/\$\*(\.\w+)?/) {"$(ENCOBJS#{$1 ? ":.#{CONFIG["OBJEXT"]}=#{$1}" : ""})"} }.join(" ")%> -TRANSCSRCS = <%=atrans.map {|e| rule_subst % "enc/trans/#{e}.c"}.join(" \\\n\t ")%><%="\n" if trans.size>1%> +TRANSVPATH = $(srcdir)/enc/trans + +TRANSCSRCS = <%=atrans.map {|e| transvpath % "#{e}.c"}.join(" \\\n\t ")%><%="\n" if trans.size>1%> TRANSOBJS = <%=trans.map {|e|"enc/#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if trans.size>1%> TRANSSOS = <%=trans.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%><%="\n" if trans.size>1%> TRANSCLEANLIBS = <%=cleanlibs.map {|clean| @@ -61,10 +68,14 @@ srcs: $(TRANSCSRCS) % end % compile_rules.each do |rule| <%= rule % %w[c $(OBJEXT)] %> - @$(MAKEDIRS) "$(@D)" + -@$(MAKEDIRS) "$(@D)" <%=COMPILE_C%> % end + +<%=transvpath_prefix%>.trans<%=transvpath_prefix%>.c: + $(MINIRUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo "$@" "$<" + % unless encs.empty? or trans.empty? % unless encs.empty? @@ -75,10 +86,10 @@ $(TRANSOBJS): ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma. % end % atrans.each do |e| % src = "#{e}.trans" -% src = [src, *IO.read(File.join($srcdir, "trans", src)).scan(/^\s*require\s+[\'\"]([^\'\"]*)/).flatten.map{|c|c+".rb"}] -<%=rule_subst % "enc/trans/#{e}.c"%>: <%= src.map {|e| rule_subst % "enc/trans/#{e}"}.join(" ")%> $(srcdir)/tool/transcode-tblgen.rb - $(MINIRUBY) "$(srcdir)/tool/transcode-tblgen.rb" -vo "$@" <%= src.map {|e| %'"$(srcdir)/enc/trans/#{e}"'}.join(" ")%> +<%=transvpath % "#{e}.c"%>: <%= transvpath % "#{e}.trans"%> +% src = [*IO.read(File.join($srcdir, "trans", src)).scan(/^\s*require\s+[\'\"]([^\'\"]*)/).flatten.map{|c|c+".rb"}] +<%=transvpath % "#{e}.c"%>: <%= src.map {|e| transvpath % "#{e}"}.join(" ")%> $(srcdir)/tool/transcode-tblgen.rb % end % end @@ -89,8 +100,8 @@ $(TRANSOBJS): ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma. % df = ("enc/#{e}.def" if deffile) $(ENCSODIR)/<%=e%>.$(DLEXT): <%=obj%> % if df - echo EXPORTS > <%=df%> - echo <%=EXPORT_PREFIX%>Init_<%=File.basename(e)%> >> <%=df%> + echo> <%=df%> EXPORTS + echo>> <%=df%> <%=EXPORT_PREFIX%>Init_<%=File.basename(e)%> % end @$(MAKEDIRS) "$(@D)" <%=link_so.sub(/\$\(OBJS\)/) {obj}.sub(/\$\(DEFFILE\)/) {df}.gsub(/-(?:implib|pdb):/) {|s|"#{s}enc/#{e.sub(/[^\/]+\z/, '')}"}%> diff --git a/enc/make_encmake.rb b/enc/make_encmake.rb index e36723294..f8c773504 100644 --- a/enc/make_encmake.rb +++ b/enc/make_encmake.rb @@ -3,15 +3,32 @@ dir = File.expand_path("../..", __FILE__) $:.unshift(dir) $:.unshift(".") -$" << "mkmf.rb" -load File.expand_path("lib/mkmf.rb", dir) +if $".grep(/mkmf/).empty? + $" << "mkmf.rb" + load File.expand_path("lib/mkmf.rb", dir) +end require 'erb' -if /--builtin-encs=/ =~ ARGV[0] - BUILTIN_ENCS = $'.split.map {|e| File.basename(e, '.*') << '.c'} - ARGV.shift -else - BUILTIN_ENCS = [] +CONFIG["MAKEDIRS"] ||= '@$(MINIRUBY) -run -e mkdir -- -p' + +BUILTIN_ENCS = [] +ENC_PATTERNS = [] +NOENC_PATTERNS = [] + +until ARGV.empty? + case ARGV[0] + when /\A--builtin-encs=/ + BUILTIN_ENCS.concat $'.split.map {|e| File.basename(e, '.*') << '.c'} + ARGV.shift + when /\A--encs=/ + ENC_PATTERNS.concat $'.split + ARGV.shift + when /\A--no-encs=/ + NOENC_PATTERNS.concat $'.split + ARGV.shift + else + break + end end if File.exist?(depend = File.join($srcdir, "depend")) |