Ignore:
Timestamp:
Jul 9, 2020, 8:51:43 AM (4 years ago)
Author:
coas-nagasima
Message:

mrubyを2.1.1に更新

Location:
EcnlProtoTool/trunk/mruby-2.1.1
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/mruby-2.1.1/tasks/toolchains/gcc.rake

    r331 r439  
    1 MRuby::Toolchain.new(:gcc) do |conf, _params|
    2   [conf.cc, conf.objc, conf.asm].each do |cc|
    3     cc.command = ENV['CC'] || 'gcc'
    4     cc.flags = [ENV['CFLAGS'] || %w(-g -std=gnu99 -Og -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings)]
    5     cc.defines = %w(DISABLE_GEMS)
    6     cc.option_include_path = '-I%s'
    7     cc.option_define = '-D%s'
    8     cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
    9     cc.cxx_compile_flag = '-x c++ -std=c++03'
    10     cc.cxx_exception_flag = '-fexceptions'
    11   end
     1MRuby::Toolchain.new(:gcc) do |conf, params|
     2  default_command = params[:default_command] || 'gcc'
     3  compiler_flags = %w(-g3 -Og -Wall -Wundef)
     4  c_mandatory_flags = %w(-std=gnu99)
     5  cxx_invalid_flags = %w(-Wdeclaration-after-statement -Werror-implicit-function-declaration)
    126
    13   [conf.cxx].each do |cxx|
    14     cxx.command = ENV['CXX'] || 'g++'
    15     cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(-g -Og -Wall -Werror-implicit-function-declaration)]
    16     cxx.defines = %w(DISABLE_GEMS)
    17     cxx.option_include_path = '-I%s'
    18     cxx.option_define = '-D%s'
    19     cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
    20     cxx.cxx_compile_flag = '-x c++ -std=c++03'
    21     cxx.cxx_exception_flag = '-fexceptions'
     7  [conf.cc, conf.objc, conf.asm, conf.cxx].each do |compiler|
     8    if compiler == conf.cxx
     9      compiler.command = ENV['CXX'] || default_command.sub(/cc|$/, '++')
     10      compiler.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || compiler_flags]
     11    else
     12      compiler.command = ENV['CC'] || default_command
     13      compiler.flags = [c_mandatory_flags, ENV['CFLAGS'] || [compiler_flags, cxx_invalid_flags, %w(-Wwrite-strings)]]
     14    end
     15    compiler.option_include_path = %q[-I"%s"]
     16    compiler.option_define = '-D%s'
     17    compiler.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
     18    compiler.cxx_compile_flag = '-x c++ -std=gnu++03'
     19    compiler.cxx_exception_flag = '-fexceptions'
     20    compiler.cxx_invalid_flags = c_mandatory_flags + cxx_invalid_flags
    2221  end
    2322
    2423  conf.linker do |linker|
    25     linker.command = ENV['LD'] || 'gcc'
     24    linker.command = ENV['LD'] || ENV['CXX'] || ENV['CC'] || default_command
    2625    linker.flags = [ENV['LDFLAGS'] || %w()]
    2726    linker.libraries = %w(m)
     
    2928    linker.option_library = '-l%s'
    3029    linker.option_library_path = '-L%s'
    31     linker.link_options = '%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
     30    linker.link_options = '%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
    3231  end
    3332
     
    5655    end
    5756  end
     57
     58  def conf.enable_sanitizer(*opts)
     59    fail 'sanitizer already set' if @sanitizer_list
     60
     61    @sanitizer_list = opts
     62    flg = "-fsanitize=#{opts.join ','}"
     63    [self.cc, self.cxx, self.linker].each{|cmd| cmd.flags << flg }
     64  end
    5865end
Note: See TracChangeset for help on using the changeset viewer.