From d0bd12631a6bb4d3035fa85e4446d128de803b0f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 11 Apr 2025 04:44:24 +0100 Subject: 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 --- script/trees | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'script/trees') diff --git a/script/trees b/script/trees index 3b4cce15..1907dea9 100755 --- a/script/trees +++ b/script/trees @@ -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 -- cgit v1.2.1