diff options
| author | Yuichiro MASUI <[email protected]> | 2013-01-21 14:05:42 +0900 |
|---|---|---|
| committer | Yuichiro MASUI <[email protected]> | 2013-01-21 14:05:42 +0900 |
| commit | 117e2ec06544e02511a2b5d2164edb00908ebab2 (patch) | |
| tree | aafad33075fbf614a9a9fe2bce84e8f435e6ef4c /tasks/mruby_build_commands.rake | |
| parent | 0defb59053ccd1e6c8637149329989ae81e46c71 (diff) | |
| download | mruby-117e2ec06544e02511a2b5d2164edb00908ebab2.tar.gz mruby-117e2ec06544e02511a2b5d2164edb00908ebab2.zip | |
Export build flags to lib/libmruby.flags.mak
Diffstat (limited to 'tasks/mruby_build_commands.rake')
| -rw-r--r-- | tasks/mruby_build_commands.rake | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake index 7014d5a20..7f9b50313 100644 --- a/tasks/mruby_build_commands.rake +++ b/tasks/mruby_build_commands.rake @@ -45,12 +45,16 @@ module MRuby @option_define = '-D%s' @compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}" end + + def all_flags(_defineds=[], _include_paths=[], _flags=[]) + define_flags = [defines, _defineds].flatten.map{ |d| option_define % d } + include_path_flags = [include_paths, _include_paths].flatten.map{ |f| option_include_path % filename(f) } + [flags, define_flags, include_path_flags, _flags].flatten.join(' ') + end def run(outfile, infile, _defineds=[], _include_paths=[], _flags=[]) FileUtils.mkdir_p File.dirname(outfile) - define_flags = [defines, _defineds].flatten.map{ |d| option_define % d } - include_path_flags = [include_paths, _include_paths, File.dirname(infile)].flatten.map{ |f| option_include_path % filename(f) } - _run compile_options, { :flags => [flags, define_flags, include_path_flags, _flags].flatten.join(' '), :infile => filename(infile), :outfile => filename(outfile) } + _run compile_options, { :flags => all_flags(_defineds, [_include_paths, File.dirname(infile)], _flags), :infile => filename(infile), :outfile => filename(outfile) } end def define_rules(build_dir, source_dir='') @@ -108,11 +112,18 @@ module MRuby @link_options = "%{flags} -o %{outfile} %{objs} %{libs}" end + def all_flags(_library_paths=[], _flags=[]) + library_path_flags = [library_paths, _library_paths].flatten.map{ |f| option_library_path % filename(f) } + [flags, library_path_flags, _flags].flatten.join(' ') + end + + def library_flags(_libraries) + [libraries, _libraries].flatten.reverse.map{ |d| option_library % d }.join(' ') + end + def run(outfile, objfiles, _libraries=[], _library_paths=[], _flags=[]) FileUtils.mkdir_p File.dirname(outfile) - library_flags = [libraries, _libraries].flatten.reverse.map{ |d| option_library % d } - library_path_flags = [library_paths, _library_paths].flatten.map{ |f| option_library_path % filename(f) } - _run link_options, { :flags => [flags, library_path_flags, _flags].flatten.join(' '), :outfile => filename(outfile) , :objs => filename(objfiles).join(' '), :libs => library_flags.join(' ') } + _run link_options, { :flags => all_flags(_library_paths, _flags), :outfile => filename(outfile) , :objs => filename(objfiles).join(' '), :libs => library_flags(_libraries) } end end |
