mk: clean up getopt flags

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-09-15 21:11:51 +01:00
parent 50eec6d485
commit 6a5b4c98d6
+10 -16
View File
@@ -85,7 +85,7 @@ eval "`newvar autoconfargs autogenargs badhash badtghash bootstrapargs \
main() main()
{ {
flags="f:F:b:m:u:c:x:s:l:n:d:" flags="f:F:b:m:u:s:l:n:d:"
while getopts $flags option while getopts $flags option
do do
@@ -98,28 +98,19 @@ main()
# ./mk -m coreboot does: make menuconfig -C src/coreboot/tree # ./mk -m coreboot does: make menuconfig -C src/coreboot/tree
case "$flag" in case "$flag" in
-d) -b) : ;; # build a source tree
# -d is similar to -b, except that -d) # dry builds. -d is like -b but skips many build steps
# a large number of operations will be
# skipped. these are "if_not_dry_build build" scenarios
# where only a subset of build tasks are done,
# and $if_not_dry_build is prefixed to skipped commands
if_dry_build="" if_dry_build=""
if_not_dry_build=":" if_not_dry_build=":"
;; ;;
-b) : ;;
-u) mode="oldconfig" ;;
-m) mode="menuconfig" ;;
-f|-F) # download source code for a project -f|-F) # download source code for a project
# macros. colon means false.
if_do_make=":"
if_dry_build="" if_dry_build=""
if_not_do_make=""
if_not_dry_build=":" if_not_dry_build=":"
[ "$flag" = "-F" ] && \ [ "$flag" = "-F" ] && \
forcepull="y"; : # never skip git fetch/pull forcepull="y"; : # never skip git fetch/pull
;; ;;
-u) mode="oldconfig" ;;
-m) mode="menuconfig" ;;
-s) mode="savedefconfig" ;; -s) mode="savedefconfig" ;;
-l) mode="olddefconfig" ;; -l) mode="olddefconfig" ;;
-n) mode="nconfig" ;; -n) mode="nconfig" ;;
@@ -130,11 +121,14 @@ main()
if_build="" if_build=""
if_not_build=":" if_not_build=":"
fi fi
if [ "${mode%config}" != "$mode" ]; then if [ "${mode%config}" != "$mode" ]; then
if_make_config="" if_make_config=""
if_not_make_config=":" if_not_make_config=":"
fi fi
if [ "$flag" = "-F" ] || [ "$flag" = "-f" ]; then
if_do_make=":"
if_not_do_make=""
fi
if [ -z "${OPTARG+x}" ]; then if [ -z "${OPTARG+x}" ]; then
shift 1 shift 1
@@ -533,7 +527,7 @@ run_make_command()
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
) || err "run_make_file" "$@" ) || err "run_make_command" "$@"
$if_build \ $if_build \
x_ $mkhelper; : x_ $mkhelper; :