summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-09-16 10:39:52 +0100
committerLeah Rowe <leah@libreboot.org>2026-09-16 10:39:52 +0100
commitd165f14a4dffaa3c5619bdba5a09f2c90e14b78b (patch)
treef1c3cd4a86781f1518046a0c633c3417bfc11756
parent5afd77433d3ae7a172ef2fe9d4173c897ee65707 (diff)
mk: general cleanup and awk appreciation
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rwxr-xr-xmk34
1 files changed, 13 insertions, 21 deletions
diff --git a/mk b/mk
index cab5f96c..c99a0c50 100755
--- a/mk
+++ b/mk
@@ -419,7 +419,16 @@ project_up_to_date()
eval "[ \"\$$badhashvar\" = \"y\" ] && return 1"; :
}
-check_cross_compiler()
+prep_multi_tree_build()
+{
+ dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
+
+ $if_not_dry_build elfcheck || return 1 # skip if a build exists
+ $if_not_dry_build eval "$(printf '%s\n' "$xarch" | awk \
+ '{ for (i=1; i<=NF; i++) $i = "check_xgcc \""$i"\";"; print }')"
+}
+
+check_xgcc()
{
cbdir="src/coreboot/$tree"
@@ -457,19 +466,6 @@ check_cross_compiler()
x_ touch "$xgccfile" # prevent unnecessary re-build operations
}
-prep_multi_tree_build()
-{
- dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
-
- $if_not_dry_build elfcheck || \
- return 1 # skip if a build exists
-
- for _xarch in $xarch; do
- [ -n "$_xarch" ] && $if_not_dry_build \
- check_cross_compiler "$_xarch"; :
- done; :
-}
-
elfcheck()
{
# TODO: *STILL* very hacky check. do it properly (based on build.list)
@@ -479,25 +475,21 @@ elfcheck()
handle_makefile()
{
- if $if_not_dry_build check_makefile "$srcdir"; then
+ check_makefile "$srcdir" && \
$if_not_dry_build \
x_ make -C "$srcdir" clean $cleanargs
- fi
[ -f "$defconfig" ] && \
x_ cp "$defconfig" "$srcdir/.config"
- run_make_command || \
- err "no makefile!" "handle_makefile" "$@"
+ run_make_command || err "no makefile!" "handle_makefile" "$@"
_copy=".config"
-
[ "$mode" = "savedefconfig" ] && \
_copy="defconfig"
$if_make_config \
- $if_not_dry_build \
- x_ cp "$srcdir/$_copy" "$defconfig"; :
+ x_ cp "$srcdir/$_copy" "$defconfig"; :
}
run_make_command()