diff --git a/tools/build_all.py b/tools/build_all.py index af57cdd5c..9581104e1 100644 --- a/tools/build_all.py +++ b/tools/build_all.py @@ -14,26 +14,33 @@ total_time = time.monotonic() build_format = '| {:23} | {:30} | {:9} | {:7} | {:6} | {:6} |' build_separator = '-' * 100 -# 1st Argument is Example, build all examples if not existed +# If examples are not specified in arguments, build all all_examples = [] + +for entry in os.scandir("examples/device"): + if entry.is_dir(): + all_examples.append(entry.name) + if len(sys.argv) > 1: - all_examples.append(sys.argv[1]) -else: - for entry in os.scandir("examples/device"): - if entry.is_dir(): - all_examples.append(entry.name) + input_examples = list(set(all_examples).intersection(sys.argv)) + if len(input_examples) > 0: + all_examples = input_examples + all_examples.sort() -# 2nd Argument is Board, build all boards if not existed +# If boards are not specified in arguments, build all all_boards = [] -if len(sys.argv) > 2: - all_boards.append(sys.argv[2]) -else: - for entry in os.scandir("hw/bsp"): - if entry.is_dir(): - all_boards.append(entry.name) -all_boards.sort() +for entry in os.scandir("hw/bsp"): + if entry.is_dir(): + all_boards.append(entry.name) + +if len(sys.argv) > 1: + input_boards = list(set(all_boards).intersection(sys.argv)) + if len(input_boards) > 0: + all_boards = input_boards + +all_boards.sort() def build_example(example, board): subprocess.run("make -C examples/device/{} BOARD={} clean".format(example, board), shell=True, diff --git a/tools/build_esp32s.py b/tools/build_esp32s.py index 0708ced80..9600b6145 100644 --- a/tools/build_esp32s.py +++ b/tools/build_esp32s.py @@ -42,7 +42,7 @@ all_boards.sort() def build_example(example, board): subprocess.run("make -C examples/device/{} BOARD={} clean".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - return subprocess.run("make -j 4 -C examples/device/{} BOARD={} all".format(example, board), shell=True, + return subprocess.run("make -C examples/device/{} BOARD={} all".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) def build_size(example, board):