diff --git a/tools/build/make.py b/tools/build/make.py index 7ae6a95e8c23..74454aa51b08 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -48,6 +48,24 @@ from pathlib import Path +# List of targets that are independent of TARGET/TARGET_ARCH and thus do not +# need them to be set. Keep in the same order as Makefile documents them (if +# they are documented). +mach_indep_targets = [ + "cleanuniverse", + "universe", + "universe-toolchain", + "tinderbox" + "worlds", + "kernels", + "kernel-toolchains", + "targets", + "toolchains", + "makeman", + "sysent", +] + + def run(cmd, **kwargs): cmd = list(map(str, cmd)) # convert all Path objects to str debug("Running", cmd) @@ -190,7 +208,7 @@ def default_cross_toolchain(): new_env_vars = {} if not sys.platform.startswith("freebsd"): if not is_make_var_set("TARGET") or not is_make_var_set("TARGET_ARCH"): - if "universe" not in sys.argv and "tinderbox" not in sys.argv: + if not set(sys.argv).intersection(set(mach_indep_targets)): sys.exit("TARGET= and TARGET_ARCH= must be set explicitly " "when building on non-FreeBSD") if not parsed_args.bootstrap_toolchain: