Clone of official tools

Committer:
screamer
Date:
Thu Jul 14 20:21:19 2016 +0100
Revision:
13:ab47a20b66f0
Parent:
0:66f3b5499f7f
Child:
22:9e85236d8716
Apply latest tools

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:66f3b5499f7f 1 """
screamer 0:66f3b5499f7f 2 mbed SDK
screamer 0:66f3b5499f7f 3 Copyright (c) 2011-2013 ARM Limited
screamer 0:66f3b5499f7f 4
screamer 0:66f3b5499f7f 5 Licensed under the Apache License, Version 2.0 (the "License");
screamer 0:66f3b5499f7f 6 you may not use this file except in compliance with the License.
screamer 0:66f3b5499f7f 7 You may obtain a copy of the License at
screamer 0:66f3b5499f7f 8
screamer 0:66f3b5499f7f 9 http://www.apache.org/licenses/LICENSE-2.0
screamer 0:66f3b5499f7f 10
screamer 0:66f3b5499f7f 11 Unless required by applicable law or agreed to in writing, software
screamer 0:66f3b5499f7f 12 distributed under the License is distributed on an "AS IS" BASIS,
screamer 0:66f3b5499f7f 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
screamer 0:66f3b5499f7f 14 See the License for the specific language governing permissions and
screamer 0:66f3b5499f7f 15 limitations under the License.
screamer 0:66f3b5499f7f 16 """
screamer 0:66f3b5499f7f 17 from optparse import OptionParser
screamer 0:66f3b5499f7f 18 from tools.toolchains import TOOLCHAINS
screamer 0:66f3b5499f7f 19 from tools.targets import TARGET_NAMES
screamer 0:66f3b5499f7f 20
screamer 0:66f3b5499f7f 21
screamer 13:ab47a20b66f0 22 def get_default_options_parser(add_clean=True, add_options=True):
screamer 0:66f3b5499f7f 23 parser = OptionParser()
screamer 0:66f3b5499f7f 24
screamer 0:66f3b5499f7f 25 targetnames = TARGET_NAMES
screamer 0:66f3b5499f7f 26 targetnames.sort()
screamer 0:66f3b5499f7f 27 toolchainlist = list(TOOLCHAINS)
screamer 0:66f3b5499f7f 28 toolchainlist.sort()
screamer 0:66f3b5499f7f 29
screamer 0:66f3b5499f7f 30 parser.add_option("-m", "--mcu",
screamer 0:66f3b5499f7f 31 help="build for the given MCU (%s)" % ', '.join(targetnames),
screamer 0:66f3b5499f7f 32 metavar="MCU")
screamer 0:66f3b5499f7f 33
screamer 0:66f3b5499f7f 34 parser.add_option("-t", "--tool",
screamer 0:66f3b5499f7f 35 help="build using the given TOOLCHAIN (%s)" % ', '.join(toolchainlist),
screamer 0:66f3b5499f7f 36 metavar="TOOLCHAIN")
screamer 0:66f3b5499f7f 37
screamer 13:ab47a20b66f0 38 if add_clean:
screamer 13:ab47a20b66f0 39 parser.add_option("-c", "--clean", action="store_true", default=False,
screamer 13:ab47a20b66f0 40 help="clean the build directory")
screamer 0:66f3b5499f7f 41
screamer 13:ab47a20b66f0 42 if add_options:
screamer 13:ab47a20b66f0 43 parser.add_option("-o", "--options", action="append",
screamer 13:ab47a20b66f0 44 help='Add a build option ("save-asm": save the asm generated by the compiler, "debug-info": generate debugging information, "analyze": run Goanna static code analyzer")')
screamer 0:66f3b5499f7f 45
screamer 0:66f3b5499f7f 46 return parser