scripts/build-tools.sh: switch to incremental build by default

Faster build and focused and readable logs at last.

Add a warning not to surprise anyone.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2022-09-27 05:46:21 +00:00 committed by Liam Girdwood
parent 016b555a06
commit d155062195
1 changed files with 34 additions and 7 deletions

View File

@ -10,10 +10,10 @@ SOF_TOP=$(cd "$(dirname "$0")/.." && pwd)
print_usage() print_usage()
{ {
cat <<EOFUSAGE cat <<EOFUSAGE
Deletes and re-builds from scratch CMake projects in the tools/
directory. Configures and builds selected CMake projects in the tools/ directory.
Attention: the list below is _not_ exhaustive. To re-build _everything_ Attention: the list of selected shortcuts below is _not_ exhaustive. To
from scratch don't select any particular target; this will build the build _everything_ don't select any particular target; this will build
CMake's default target "ALL". CMake's default target "ALL".
usage: $0 [-c|-f|-h|-l|-p|-t|-T] usage: $0 [-c|-f|-h|-l|-p|-t|-T]
@ -28,6 +28,8 @@ usage: $0 [-c|-f|-h|-l|-p|-t|-T]
-C No build, only CMake re-configuration. Shows CMake targets. -C No build, only CMake re-configuration. Shows CMake targets.
EOFUSAGE EOFUSAGE
warn_if_incremental_build
} }
# generate Makefiles # generate Makefiles
@ -82,6 +84,20 @@ Build commands for respective tools:
list of targets: list of targets:
ninja -C "$BUILD_TOOLS_DIR/" help ninja -C "$BUILD_TOOLS_DIR/" help
EOFUSAGE EOFUSAGE
warn_if_incremental_build
}
warn_if_incremental_build()
{
$warn_incremental_build || return 0
cat <<EOF
WARNING: building tools/ is now incremental by default!
To build from scratch delete: $BUILD_TOOLS_DIR
or use the -C option.
EOF
} }
main() main()
@ -107,6 +123,9 @@ main()
DO_BUILD_topologies=false DO_BUILD_topologies=false
CMAKE_ONLY=false CMAKE_ONLY=false
# better safe than sorry
local warn_incremental_build=true
# eval is a sometimes necessary evil # eval is a sometimes necessary evil
# shellcheck disable=SC2034 # shellcheck disable=SC2034
while getopts "cfhlptTC" OPTION; do while getopts "cfhlptTC" OPTION; do
@ -123,19 +142,25 @@ main()
esac esac
done done
shift "$((OPTIND - 1))" shift "$((OPTIND - 1))"
reconfigure_build
if "$CMAKE_ONLY"; then if "$CMAKE_ONLY"; then
reconfigure_build
print_build_info print_build_info
exit exit
fi fi
if ! test -e "$BUILD_TOOLS_DIR"/CMakeCache.txt; then
warn_incremental_build=false
reconfigure_build
fi
if "$BUILD_ALL"; then if "$BUILD_ALL"; then
# default CMake targets # default CMake targets
make_tool # trust set -e make_tool # trust set -e
make_fuzzer make_fuzzer # trust set -e
exit $? warn_if_incremental_build
exit 0
fi fi
# Keep 'topologies' first because it's the noisiest. # Keep 'topologies' first because it's the noisiest.
@ -154,6 +179,8 @@ main()
if "$DO_BUILD_fuzzer"; then if "$DO_BUILD_fuzzer"; then
make_fuzzer make_fuzzer
fi fi
warn_if_incremental_build
} }
main "$@" main "$@"