From ced80d2b4b1ed4ef0752a8bbaf0dbfe7aa6c6a95 Mon Sep 17 00:00:00 2001 From: Yuichiro MASUI Date: Sun, 20 Jan 2013 22:48:42 +0900 Subject: Improved build scripts and config files --- tasks/toolchains/clang.rake | 6 ++++++ tasks/toolchains/gcc.rake | 21 +++++++++++++++++++++ tasks/toolchains/vs2012.rake | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 tasks/toolchains/clang.rake create mode 100644 tasks/toolchains/gcc.rake create mode 100644 tasks/toolchains/vs2012.rake (limited to 'tasks/toolchains') diff --git a/tasks/toolchains/clang.rake b/tasks/toolchains/clang.rake new file mode 100644 index 000000000..01dd5f234 --- /dev/null +++ b/tasks/toolchains/clang.rake @@ -0,0 +1,6 @@ +MRuby::Toolchain.new(:clang) do |conf| + toolchain :gcc + + conf.cc.command = ENV['CC'] || 'clang' + conf.linker.command = ENV['LD'] || 'clang' +end diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake new file mode 100644 index 000000000..c624c8fc9 --- /dev/null +++ b/tasks/toolchains/gcc.rake @@ -0,0 +1,21 @@ +MRuby::Toolchain.new(:gcc) do |conf| + conf.cc do |cc| + cc.command = ENV['CC'] || 'gcc' + cc.flags = [ENV['CFLAGS'] || %w(-g -O3 -Wall -Werror-implicit-function-declaration)] + cc.include_paths = ["#{root}/include"] + cc.defines = %w(DISABLE_GEMS) + cc.option_include_path = '-I%s' + cc.option_define = '-D%s' + cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}' + end + + conf.linker do |linker| + linker.command = ENV['LD'] || 'gcc' + linker.flags = [ENV['LDFLAGS'] || %w()] + linker.libraries = %w(m) + linker.library_paths = [] + linker.option_library = '-l%s' + linker.option_library_path = '-L%s' + linker.link_options = '%{flags} -o %{outfile} %{objs} %{libs}' + end +end diff --git a/tasks/toolchains/vs2012.rake b/tasks/toolchains/vs2012.rake new file mode 100644 index 000000000..8b4212468 --- /dev/null +++ b/tasks/toolchains/vs2012.rake @@ -0,0 +1,44 @@ +MRuby::Toolchain.new(:vs2012) do |conf| + conf.cc do |cc| + cc.command = ENV['CC'] || 'cl.exe' + cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DDISABLE_GEMS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)] + cc.include_paths = ["#{root}/include"] + cc.defines = %w(DISABLE_GEMS) + cc.option_include_path = '-I%s' + cc.option_define = '-D%s' + cc.compile_options = "%{flags} /Fo%{outfile} -c %{infile}" + end + + conf.linker do |linker| + linker.command = ENV['LD'] || 'link.exe' + linker.flags = [ENV['LDFLAGS'] || %w(/nologo)] + linkerraries = %w(kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32 ole32 oleaut32 uuid odbc32 odbccp32) + linkerrary_paths = [] + linker.option_library = '-l%s' + linker.option_library_path = '-L%s' + linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{libs}" + end + + conf.archiver do |archiver| + archiver.command = ENV['AR'] || 'lib.exe' + archiver.archive_options = '/OUT:%{outfile} %{objs}' + end + + conf.yacc do |yacc| + yacc.command = ENV['YACC'] || 'bison.exe' + yacc.compile_options = '-o %{outfile} %{infile}' + end + + conf.gperf do |gperf| + gperf.command = 'gperf.exe' + gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}' + end + + conf.exts do |exts| + exts.object = '.obj' + exts.executable = '.exe' + exts.library = '.lib' + end + + conf.file_separator = '\\' +end -- cgit v1.2.3