ruby-changes:35761
From: nobu <ko1@a...>
Date: Wed, 8 Oct 2014 10:38:38 +0900 (JST)
Subject: [ruby-changes:35761] nobu:r47843 (trunk): mkmf.rb: translate to assembler
nobu 2014-10-08 10:38:32 +0900 (Wed, 08 Oct 2014) New Revision: 47843 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47843 Log: mkmf.rb: translate to assembler * lib/mkmf.rb (create_makefile): add rules to translate to assembler sources. Modified files: trunk/configure.in trunk/lib/mkmf.rb trunk/win32/Makefile.sub Index: configure.in =================================================================== --- configure.in (revision 47842) +++ configure.in (revision 47843) @@ -2786,6 +2786,7 @@ AC_SUBST(LDSHAREDXX)dnl https://github.com/ruby/ruby/blob/trunk/configure.in#L2786 AC_SUBST(DLEXT)dnl AC_SUBST(DLEXT2)dnl AC_SUBST(LIBEXT)dnl +AC_SUBST(ASMEXT, S)dnl STATIC= : ${PATHFLAG=''} Index: lib/mkmf.rb =================================================================== --- lib/mkmf.rb (revision 47842) +++ lib/mkmf.rb (revision 47843) @@ -2358,20 +2358,28 @@ site-install-rb: install-rb https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L2358 return unless target mfile.puts SRC_EXT.collect {|e| ".path.#{e} = $(VPATH)"} if $nmake == ?b - mfile.print ".SUFFIXES: .#{SRC_EXT.join(' .')} .#{$OBJEXT}\n" + mfile.print ".SUFFIXES: .#{(SRC_EXT + [$OBJEXT, $ASMEXT]).compact.join(' .')}\n" mfile.print "\n" compile_command = "\n\t$(ECHO) compiling $(<#{rsep})\n\t$(Q) %s\n\n" + command = compile_command % COMPILE_CXX + asm_command = compile_command.sub(/compiling/, 'translating') % ASSEMBLE_CXX CXX_EXT.each do |e| each_compile_rules do |rule| mfile.printf(rule, e, $OBJEXT) - mfile.printf(compile_command, COMPILE_CXX) + mfile.print(command) + mfile.printf(rule, e, $ASMEXT) + mfile.print(asm_command) end end + command = compile_command % COMPILE_C + asm_command = compile_command.sub(/compiling/, 'translating') % ASSEMBLE_C C_EXT.each do |e| each_compile_rules do |rule| mfile.printf(rule, e, $OBJEXT) - mfile.printf(compile_command, COMPILE_C) + mfile.print(command) + mfile.printf(rule, e, $ASMEXT) + mfile.print(asm_command) end end @@ -2444,6 +2452,7 @@ site-install-rb: install-rb https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L2452 $LIBEXT = config['LIBEXT'].dup $OBJEXT = config["OBJEXT"].dup $EXEEXT = config["EXEEXT"].dup + $ASMEXT = config_string('ASMEXT', &:dup) || 'S' $LIBS = "#{config['LIBS']} #{config['DLDLIBS']}" $LIBRUBYARG = "" $LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC'] @@ -2592,6 +2601,16 @@ MESSAGE https://github.com/ruby/ruby/blob/trunk/lib/mkmf.rb#L2601 COMPILE_CXX = config_string('COMPILE_CXX') || '$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<' ## + # Command which will translate C files to assembler sources in the generated Makefile + + ASSEMBLE_C = config_string('ASSEMBLE_C') || COMPILE_C.sub(/(?<=\s)-c(?=\s)/, '-S') + + ## + # Command which will translate C++ files to assembler sources in the generated Makefile + + ASSEMBLE_CXX = config_string('ASSEMBLE_CXX') || COMPILE_CXX.sub(/(?<=\s)-c(?=\s)/, '-S') + + ## # Command which will compile a program in order to test linking a library TRY_LINK = config_string('TRY_LINK') || Index: win32/Makefile.sub =================================================================== --- win32/Makefile.sub (revision 47842) +++ win32/Makefile.sub (revision 47843) @@ -829,6 +829,7 @@ s,@DEFAULT_KCODE@,$(DEFAULT_KCODE),;t t https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L829 s,@EXEEXT@,.exe,;t t s,@EXECUTABLE_EXTS@,$(EXECUTABLE_EXTS),;t t s,@OBJEXT@,$(OBJEXT),;t t +s,@ASMEXT@,$(ASMEXT),;t t s,@XCFLAGS@,$(XCFLAGS),;t t s,@XLDFLAGS@,$(XLDFLAGS),;t t s,@DLDFLAGS@,$(DLDFLAGS) $$(LIBPATH),;t t @@ -880,6 +881,8 @@ s,@LINK_SO@,@if exist $$(@).manifest $$( https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L881 !endif s,@COMPILE_C@,$$(CC) $$(INCFLAGS) $$(CFLAGS) $$(CPPFLAGS) $$(COUTFLAG)$$(@) -c -Tc$$(<:\=/),;t t s,@COMPILE_CXX@,$$(CXX) $$(INCFLAGS) $$(CXXFLAGS) $$(CPPFLAGS) $$(COUTFLAG)$$(@) -c -Tp$$(<:\=/),;t t +s,@ASSEMBLE_C@,$$(CC) $$(CFLAGS) $$(CPPFLAGS) -Fa$$(@) -c -Tc$$(<:\=/),;t t +s,@ASSEMBLE_CXX@,$$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) -Fa$$(@) -c -Tp$$(<:\=/),;t t s,@COMPILE_RULES@,{$$(*VPATH*)}.%s.%s: .%s.%s:,;t t s,@RULE_SUBST@,{.;$$(VPATH)}%s,;t t s,@TRY_LINK@,$$(CC) -Feconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS) -link $$(LDFLAGS) $$(LIBPATH) $$(XLDFLAGS),;t t -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/