bake-toolkit 1.8.0.1 → 2.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bake +14 -53
- data/bin/bakery +50 -43
- data/bin/createVSProjects +3 -3
- data/doc/cmd/install.html +1 -5
- data/doc/cmd/usecmd.html +29 -5
- data/doc/dyk/lint.html +21 -4
- data/doc/dyk/tipps.html +0 -6
- data/doc/eclipse/import.html +3 -1
- data/doc/eclipse/import/Import.png +0 -0
- data/doc/eclipse/use.html +8 -5
- data/doc/further/change.html +134 -1
- data/doc/further/issues.html +1 -0
- data/doc/further/wish.html +24 -21
- data/doc/index.html +1 -1
- data/doc/syntax/subst.html +8 -1
- data/doc/syntax/syntax.html +42 -14
- data/lib/bake/cache.rb +51 -59
- data/lib/bake/config/loader.rb +289 -0
- data/lib/bake/libElement.rb +134 -0
- data/lib/bake/mergeConfig.rb +1 -1
- data/lib/bake/model/language.rb +1 -1
- data/lib/bake/model/loader.rb +88 -0
- data/lib/bake/model/metamodel.rb +24 -16
- data/lib/bake/model/metamodel_ext.rb +9 -4
- data/lib/bake/options/options.rb +222 -0
- data/lib/bake/options/showConfigNames.rb +44 -0
- data/lib/bake/options/showDoc.rb +19 -0
- data/lib/bake/options/showLicense.rb +9 -0
- data/lib/bake/options/showToolchains.rb +39 -0
- data/lib/bake/options/usage.rb +54 -0
- data/lib/bake/process_output.rb +10 -0
- data/lib/bake/subst.rb +105 -40
- data/lib/bake/toolchain/clang.rb +44 -0
- data/lib/bake/toolchain/colorizing_formatter.rb +125 -0
- data/lib/bake/toolchain/diab.rb +53 -0
- data/lib/bake/toolchain/errorparser/diab_compiler_error_parser.rb +40 -0
- data/lib/bake/toolchain/errorparser/diab_linker_error_parser.rb +41 -0
- data/lib/bake/toolchain/errorparser/error_parser.rb +71 -0
- data/lib/bake/toolchain/errorparser/gcc_compiler_error_parser.rb +35 -0
- data/lib/bake/toolchain/errorparser/gcc_linker_error_parser.rb +35 -0
- data/lib/bake/toolchain/errorparser/greenhills_compiler_error_parser.rb +32 -0
- data/lib/bake/toolchain/errorparser/greenhills_linker_error_parser.rb +44 -0
- data/lib/bake/toolchain/errorparser/keil_compiler_error_parser.rb +40 -0
- data/lib/bake/toolchain/errorparser/keil_linker_error_parser.rb +30 -0
- data/lib/bake/toolchain/errorparser/lint_error_parser.rb +34 -0
- data/lib/bake/toolchain/errorparser/process_output.rb +3 -0
- data/lib/bake/toolchain/errorparser/ti_compiler_error_parser.rb +30 -0
- data/lib/bake/toolchain/errorparser/ti_linker_error_parser.rb +30 -0
- data/lib/bake/toolchain/gcc.rb +49 -0
- data/lib/bake/toolchain/gcc_param.rb +7 -0
- data/lib/bake/toolchain/greenhills.rb +52 -0
- data/lib/bake/toolchain/keil.rb +55 -0
- data/lib/bake/toolchain/lint.rb +20 -0
- data/lib/bake/toolchain/provider.rb +136 -0
- data/lib/bake/toolchain/ti.rb +47 -0
- data/lib/bake/util.rb +27 -15
- data/lib/bakery/buildPattern.rb +1 -1
- data/lib/bakery/model/language.rb +1 -1
- data/lib/bakery/model/loader.rb +56 -0
- data/lib/bakery/model/metamodel.rb +1 -1
- data/lib/bakery/options/options.rb +87 -0
- data/lib/bakery/toBake.rb +10 -6
- data/lib/blocks/block.rb +225 -0
- data/lib/blocks/blockBase.rb +155 -0
- data/lib/blocks/commandLine.rb +25 -0
- data/lib/blocks/compile.rb +382 -0
- data/lib/blocks/docu.rb +28 -0
- data/lib/blocks/executable.rb +143 -0
- data/lib/blocks/has_execute_command.rb +31 -0
- data/lib/blocks/library.rb +78 -0
- data/lib/blocks/lint.rb +53 -0
- data/lib/blocks/makefile.rb +87 -0
- data/lib/blocks/showIncludes.rb +114 -0
- data/lib/common/abortException.rb +4 -0
- data/lib/common/cleanup.rb +9 -0
- data/lib/common/exit_helper.rb +28 -0
- data/lib/common/ext/file.rb +88 -0
- data/lib/common/ext/stdout.rb +45 -0
- data/lib/common/ide_interface.rb +194 -0
- data/lib/common/options/option.rb +13 -0
- data/lib/common/options/parser.rb +59 -0
- data/lib/common/process.rb +64 -0
- data/lib/common/utils.rb +52 -0
- data/lib/{bake → common}/version.rb +3 -10
- data/lib/multithread/job.rb +44 -0
- data/lib/tocxx.rb +201 -932
- data/lib/vs/options.rb +3 -2
- data/license.txt +47 -22
- metadata +90 -30
- data/bin/bake-doc +0 -12
- data/lib/alias/loader.rb +0 -56
- data/lib/alias/model/language.rb +0 -22
- data/lib/alias/model/metamodel.rb +0 -29
- data/lib/bake/loader.rb +0 -92
- data/lib/bake/options.rb +0 -421
- data/lib/bakery/loader.rb +0 -57
- data/lib/bakery/options.rb +0 -105
- data/lib/option/parser.rb +0 -73
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'bake/toolchain/errorparser/error_parser'
|
2
|
+
|
3
|
+
module Bake
|
4
|
+
class TICompilerErrorParser < ErrorParser
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@error_expression = /\"([^,^\"]+)\", line ([0-9]+)[:0-9]* (catastrophic |fatal )*([A-Za-z]+): (.+)/
|
8
|
+
end
|
9
|
+
|
10
|
+
def scan_lines(consoleOutput, proj_dir)
|
11
|
+
res = []
|
12
|
+
consoleOutputFullnames = ""
|
13
|
+
consoleOutput.each_line do |l|
|
14
|
+
d = ErrorDesc.new
|
15
|
+
scan_res = l.gsub(/\r\n?/, "").scan(@error_expression)
|
16
|
+
if scan_res.length > 0
|
17
|
+
d.file_name = File.expand_path(scan_res[0][0])
|
18
|
+
d.line_number = scan_res[0][1].to_i
|
19
|
+
d.message = scan_res[0][4]
|
20
|
+
d.severity = get_severity(scan_res[0][3])
|
21
|
+
l.gsub!(scan_res[0][0],d.file_name)
|
22
|
+
end
|
23
|
+
res << d
|
24
|
+
consoleOutputFullnames << l
|
25
|
+
end
|
26
|
+
[res, consoleOutputFullnames]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'bake/toolchain/errorparser/error_parser'
|
2
|
+
|
3
|
+
module Bake
|
4
|
+
class TILinkerErrorParser < ErrorParser
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
# todo: is every line an error?
|
8
|
+
# todo: some linker errors look like simple text, dunno how to parse properly...
|
9
|
+
# @error_expression1 = /(.*:\(\..*\)): (.*)/ # e.g. /c/Tool/Temp/ccAlar4R.o:x.cpp:(.text+0x17): undefined reference to `_a'
|
10
|
+
# @error_expression2 = /(.*):([0-9]+): (.*)/ # e.g. /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld:roodi.yml.a:1: syntax error
|
11
|
+
end
|
12
|
+
|
13
|
+
def scan_lines(consoleOutput, proj_dir)
|
14
|
+
res = []
|
15
|
+
consoleOutput.each_line do |l|
|
16
|
+
l.rstrip!
|
17
|
+
d = ErrorDesc.new
|
18
|
+
if l != "<Linking>" then
|
19
|
+
d.file_name = proj_dir
|
20
|
+
d.line_number = 0
|
21
|
+
d.message = l
|
22
|
+
d.severity = SEVERITY_ERROR
|
23
|
+
end
|
24
|
+
res << d
|
25
|
+
end
|
26
|
+
[res, consoleOutput]
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'common/utils'
|
2
|
+
require 'bake/toolchain/provider'
|
3
|
+
require 'bake/toolchain/errorparser/error_parser'
|
4
|
+
require 'bake/toolchain/errorparser/gcc_compiler_error_parser'
|
5
|
+
require 'bake/toolchain/errorparser/gcc_linker_error_parser'
|
6
|
+
|
7
|
+
module Bake
|
8
|
+
module Toolchain
|
9
|
+
|
10
|
+
GCCChain = Provider.add("GCC")
|
11
|
+
|
12
|
+
GCCChain[:COMPILER][:CPP].update({
|
13
|
+
:COMMAND => "g++",
|
14
|
+
:DEFINE_FLAG => "-D",
|
15
|
+
:OBJECT_FILE_FLAG => "-o",
|
16
|
+
:OBJ_FLAG_SPACE => true,
|
17
|
+
:INCLUDE_PATH_FLAG => "-I",
|
18
|
+
:COMPILE_FLAGS => "-c ",
|
19
|
+
:DEP_FLAGS => "-MD -MF",
|
20
|
+
:DEP_FLAGS_SPACE => true,
|
21
|
+
:PREPRO_FLAGS => "-E -P"
|
22
|
+
})
|
23
|
+
|
24
|
+
GCCChain[:COMPILER][:C] = Utils.deep_copy(GCCChain[:COMPILER][:CPP])
|
25
|
+
GCCChain[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
|
26
|
+
GCCChain[:COMPILER][:C][:COMMAND] = "gcc"
|
27
|
+
|
28
|
+
GCCChain[:COMPILER][:ASM] = Utils.deep_copy(GCCChain[:COMPILER][:C])
|
29
|
+
GCCChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
|
30
|
+
|
31
|
+
GCCChain[:ARCHIVER][:COMMAND] = "ar"
|
32
|
+
GCCChain[:ARCHIVER][:ARCHIVE_FLAGS] = "-rc"
|
33
|
+
|
34
|
+
GCCChain[:LINKER][:COMMAND] = "g++"
|
35
|
+
GCCChain[:LINKER][:SCRIPT] = "-T"
|
36
|
+
GCCChain[:LINKER][:USER_LIB_FLAG] = "-l:"
|
37
|
+
GCCChain[:LINKER][:EXE_FLAG] = "-o"
|
38
|
+
GCCChain[:LINKER][:LIB_FLAG] = "-l"
|
39
|
+
GCCChain[:LINKER][:LIB_PATH_FLAG] = "-L"
|
40
|
+
|
41
|
+
gccCompilerErrorParser = GCCCompilerErrorParser.new
|
42
|
+
GCCChain[:COMPILER][:C][:ERROR_PARSER] = gccCompilerErrorParser
|
43
|
+
GCCChain[:COMPILER][:CPP][:ERROR_PARSER] = gccCompilerErrorParser
|
44
|
+
GCCChain[:COMPILER][:ASM][:ERROR_PARSER] = gccCompilerErrorParser
|
45
|
+
GCCChain[:ARCHIVER][:ERROR_PARSER] = gccCompilerErrorParser
|
46
|
+
GCCChain[:LINKER][:ERROR_PARSER] = GCCLinkerErrorParser.new
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'bake/toolchain/provider'
|
2
|
+
require 'common/utils'
|
3
|
+
require 'bake/toolchain/errorparser/greenhills_compiler_error_parser'
|
4
|
+
require 'bake/toolchain/errorparser/greenhills_linker_error_parser'
|
5
|
+
|
6
|
+
module Bake
|
7
|
+
module Toolchain
|
8
|
+
|
9
|
+
GreenHillsChain = Provider.add("GreenHills")
|
10
|
+
|
11
|
+
GreenHillsChain[:COMPILER][:C].update({
|
12
|
+
:COMMAND => "cxppc",
|
13
|
+
:FLAGS => "",
|
14
|
+
:DEFINE_FLAG => "-D",
|
15
|
+
:OBJECT_FILE_FLAG => "-o",
|
16
|
+
:OBJ_FLAG_SPACE => true,
|
17
|
+
:INCLUDE_PATH_FLAG => "-I",
|
18
|
+
:COMPILE_FLAGS => "-c",
|
19
|
+
:DEP_FLAGS => "-MD",
|
20
|
+
:DEP_FLAGS_FILENAME => false,
|
21
|
+
:PREPRO_FLAGS => "-P"
|
22
|
+
})
|
23
|
+
|
24
|
+
GreenHillsChain[:COMPILER][:CPP] = Utils.deep_copy(GreenHillsChain[:COMPILER][:C])
|
25
|
+
GreenHillsChain[:COMPILER][:CPP][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:CPP][:SOURCE_FILE_ENDINGS]
|
26
|
+
|
27
|
+
GreenHillsChain[:COMPILER][:ASM] = Utils.deep_copy(GreenHillsChain[:COMPILER][:C])
|
28
|
+
GreenHillsChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
|
29
|
+
GreenHillsChain[:COMPILER][:ASM][:PREPRO_FLAGS] = ""
|
30
|
+
|
31
|
+
GreenHillsChain[:ARCHIVER][:COMMAND] = "cxppc"
|
32
|
+
GreenHillsChain[:ARCHIVER][:ARCHIVE_FLAGS] = "-archive -o"
|
33
|
+
|
34
|
+
GreenHillsChain[:LINKER][:COMMAND] = "cxppc" # ??
|
35
|
+
GreenHillsChain[:LINKER][:SCRIPT] = "-T" # -T file.ld
|
36
|
+
GreenHillsChain[:LINKER][:USER_LIB_FLAG] = "-l" # user lib not supported? same as lib...
|
37
|
+
GreenHillsChain[:LINKER][:EXE_FLAG] = "-o"
|
38
|
+
GreenHillsChain[:LINKER][:LIB_FLAG] = "-l"
|
39
|
+
GreenHillsChain[:LINKER][:LIB_PATH_FLAG] = "-L"
|
40
|
+
GreenHillsChain[:LINKER][:MAP_FILE_FLAG] = "-map=" # -map=filename
|
41
|
+
GreenHillsChain[:LINKER][:MAP_FILE_PIPE] = false
|
42
|
+
GreenHillsChain[:LINKER][:OUTPUT_ENDING] = ".elf"
|
43
|
+
|
44
|
+
GreenHillsCompilerErrorParser = GreenHillsCompilerErrorParser.new
|
45
|
+
GreenHillsChain[:COMPILER][:C][:ERROR_PARSER] = GreenHillsCompilerErrorParser
|
46
|
+
GreenHillsChain[:COMPILER][:CPP][:ERROR_PARSER] = GreenHillsCompilerErrorParser
|
47
|
+
GreenHillsChain[:COMPILER][:ASM][:ERROR_PARSER] = GreenHillsCompilerErrorParser
|
48
|
+
GreenHillsChain[:ARCHIVER][:ERROR_PARSER] = GreenHillsCompilerErrorParser
|
49
|
+
GreenHillsChain[:LINKER][:ERROR_PARSER] = GreenHillsLinkerErrorParser.new
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'common/utils'
|
2
|
+
require 'bake/toolchain/provider'
|
3
|
+
require 'bake/toolchain/errorparser/error_parser'
|
4
|
+
require 'bake/toolchain/errorparser/keil_compiler_error_parser'
|
5
|
+
require 'bake/toolchain/errorparser/keil_linker_error_parser'
|
6
|
+
|
7
|
+
module Bake
|
8
|
+
module Toolchain
|
9
|
+
|
10
|
+
KeilChain = Provider.add("Keil")
|
11
|
+
|
12
|
+
KeilChain[:COMPILER][:CPP].update({
|
13
|
+
:COMMAND => "armcc",
|
14
|
+
:DEFINE_FLAG => "-D",
|
15
|
+
:OBJECT_FILE_FLAG => "-o",
|
16
|
+
:OBJ_FLAG_SPACE => true,
|
17
|
+
:INCLUDE_PATH_FLAG => "-I",
|
18
|
+
:COMPILE_FLAGS => "-c ",
|
19
|
+
:DEP_FLAGS => "--depend=",
|
20
|
+
:DEP_FLAGS_SPACE => false,
|
21
|
+
:PREPRO_FLAGS => "-E -P"
|
22
|
+
})
|
23
|
+
|
24
|
+
KeilChain[:COMPILER][:C] = Utils.deep_copy(KeilChain[:COMPILER][:CPP])
|
25
|
+
KeilChain[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
|
26
|
+
|
27
|
+
KeilChain[:COMPILER][:ASM] = Utils.deep_copy(KeilChain[:COMPILER][:C])
|
28
|
+
KeilChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
|
29
|
+
KeilChain[:COMPILER][:ASM][:COMMAND] = "armasm"
|
30
|
+
KeilChain[:COMPILER][:ASM][:COMPILE_FLAGS] = ""
|
31
|
+
|
32
|
+
KeilChain[:COMPILER][:DEP_FILE_SINGLE_LINE] = true
|
33
|
+
|
34
|
+
KeilChain[:ARCHIVER][:COMMAND] = "armar"
|
35
|
+
KeilChain[:ARCHIVER][:ARCHIVE_FLAGS] = "--create"
|
36
|
+
|
37
|
+
KeilChain[:LINKER][:COMMAND] = "armlink"
|
38
|
+
KeilChain[:LINKER][:SCRIPT] = "--scatter"
|
39
|
+
KeilChain[:LINKER][:USER_LIB_FLAG] = ""
|
40
|
+
KeilChain[:LINKER][:EXE_FLAG] = "-o"
|
41
|
+
KeilChain[:LINKER][:LIB_FLAG] = ""
|
42
|
+
KeilChain[:LINKER][:LIB_PATH_FLAG] = "--userlibpath="
|
43
|
+
KeilChain[:LINKER][:MAP_FILE_FLAG] = "--map --list="
|
44
|
+
KeilChain[:LINKER][:MAP_FILE_PIPE] = false
|
45
|
+
KeilChain[:LINKER][:LIST_MODE] = true
|
46
|
+
|
47
|
+
keilCompilerErrorParser = KeilCompilerErrorParser.new
|
48
|
+
KeilChain[:COMPILER][:C][:ERROR_PARSER] = keilCompilerErrorParser
|
49
|
+
KeilChain[:COMPILER][:CPP][:ERROR_PARSER] = keilCompilerErrorParser
|
50
|
+
KeilChain[:COMPILER][:ASM][:ERROR_PARSER] = keilCompilerErrorParser
|
51
|
+
KeilChain[:ARCHIVER][:ERROR_PARSER] = keilCompilerErrorParser
|
52
|
+
KeilChain[:LINKER][:ERROR_PARSER] = KeilLinkerErrorParser.new
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'common/utils'
|
2
|
+
require 'bake/toolchain/provider'
|
3
|
+
require 'bake/toolchain/errorparser/lint_error_parser'
|
4
|
+
|
5
|
+
module Bake
|
6
|
+
module Toolchain
|
7
|
+
|
8
|
+
LintChain = Provider.add("Lint")
|
9
|
+
|
10
|
+
LintChain[:COMPILER][:CPP].update({
|
11
|
+
:COMMAND => "lint-nt.exe",
|
12
|
+
:DEFINE_FLAG => "-D",
|
13
|
+
:INCLUDE_PATH_FLAG => "-I",
|
14
|
+
:COMPILE_FLAGS => ["-b","-\"format=%f%(:%l:%) %t %n: %m\"", "-width(0)", "-hF1"], # array, not string!
|
15
|
+
})
|
16
|
+
|
17
|
+
LintChain[:COMPILER][:CPP][:ERROR_PARSER] = LintErrorParser.new
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
module Bake
|
2
|
+
module Toolchain
|
3
|
+
|
4
|
+
class Provider
|
5
|
+
@@settings = {}
|
6
|
+
@@default = {
|
7
|
+
:COMPILER =>
|
8
|
+
{
|
9
|
+
:CPP => {
|
10
|
+
:COMMAND => "",
|
11
|
+
:DEFINE_FLAG => "",
|
12
|
+
:OBJECT_FILE_FLAG => "",
|
13
|
+
:OBJ_FLAG_SPACE => false,
|
14
|
+
:INCLUDE_PATH_FLAG => "",
|
15
|
+
:COMPILE_FLAGS => "",
|
16
|
+
:DEFINES => [],
|
17
|
+
:FLAGS => "",
|
18
|
+
:SOURCE_FILE_ENDINGS => [".cxx", ".cpp", ".c++", ".cc", ".C"],
|
19
|
+
:DEP_FLAGS => "",
|
20
|
+
:DEP_FLAGS_SPACE => false,
|
21
|
+
:DEP_FLAGS_FILENAME => true,
|
22
|
+
:ERROR_PARSER => nil,
|
23
|
+
:PREPRO_FLAGS => ""
|
24
|
+
},
|
25
|
+
:C => {
|
26
|
+
:COMMAND => "",
|
27
|
+
:DEFINE_FLAG => "",
|
28
|
+
:OBJECT_FILE_FLAG => "",
|
29
|
+
:OBJ_FLAG_SPACE => false,
|
30
|
+
:INCLUDE_PATH_FLAG => "",
|
31
|
+
:COMPILE_FLAGS => "",
|
32
|
+
:DEFINES => [],
|
33
|
+
:FLAGS => "",
|
34
|
+
:SOURCE_FILE_ENDINGS => [".c"],
|
35
|
+
:DEP_FLAGS => "",
|
36
|
+
:DEP_FLAGS_SPACE => false,
|
37
|
+
:DEP_FLAGS_FILENAME => true,
|
38
|
+
:ERROR_PARSER => nil,
|
39
|
+
:PREPRO_FLAGS => ""
|
40
|
+
},
|
41
|
+
:ASM => {
|
42
|
+
:COMMAND => "",
|
43
|
+
:DEFINE_FLAG => "",
|
44
|
+
:OBJECT_FILE_FLAG => "",
|
45
|
+
:OBJ_FLAG_SPACE => false,
|
46
|
+
:INCLUDE_PATH_FLAG => "",
|
47
|
+
:COMPILE_FLAGS => "",
|
48
|
+
:DEFINES => [],
|
49
|
+
:FLAGS => "",
|
50
|
+
:SOURCE_FILE_ENDINGS => [".asm", ".s", ".S"],
|
51
|
+
:DEP_FLAGS => "",
|
52
|
+
:DEP_FLAGS_SPACE => false,
|
53
|
+
:DEP_FLAGS_FILENAME => true,
|
54
|
+
:ERROR_PARSER => nil,
|
55
|
+
:PREPRO_FLAGS => ""
|
56
|
+
}
|
57
|
+
},
|
58
|
+
|
59
|
+
:ARCHIVER =>
|
60
|
+
{
|
61
|
+
:COMMAND => "",
|
62
|
+
:ARCHIVE_FLAGS => "",
|
63
|
+
:FLAGS => "",
|
64
|
+
:ERROR_PARSER => nil
|
65
|
+
},
|
66
|
+
|
67
|
+
:LINKER =>
|
68
|
+
{
|
69
|
+
:COMMAND => "",
|
70
|
+
:MUST_FLAGS => "",
|
71
|
+
:SCRIPT => "",
|
72
|
+
:USER_LIB_FLAG => "",
|
73
|
+
:EXE_FLAG => "",
|
74
|
+
:LIB_FLAG => "",
|
75
|
+
:LIB_PATH_FLAG => "",
|
76
|
+
:LIB_PREFIX_FLAGS => "", # "-Wl,--whole-archive",
|
77
|
+
:LIB_POSTFIX_FLAGS => "", # "-Wl,--no-whole-archive",
|
78
|
+
:FLAGS => "",
|
79
|
+
:MAP_FILE_FLAG => "",
|
80
|
+
:MAP_FILE_PIPE => true,
|
81
|
+
:OUTPUT_ENDING => ".exe", # or .elf
|
82
|
+
:ERROR_PARSER => nil,
|
83
|
+
:LIST_MODE => false
|
84
|
+
},
|
85
|
+
|
86
|
+
:MAKE =>
|
87
|
+
{
|
88
|
+
:COMMAND => "make",
|
89
|
+
:FLAGS => "-j",
|
90
|
+
:FILE_FLAG => "-f",
|
91
|
+
:DIR_FLAG => "-C",
|
92
|
+
:CLEAN => "clean"
|
93
|
+
},
|
94
|
+
|
95
|
+
:LINT_POLICY => [],
|
96
|
+
:DOCU => "",
|
97
|
+
:DEP_FILE_SINGLE_LINE => false
|
98
|
+
}
|
99
|
+
|
100
|
+
def self.add(name, basedOn = nil)
|
101
|
+
chain = Marshal.load(Marshal.dump(basedOn.nil? ? @@default : @@settings[basedOn]))
|
102
|
+
@@settings[name] = chain
|
103
|
+
chain
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.default
|
107
|
+
@@default
|
108
|
+
end
|
109
|
+
|
110
|
+
def self.modify_cpp_compiler(based_on, h)
|
111
|
+
chain = Marshal.load(Marshal.dump(@@settings[based_on]))
|
112
|
+
chain[:COMPILER][:CPP].update(h)
|
113
|
+
chain
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.[](name)
|
117
|
+
return @@settings[name] if @@settings.include? name
|
118
|
+
nil
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.list
|
122
|
+
return @@settings.delete_if {|x| x.include?"Lint" }
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
require 'bake/toolchain/diab'
|
131
|
+
require 'bake/toolchain/gcc'
|
132
|
+
require 'bake/toolchain/lint'
|
133
|
+
require 'bake/toolchain/clang'
|
134
|
+
require 'bake/toolchain/ti'
|
135
|
+
require 'bake/toolchain/greenhills'
|
136
|
+
require 'bake/toolchain/keil'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'common/utils'
|
2
|
+
require 'bake/toolchain/provider'
|
3
|
+
require 'bake/toolchain/errorparser/error_parser'
|
4
|
+
require 'bake/toolchain/errorparser/ti_compiler_error_parser'
|
5
|
+
require 'bake/toolchain/errorparser/ti_linker_error_parser'
|
6
|
+
|
7
|
+
module Bake
|
8
|
+
module Toolchain
|
9
|
+
|
10
|
+
TiChain = Provider.add("TI")
|
11
|
+
|
12
|
+
TiChain[:COMPILER][:CPP].update({
|
13
|
+
:COMMAND => "ti_cl",
|
14
|
+
:FLAGS => "",
|
15
|
+
:DEFINE_FLAG => "--define=",
|
16
|
+
:OBJECT_FILE_FLAG => "--output_file=",
|
17
|
+
:INCLUDE_PATH_FLAG => "--include_path=",
|
18
|
+
:COMPILE_FLAGS => "-c ",
|
19
|
+
:DEP_FLAGS => "--preproc_dependency=",
|
20
|
+
:DEP_FLAGS_SPACE => false
|
21
|
+
})
|
22
|
+
|
23
|
+
TiChain[:COMPILER][:C] = Utils.deep_copy(TiChain[:COMPILER][:CPP])
|
24
|
+
TiChain[:COMPILER][:C][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:C][:SOURCE_FILE_ENDINGS]
|
25
|
+
|
26
|
+
TiChain[:COMPILER][:ASM] = Utils.deep_copy(TiChain[:COMPILER][:C])
|
27
|
+
TiChain[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS] = Provider.default[:COMPILER][:ASM][:SOURCE_FILE_ENDINGS]
|
28
|
+
|
29
|
+
TiChain[:ARCHIVER][:COMMAND] = "ti_ar"
|
30
|
+
TiChain[:ARCHIVER][:ARCHIVE_FLAGS] = "r"
|
31
|
+
|
32
|
+
TiChain[:LINKER][:COMMAND] = "ti_cl"
|
33
|
+
TiChain[:LINKER][:FLAGS] = ""
|
34
|
+
TiChain[:LINKER][:MAP_FILE_FLAG] = '-m'
|
35
|
+
TiChain[:LINKER][:EXE_FLAG] = "-o"
|
36
|
+
TiChain[:LINKER][:LIB_FLAG] = "-l"
|
37
|
+
TiChain[:LINKER][:LIB_PATH_FLAG] = "-i"
|
38
|
+
|
39
|
+
tiCompilerErrorParser = TICompilerErrorParser.new
|
40
|
+
TiChain[:COMPILER][:C][:ERROR_PARSER] = tiCompilerErrorParser
|
41
|
+
TiChain[:COMPILER][:CPP][:ERROR_PARSER] = tiCompilerErrorParser
|
42
|
+
TiChain[:COMPILER][:ASM][:ERROR_PARSER] = tiCompilerErrorParser
|
43
|
+
TiChain[:ARCHIVER][:ERROR_PARSER] = tiCompilerErrorParser
|
44
|
+
TiChain[:LINKER][:ERROR_PARSER] = TILinkerErrorParser.new
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
data/lib/bake/util.rb
CHANGED
@@ -1,32 +1,37 @@
|
|
1
1
|
require 'bake/model/metamodel_ext'
|
2
2
|
require 'bake/model/metamodel'
|
3
3
|
require 'set'
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
4
|
+
require 'bake/toolchain/colorizing_formatter'
|
5
|
+
require 'common/exit_helper'
|
6
|
+
require 'common/utils'
|
7
|
+
|
8
|
+
|
9
|
+
def remove_empty_strings_and_join(a, j=' ')
|
10
|
+
return a.reject{|e|e.to_s.empty?}.join(j)
|
11
|
+
end
|
7
12
|
|
8
13
|
def adjustFlags(orgStr, flags)
|
9
|
-
orgSplitted =
|
14
|
+
orgSplitted = Bake::Utils::flagSplit(orgStr, false)
|
10
15
|
|
11
16
|
flags.each do |f|
|
12
17
|
if f.overwrite != ""
|
13
|
-
orgSplitted =
|
18
|
+
orgSplitted = Bake::Utils::flagSplit(f.overwrite, false)
|
14
19
|
end
|
15
20
|
|
16
21
|
if f.remove != ""
|
17
|
-
rmSplitted =
|
22
|
+
rmSplitted = Bake::Utils::flagSplit(f.remove, false)
|
18
23
|
orgSplitted.delete_if {|o| rmSplitted.any? { |r|
|
19
24
|
begin
|
20
25
|
o.match("\\A"+r+"\\Z")
|
21
26
|
rescue Exception => e
|
22
|
-
|
23
|
-
|
27
|
+
Bake.formatter.printError(e.message, f)
|
28
|
+
Bake::ExitHelper.exit(1)
|
24
29
|
end
|
25
30
|
}}
|
26
31
|
end
|
27
32
|
|
28
33
|
if f.add != ""
|
29
|
-
|
34
|
+
Bake::Utils::flagSplit(f.add, false).each do |a|
|
30
35
|
orgSplitted << a unless orgSplitted.any? { |o| o==a }
|
31
36
|
end
|
32
37
|
end
|
@@ -46,6 +51,7 @@ def integrateToolchain(tcs, toolchain)
|
|
46
51
|
integrateCompiler(tcs, c, c.ctype)
|
47
52
|
end
|
48
53
|
integrateLintPolicy(tcs, toolchain.lintPolicy)
|
54
|
+
integrateDocu(tcs, toolchain.docu) if toolchain.docu
|
49
55
|
end
|
50
56
|
|
51
57
|
def integrateLintPolicy(tcs, policies)
|
@@ -54,6 +60,10 @@ def integrateLintPolicy(tcs, policies)
|
|
54
60
|
end
|
55
61
|
end
|
56
62
|
|
63
|
+
def integrateDocu(tcs, docu)
|
64
|
+
tcs[:DOCU] = docu.name if docu.name != ""
|
65
|
+
end
|
66
|
+
|
57
67
|
def integrateLinker(tcs, linker)
|
58
68
|
return tcs unless linker
|
59
69
|
tcs[:LINKER][:COMMAND] = linker.command if linker.command != ""
|
@@ -75,7 +85,7 @@ def integrateCompiler(tcs, compiler, type)
|
|
75
85
|
end
|
76
86
|
tcs[:COMPILER][type][:FLAGS] = adjustFlags(tcs[:COMPILER][type][:FLAGS], compiler.flags)
|
77
87
|
compiler.define.each do |d|
|
78
|
-
tcs[:COMPILER][type][:DEFINES] << d.str
|
88
|
+
tcs[:COMPILER][type][:DEFINES] << d.str unless tcs[:COMPILER][type][:DEFINES].include? d.str
|
79
89
|
end
|
80
90
|
end
|
81
91
|
|
@@ -118,11 +128,13 @@ def calc_def_roots(dir)
|
|
118
128
|
rootsFile = searchRootsFile(dir)
|
119
129
|
if (rootsFile)
|
120
130
|
File.open(rootsFile).each do |line|
|
121
|
-
line.gsub
|
122
|
-
if
|
123
|
-
|
124
|
-
|
125
|
-
|
131
|
+
line = line.split("#")[0].strip.gsub(/[\\]/,'/')
|
132
|
+
if line != ""
|
133
|
+
if File.is_absolute?(line)
|
134
|
+
def_roots << line
|
135
|
+
else
|
136
|
+
def_roots << File.dirname(rootsFile) + "/" + line
|
137
|
+
end
|
126
138
|
end
|
127
139
|
end
|
128
140
|
else
|