diff options
| author | Hiroshi Mimaki <[email protected]> | 2019-10-18 14:46:03 +0900 |
|---|---|---|
| committer | Hiroshi Mimaki <[email protected]> | 2019-10-18 14:46:03 +0900 |
| commit | b6546835457d1935a9c77965686b2a1256874d96 (patch) | |
| tree | 724cfd71a7c956b0648e8c58f3717d797fff5f29 /tasks | |
| parent | 8ee516436b8d174a50764939bee23a442aa00b3f (diff) | |
| parent | 20d01f118ddb7e7f2f36926a7a3db35573611857 (diff) | |
| download | mruby-b6546835457d1935a9c77965686b2a1256874d96.tar.gz mruby-b6546835457d1935a9c77965686b2a1256874d96.zip | |
Merge master.
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/doc.rake | 48 | ||||
| -rw-r--r-- | tasks/toolchains/clang.rake | 7 | ||||
| -rw-r--r-- | tasks/toolchains/gcc.rake | 39 | ||||
| -rw-r--r-- | tasks/toolchains/visualcpp.rake | 12 |
4 files changed, 71 insertions, 35 deletions
diff --git a/tasks/doc.rake b/tasks/doc.rake new file mode 100644 index 000000000..4aec2d0a1 --- /dev/null +++ b/tasks/doc.rake @@ -0,0 +1,48 @@ +desc 'generate document' +task :doc => [:api_doc, :capi_doc] do + +end + +desc 'generate yard docs' +task :api_doc do + begin + sh "mrbdoc" + rescue + puts "ERROR: To generate yard documentation, you should install yard-mruby gem." + puts " $ gem install yard-mruby yard-coderay" + end +end + +desc 'generate doxygen docs' +task :capi_doc do + begin + sh "doxygen Doxyfile" + rescue + puts "ERROR: To generate C API documents, you need Doxygen." + puts " $ sudo apt-get install doxygen" + end +end + +desc 'clean all built docs' +task :clean_api_doc do + FileUtils.rm_rf 'doc/api' +end + +desc 'clean all built docs' +task :clean_capi_doc do + FileUtils.rm_rf 'doc/capi' +end + +desc 'clean all built docs' +task :clean_doc => [:clean_api_doc, :clean_capi_doc] do +end + +desc 'clean all built docs' +task :view_api => [:api_doc] do + sh 'xdg-open doc/api/index.html' +end + +desc 'clean all built docs' +task :view_capi => [:capi_doc] do + sh 'xdg-open doc/capi/html/index.html' +end diff --git a/tasks/toolchains/clang.rake b/tasks/toolchains/clang.rake index 2832dad5f..543cb73db 100644 --- a/tasks/toolchains/clang.rake +++ b/tasks/toolchains/clang.rake @@ -1,9 +1,8 @@ MRuby::Toolchain.new(:clang) do |conf, _params| - toolchain :gcc + toolchain :gcc, default_command: 'clang' [conf.cc, conf.objc, conf.asm].each do |cc| - cc.command = ENV['CC'] || 'clang' + cc.flags << '-Wzero-length-array' unless ENV['CFLAGS'] end - conf.cxx.command = ENV['CXX'] || 'clang++' - conf.linker.command = ENV['LD'] || ENV['CXX'] || ENV['CC'] || 'clang' + conf.cxx.flags << '-Wzero-length-array' unless ENV['CXXFLAGS'] || ENV['CFLAGS'] end diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake index 663fef9e6..1a28026bf 100644 --- a/tasks/toolchains/gcc.rake +++ b/tasks/toolchains/gcc.rake @@ -1,26 +1,27 @@ -MRuby::Toolchain.new(:gcc) do |conf, _params| - [conf.cc, conf.objc, conf.asm].each do |cc| - cc.command = ENV['CC'] || 'gcc' - 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 +MRuby::Toolchain.new(:gcc) do |conf, params| + default_command = params[:default_command] || 'gcc' + compiler_flags = %w(-g -O3 -Wall -Wundef) + c_mandatory_flags = %w(-std=gnu99) + cxx_invalid_flags = %w(-Wdeclaration-after-statement -Werror-implicit-function-declaration) - [conf.cxx].each do |cxx| - cxx.command = ENV['CXX'] || 'g++' - cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(-g -O3 -Wall -Werror-implicit-function-declaration -Wundef)] - cxx.option_include_path = '-I%s' - cxx.option_define = '-D%s' - cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}' - cxx.cxx_compile_flag = '-x c++ -std=c++03' - cxx.cxx_exception_flag = '-fexceptions' + [conf.cc, conf.objc, conf.asm, conf.cxx].each do |compiler| + if compiler == conf.cxx + compiler.command = ENV['CXX'] || default_command.sub(/cc|$/, '++') + compiler.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || compiler_flags] + else + compiler.command = ENV['CC'] || default_command + compiler.flags = [c_mandatory_flags, ENV['CFLAGS'] || [compiler_flags, cxx_invalid_flags, %w(-Wwrite-strings)]] + 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' + compiler.cxx_invalid_flags = c_mandatory_flags + cxx_invalid_flags end 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.libraries = %w(m) linker.library_paths = [] diff --git a/tasks/toolchains/visualcpp.rake b/tasks/toolchains/visualcpp.rake index 6275059bb..c5f295130 100644 --- a/tasks/toolchains/visualcpp.rake +++ b/tasks/toolchains/visualcpp.rake @@ -54,16 +54,4 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params| end conf.file_separator = '\\' - - # Unreliable detection and will result in invalid encoding errors for localized versions of Visual C++ - # if require 'open3' - # Open3.popen3 conf.cc.command do |_, _, e, _| - # if /Version (\d{2})\.\d{2}\.\d{5}/ =~ e.gets && $1.to_i <= 17 - # m = "# VS2010/2012 support will be dropped after the next release! #" - # h = "#" * m.length - # puts h, m, h - # end - # end - # end - end |
