Unverified Commit 915bb4e2 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4703 from shuujii/refine-tasks-toolchains-gcc-clang.rake

Refine `tasks/toolchains/(gcc|clang).rake`
parents 231a1d68 07c6b7f0
MRuby::Toolchain.new(:clang) do |conf, _params| MRuby::Toolchain.new(:clang) do |conf, _params|
toolchain :gcc toolchain :gcc, default_command: 'clang'
[conf.cc, conf.objc, conf.asm].each do |cc| [conf.cc, conf.objc, conf.asm, conf.cxx].each do |compiler|
cc.command = ENV['CC'] || 'clang' compiler.flags.unshift('-Wzero-length-array')
cc.flags << '-Wzero-length-array' unless ENV['CFLAGS']
end end
conf.cxx.command = ENV['CXX'] || 'clang++'
conf.cxx.flags << '-Wzero-length-array' unless ENV['CXXFLAGS'] || ENV['CFLAGS']
conf.linker.command = ENV['LD'] || ENV['CXX'] || ENV['CC'] || 'clang'
end end
MRuby::Toolchain.new(:gcc) do |conf, _params| MRuby::Toolchain.new(:gcc) do |conf, params|
[conf.cc, conf.objc, conf.asm].each do |cc| default_command = params[:default_command] || 'gcc'
cc.command = ENV['CC'] || 'gcc' compile_flags = %w(-g -O3 -Wall -Wundef -Werror-implicit-function-declaration)
cc.flags = [ENV['CFLAGS'] || %w(-g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings -Wundef)]
cc.option_include_path = '-I%s'
cc.option_define = '-D%s'
cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
cc.cxx_compile_flag = '-x c++ -std=c++03'
cc.cxx_exception_flag = '-fexceptions'
end
[conf.cxx].each do |cxx| [conf.cc, conf.objc, conf.asm, conf.cxx].each do |compiler|
cxx.command = ENV['CXX'] || 'g++' if compiler == conf.cxx
cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(-g -O3 -Wall -Werror-implicit-function-declaration -Wundef)] compiler.command = ENV['CXX'] || default_command.sub(/cc|$/, '++')
cxx.option_include_path = '-I%s' compiler.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || compile_flags]
cxx.option_define = '-D%s' else
cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}' compiler.command = ENV['CC'] || default_command
cxx.cxx_compile_flag = '-x c++ -std=c++03' compiler.flags = ['-std=gnu99', ENV['CFLAGS'] || [compile_flags, %w(-Wdeclaration-after-statement -Wwrite-strings)]]
cxx.cxx_exception_flag = '-fexceptions' end
compiler.option_include_path = '-I%s'
compiler.option_define = '-D%s'
compiler.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
compiler.cxx_compile_flag = '-x c++ -std=c++03'
compiler.cxx_exception_flag = '-fexceptions'
end end
conf.linker do |linker| conf.linker do |linker|
linker.command = ENV['LD'] || ENV['CXX'] || ENV['CC'] || 'gcc' linker.command = ENV['LD'] || ENV['CXX'] || ENV['CC'] || default_command
linker.flags = [ENV['LDFLAGS'] || %w()] linker.flags = [ENV['LDFLAGS'] || %w()]
linker.libraries = %w(m) linker.libraries = %w(m)
linker.library_paths = [] linker.library_paths = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment