trees: don't abuse the mode variable on -f

The "mode" variable is used as a suffix for make commands,
for example ./mk -m sets mode to "menuconfig", which means
you want to run "make menuconfig".

When fetching sources (./mk -f), I was setting mode to "fetch",
and putting checks in code to avoid use of make when mode was
set to "fetch".

The behaviour now is identical, except that a new variable
called "do_make" is set to "n" when doing ./mk -f, otherwise
set to "y", and this is checked instead. This should make
the meaning of the code somewhat clearer.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-04-11 04:44:24 +01:00
parent c4cd876c60
commit d0bd12631a
+7 -3
View File
@@ -17,6 +17,10 @@ eval "`setvars "" xarch srcdir premake gnatdir xlang mode makeargs elfdir cmd \
defconfig postmake mkhelpercfg dry dest_dir mdir cleanargs gccver gccfull \
gnatver gnatfull gccdir cmakedir`"; badhash="n"
# ./mk -f will set this to "n", thus
# disabling the use of make commands
do_make="y"
main()
{
while getopts f:b:m:u:c:x:s:l:n:d: option; do
@@ -30,7 +34,7 @@ main()
-m) mode="menuconfig" ;;
-c) mode="distclean" ;;
-x) mode="crossgcc-clean" ;;
-f) mode="fetch" ;;
-f) do_make="n" ;;
-s) mode="savedefconfig" ;;
-l) mode="olddefconfig" ;;
-n) mode="nconfig" ;;
@@ -145,7 +149,7 @@ configure_project()
[ "$_f" = "-d" ] && build_depend="" # dry run
[ "$cmd" = "build_project" ] && break
[ "$mode" = "fetch" ] || break
[ "$do_make" = "y" ] && break
[ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \
&& break
@@ -159,7 +163,7 @@ configure_project()
[ -n "$tree" ] && mdir="$mdir/$tree"
[ -f "CHANGELOG" ] || check_project_hashes
if [ "$mode" != "fetch" ]; then
if [ "$do_make" = "y" ]; then
x_ ./mk -f "$project" "$target"
return 0
fi