1 | MRuby::Gem::Specification.new 'mruby-compiler' do |spec|
|
---|
2 | spec.license = 'MIT'
|
---|
3 | spec.author = 'mruby developers'
|
---|
4 | spec.summary = 'mruby compiler library'
|
---|
5 |
|
---|
6 | current_dir = spec.dir
|
---|
7 | current_build_dir = spec.build_dir
|
---|
8 |
|
---|
9 | lex_def = "#{current_dir}/core/lex.def"
|
---|
10 | core_objs = Dir.glob("#{current_dir}/core/*.c").map { |f|
|
---|
11 | next nil if build.cxx_abi_enabled? and f =~ /(codegen).c$/
|
---|
12 | objfile(f.pathmap("#{current_build_dir}/core/%n"))
|
---|
13 | }.compact
|
---|
14 |
|
---|
15 | if build.cxx_abi_enabled?
|
---|
16 | core_objs <<
|
---|
17 | build.compile_as_cxx("#{current_build_dir}/core/y.tab.c", "#{current_build_dir}/core/y.tab.cxx",
|
---|
18 | objfile("#{current_build_dir}/y.tab"), ["#{current_dir}/core"]) <<
|
---|
19 | build.compile_as_cxx("#{current_dir}/core/codegen.c", "#{current_build_dir}/core/codegen.cxx")
|
---|
20 | else
|
---|
21 | core_objs << objfile("#{current_build_dir}/core/y.tab")
|
---|
22 | file objfile("#{current_build_dir}/core/y.tab") => "#{current_build_dir}/core/y.tab.c" do |t|
|
---|
23 | cc.run t.name, t.prerequisites.first, [], ["#{current_dir}/core"]
|
---|
24 | end
|
---|
25 | end
|
---|
26 | file objfile("#{current_build_dir}/core/y.tab") => lex_def
|
---|
27 |
|
---|
28 | # Parser
|
---|
29 | file "#{current_build_dir}/core/y.tab.c" => ["#{current_dir}/core/parse.y"] do |t|
|
---|
30 | yacc.run t.name, t.prerequisites.first
|
---|
31 | end
|
---|
32 |
|
---|
33 | # Lexical analyzer
|
---|
34 | file lex_def => "#{current_dir}/core/keywords" do |t|
|
---|
35 | gperf.run t.name, t.prerequisites.first
|
---|
36 | end
|
---|
37 |
|
---|
38 | file libfile("#{build.build_dir}/lib/libmruby_core") => core_objs
|
---|
39 | build.libmruby << core_objs
|
---|
40 | end
|
---|