diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-01-06 17:06:07 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-01-06 17:06:07 +0900 |
| commit | 74c9502bd45fd70926c86ce564c2d5d1df9a6dd0 (patch) | |
| tree | 4dbf22f15e482bf082712286bcf0daa5e51aa41c /tasks/toolchains | |
| parent | 1341e53961b3e99ac67d803e5ead677e976d18c4 (diff) | |
| parent | 456878ba06358a77d4ab9312fdc69bf780f8fdf4 (diff) | |
| download | mruby-74c9502bd45fd70926c86ce564c2d5d1df9a6dd0.tar.gz mruby-74c9502bd45fd70926c86ce564c2d5d1df9a6dd0.zip | |
Merge branch 'improve-source-scanning-for-presym' of https://github.com/shuujii/mruby into shuujii-improve-source-scanning-for-presym
Diffstat (limited to 'tasks/toolchains')
| -rw-r--r-- | tasks/toolchains/gcc.rake | 4 | ||||
| -rw-r--r-- | tasks/toolchains/openwrt.rake | 23 | ||||
| -rw-r--r-- | tasks/toolchains/visualcpp.rake | 38 |
3 files changed, 29 insertions, 36 deletions
diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake index 316d2d9a1..8714e1854 100644 --- a/tasks/toolchains/gcc.rake +++ b/tasks/toolchains/gcc.rake @@ -3,6 +3,7 @@ MRuby::Toolchain.new(:gcc) do |conf, params| compiler_flags = %w(-g -O3 -Wall -Wundef) c_mandatory_flags = %w(-std=gnu99) cxx_invalid_flags = %w(-Werror-implicit-function-declaration) + compile_opt = '%{flags} -MMD -MF "%{outfile}.d" -o "%{outfile}" "%{infile}"' [conf.cc, conf.objc, conf.asm, conf.cxx].each do |compiler| if compiler == conf.cxx @@ -14,7 +15,8 @@ MRuby::Toolchain.new(:gcc) do |conf, params| end compiler.option_include_path = %q[-I"%s"] compiler.option_define = '-D%s' - compiler.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"] + compiler.compile_options = "-c #{compile_opt}" + compiler.preprocess_options = "-E -P #{compile_opt}" compiler.cxx_compile_flag = '-x c++ -std=gnu++03' compiler.cxx_exception_flag = '-fexceptions' compiler.cxx_invalid_flags = c_mandatory_flags + cxx_invalid_flags diff --git a/tasks/toolchains/openwrt.rake b/tasks/toolchains/openwrt.rake index c376d96ec..d5763d8de 100644 --- a/tasks/toolchains/openwrt.rake +++ b/tasks/toolchains/openwrt.rake @@ -1,24 +1,19 @@ # usage of environmental variables to set the # cross compiling toolchain proper MRuby::Toolchain.new(:openwrt) do |conf| - [conf.cc, conf.objc, conf.asm].each do |cc| - cc.command = ENV['TARGET_CC'] - cc.flags = ENV['TARGET_CFLAGS'] - cc.include_paths = ["#{MRUBY_ROOT}/include"] + [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc| + if cc == conf.cxx + cc.command = ENV['TARGET_CXX'] + cc.flags = ENV['TARGET_CXXFLAGS'] + else + cc.command = ENV['TARGET_CC'] + cc.flags = ENV['TARGET_CFLAGS'] + end cc.option_include_path = %q[-I"%s"] cc.option_define = '-D%s' - cc.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"] + cc.compile_options = %q[%{flags} -MMD -MF "%{outfile}.d" -o "%{outfile}" -c "%{infile}"] end - [conf.cxx].each do |cxx| - cxx.command = ENV['TARGET_CXX'] - cxx.flags = ENV['TARGET_CXXFLAGS'] - cxx.include_paths = ["#{MRUBY_ROOT}/include"] - cxx.option_include_path = %q[-I"%s"] - cxx.option_define = '-D%s' - cxx.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"] - end - conf.linker do |linker| linker.command = ENV['TARGET_CC'] linker.flags = ENV['TARGET_LDFLAGS'] diff --git a/tasks/toolchains/visualcpp.rake b/tasks/toolchains/visualcpp.rake index 5094495e3..00e364082 100644 --- a/tasks/toolchains/visualcpp.rake +++ b/tasks/toolchains/visualcpp.rake @@ -1,25 +1,21 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params| - conf.cc do |cc| - cc.command = ENV['CC'] || 'cl.exe' - # C4013: implicit function declaration - cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /we4013 /Zi /MD /O2 /D_CRT_SECURE_NO_WARNINGS)] - cc.defines = %w(MRB_STACK_EXTEND_DOUBLING) - cc.option_include_path = %q[/I"%s"] - cc.option_define = '/D%s' - cc.compile_options = %Q[%{flags} /Fo"%{outfile}" "%{infile}"] - cc.cxx_compile_flag = '/TP' - cc.cxx_exception_flag = '/EHs' - end - - conf.cxx do |cxx| - cxx.command = ENV['CXX'] || 'cl.exe' - cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /EHs /D_CRT_SECURE_NO_WARNINGS)] - cxx.defines = %w(MRB_STACK_EXTEND_DOUBLING) - cxx.option_include_path = %q[/I"%s"] - cxx.option_define = '/D%s' - cxx.compile_options = %Q[%{flags} /Fo"%{outfile}" "%{infile}"] - cxx.cxx_compile_flag = '/TP' - cxx.cxx_exception_flag = '/EHs' + compiler_flags = %w(/nologo /W3 /MD /O2 /D_CRT_SECURE_NO_WARNINGS) + [conf.cc, conf.cxx].each do |compiler| + if compiler == conf.cc + compiler.command = ENV['CC'] || 'cl.exe' + # C4013: implicit function declaration + compiler.flags = [*(ENV['CFLAGS'] || compiler_flags + %w(/we4013))] + else + compiler.command = ENV['CXX'] || 'cl.exe' + compiler.flags = [*(ENV['CXXFLAGS'] || ENV['CFLAGS'] || compiler_flags + %w(/EHs))] + end + compiler.defines = %w(MRB_STACK_EXTEND_DOUBLING) + compiler.option_include_path = %q[/I"%s"] + compiler.option_define = '/D%s' + compiler.compile_options = %Q[/Zi /c /Fo"%{outfile}" %{flags} "%{infile}"] + compiler.preprocess_options = %Q[/EP %{flags} "%{infile}" > "%{outfile}"] + compiler.cxx_compile_flag = '/TP' + compiler.cxx_exception_flag = '/EHs' end conf.linker do |linker| |
