tree.sh: convert do_make into a macro

use it similarly to if_dry_build/if_not_dry_build

there is nothing cooler than an sh macro

:

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-10-17 13:29:56 +01:00
parent 47f08e2e6d
commit 96f786b962
+12 -14
View File
@@ -10,6 +10,8 @@ flag=""
# macros, overridden depending on the flag # macros, overridden depending on the flag
if_dry_build=":" if_dry_build=":"
if_not_dry_build="" if_not_dry_build=""
if_do_make=""
if_not_do_make=":"
autoconfargs="" autoconfargs=""
autogenargs="" autogenargs=""
@@ -23,7 +25,6 @@ cmakedir=""
cmd="" cmd=""
defconfig="" defconfig=""
dest_dir="" dest_dir=""
do_make=""
elfdir="" elfdir=""
forcepull="" forcepull=""
gccdir="" gccdir=""
@@ -84,12 +85,16 @@ trees()
-c) mode="distclean" ;; -c) mode="distclean" ;;
-x) mode="crossgcc-clean" ;; -x) mode="crossgcc-clean" ;;
-f) # download source code for a project -f) # download source code for a project
do_make="n" # lets us know not to build anything # macros. colon means false.
if_do_make=":"
if_not_do_make=""
if_not_dry_build=":" if_not_dry_build=":"
if_dry_build="" if_dry_build=""
;; ;;
-F) # same as -F, but don't skip git fetch/pull on cache -F) # same as -F, but don't skip git fetch/pull on cache
do_make="n" # lets us know not to build anything # macros. colon means false
if_do_make=":"
if_not_do_make=""
if_not_dry_build=":" if_not_dry_build=":"
if_dry_build="" if_dry_build=""
forcepull="y" forcepull="y"
@@ -319,12 +324,8 @@ configure_project()
break break
fi fi
if [ "$do_make" != "n" ]; then $if_do_make \
# if we're *downloading* a project, then
# we don't need to to change the target.cfg
break break
fi
if [ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] if [ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ]
then then
# we have found the main source tree that # we have found the main source tree that
@@ -356,14 +357,11 @@ configure_project()
if [ ! -f "CHANGELOG" ]; then if [ ! -f "CHANGELOG" ]; then
delete_old_project_files delete_old_project_files
fi $if_not_do_make \
if [ "$do_make" = "n" ]; then
if [ ! -f "CHANGELOG" ]; then
fetch_${cmd#build_} fetch_${cmd#build_}
fi
return 1
fi fi
$if_not_do_make \
return 1
x_ ./mk -f "$project" "$target" x_ ./mk -f "$project" "$target"
} }