summaryrefslogtreecommitdiff
path: root/py/waf/rtems_config.py
blob: 8c8e21d04c9958db1bd975e354a6ff2aad54e526 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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()