Clone of official tools

Committer:
screamer
Date:
Thu May 19 19:44:41 2016 +0100
Revision:
0:66f3b5499f7f
Child:
13:ab47a20b66f0
Initial revision

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 0:66f3b5499f7f 22 def get_default_options_parser():
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 0:66f3b5499f7f 38 parser.add_option("-c", "--clean", action="store_true", default=False,
screamer 0:66f3b5499f7f 39 help="clean the build directory")
screamer 0:66f3b5499f7f 40
screamer 0:66f3b5499f7f 41 parser.add_option("-o", "--options", action="append",
screamer 0:66f3b5499f7f 42 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 43
screamer 0:66f3b5499f7f 44 return parser