mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
1369cfd16e
* transcode.c (init_transcoder_table): moved to enc/trans/transdb.c. * enc/depend (enc/encdb.o enc/trans/transdb.o): depend on corresponding headers. * common.mk (COMMONOBJS): moved transcode.o from OBJS git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
61 lines
2.3 KiB
Text
61 lines
2.3 KiB
Text
% deffile = (true if /\$\(DEFFILE\)/ =~ CONFIG["LINK_SO"])
|
|
% encs = Dir.open($srcdir) {|d| d.grep(/.+\.c\z/)} - BUILTIN_ENCS
|
|
% encs.each {|e| e.chomp!(".c")}
|
|
% alphanumeric_order = proc {|e| e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten}
|
|
% encs = encs.sort_by(&alphanumeric_order)
|
|
% trans = Dir.open($srcdir+"/trans") {|d| d.select {|e| e.chomp!('.c')}}
|
|
% trans = trans.sort_by(&alphanumeric_order)
|
|
% trans.map! {|e| "trans/#{e}"}
|
|
% dependencies = encs + trans
|
|
|
|
VPATH = <%=%w[$(arch_hdrdir)/ruby $(hdrdir)/ruby $(srcdir) $(encsrcdir)].join(CONFIG["PATH_SEPARATOR"])%>
|
|
LIBPATH = <%=libpathflag($DEFLIBPATH)%>
|
|
|
|
ENCOBJS = <%=encs.map {|e|"enc/#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if encs.size>1%>
|
|
ENCDEFS = <%=encs.map {|e|"enc/#{e}.def"}.join(" \\\n\t ") if deffile%><%="\n" if encs.size>1%>
|
|
ENCSOS = <%=encs.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%>
|
|
|
|
TRANSOBJS = <%=trans.map {|e|"enc/#{e}.$(OBJEXT)"}.join(" \\\n\t ")%><%="\n" if trans.size>1%>
|
|
TRANSDEFS = <%=trans.map {|e|"enc/#{e}.def"}.join(" \\\n\t ") if deffile%><%="\n" if trans.size>1%>
|
|
TRANSSOS = <%=trans.map {|e|"$(ENCSODIR)/#{e}.$(DLEXT)"}.join(" \\\n\t ")%>
|
|
|
|
all: $(ENCSOS) $(TRANSSOS)
|
|
|
|
% COMPILE_RULES.each do |rule|
|
|
<%= rule % %w[c $(OBJEXT)] %>
|
|
<%=COMPILE_C%>
|
|
|
|
% end
|
|
% unless encs.empty? or trans.empty?
|
|
|
|
% unless encs.empty?
|
|
$(ENCOBJS): regenc.h oniguruma.h config.h defines.h
|
|
% end
|
|
% unless trans.empty?
|
|
$(TRANSOBJS): ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma.h st.h transcode_data.h
|
|
% end
|
|
|
|
% end
|
|
% link_so = LINK_SO.gsub(/\n/, "\n\t")
|
|
% link_so.gsub!(/(-(?:implib|pdb):\S+)-\$\(arch\)\./, '\1.')
|
|
% dependencies.each do |e|
|
|
% obj = "enc/#{e}.$(OBJEXT)"
|
|
% df = ("enc/#{e}.def" if deffile)
|
|
$(ENCSODIR)/<%=e%>.$(DLEXT): <%=obj%>
|
|
% if df
|
|
echo EXPORTS > <%=df%>
|
|
echo <%=EXPORT_PREFIX%>Init_<%=File.basename(e)%> >> <%=df%>
|
|
% end
|
|
<%=link_so.sub(/\$\(OBJS\)/) {obj}.sub(/\$\(DEFFILE\)/) {df}.gsub(/-(?:implib|pdb):/) {|s|"#{s}enc/#{e.sub(/[^\/]+\z/, '')}"}%>
|
|
|
|
% end
|
|
% dependencies.each do |e|
|
|
enc/<%=e%>.$(OBJEXT): $(srcdir)/enc/<%=e%>.c
|
|
<%=COMPILE_C.sub(/\$\(<(?:.*)\)/) {"$(srcdir)/enc/#{e}.c"}%>
|
|
% end
|
|
|
|
enc/encdb.$(OBJEXT): encdb.h
|
|
enc/trans/transdb.$(OBJEXT): transdb.h
|
|
|
|
clean:
|
|
@$(RM) $(ENCSOS) $(ENCDEFS) $(ENCOBJS) $(TRANSSOS) $(TRANSDEFS) $(TRANSOBJS)
|