diff options
Diffstat (limited to 'py/waf/rtems_config.py')
-rw-r--r-- | py/waf/rtems_config.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/py/waf/rtems_config.py b/py/waf/rtems_config.py new file mode 100644 index 0000000000..8c8e21d04c --- /dev/null +++ b/py/waf/rtems_config.py @@ -0,0 +1,62 @@ + + +# --- ANYTHING ABOVE THIS LINE IS AUTOGENERATED --- +from argparse import ArgumentParser + +def arg_print(args): + print(" ".join(args)) + +parser = ArgumentParser(description="RTEMS %s Configuration" % RTEMS_VERSION) +parser.add_argument('--version', action='version', version=RTEMS_VERSION) + +compiler = parser.add_argument_group('BSP Settings / Information') +compiler.add_argument('--bsp', action="store", help="BSP to show options for, use --list for a list.", nargs=1) +compiler.add_argument('--list', action="store_true", help="List available BSPs.") +compiler.add_argument('--list-format', action="store", help="List available bsps using LIST_FORMAT. (default: %%(arch)s/%%(bsp)s)", default=False, nargs="?") + +compiler = parser.add_argument_group('Compiler Arguments') +compiler_e = compiler.add_mutually_exclusive_group() +compiler_e.add_argument('--cflags', action="store_true", help="C Flags.") +compiler_e.add_argument('--libs', action="store_true", help="Libraries used for linking.") +compiler_e.add_argument('--ldflags', action="store_true", help="Linker flags.") + +args = parser.parse_args() + + +if args.list is True: + print("List of Installed BSPs") + print("~~~~~~~~~~~~~~~~~~~~~~") + for b in sorted(BSP_LIST): + print("%-16s %s" % (b, BSP_LIST[b]["description"])) + exit(0) + + +if args.list_format is not False: + if args.list_format is None: + args.list_format = "%(arch)s/%(bsp)s" + + tmp = [] + for b in sorted(BSP_LIST): + arch, bsp = b.split("/") + tmp.append(args.list_format % {"arch": arch, "bsp": bsp}) + print(" ".join(tmp)) + exit(0) + + +if args.bsp is not None: + bsp = args.bsp[0] #XXX: Why is this a list? + + if bsp not in BSP_LIST: + print("Unknown BSP \"%s\", use --list." % bsp) + exit(1) + + if args.cflags is True: + arg_print(BSP_LIST[bsp]["cflags"]) + elif args.libs is True: + arg_print(BSP_LIST[bsp]["libs"]) + elif args.ldflags is True: + arg_print(BSP_LIST[bsp]["ldflags"]) + exit(0) + + +#parser.print_usage() |