Skip to content

Commit d155062

Browse files
marc-hblgirdwood
authored andcommitted
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>
1 parent 016b555 commit d155062

1 file changed

Lines changed: 34 additions & 7 deletions

File tree

scripts/build-tools.sh

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ SOF_TOP=$(cd "$(dirname "$0")/.." && pwd)
1010
print_usage()
1111
{
1212
cat <<EOFUSAGE
13-
Deletes and re-builds from scratch CMake projects in the tools/
14-
directory.
15-
Attention: the list below is _not_ exhaustive. To re-build _everything_
16-
from scratch don't select any particular target; this will build the
13+
14+
Configures and builds selected CMake projects in the tools/ directory.
15+
Attention: the list of selected shortcuts below is _not_ exhaustive. To
16+
build _everything_ don't select any particular target; this will build
1717
CMake's default target "ALL".
1818
1919
usage: $0 [-c|-f|-h|-l|-p|-t|-T]
@@ -28,6 +28,8 @@ usage: $0 [-c|-f|-h|-l|-p|-t|-T]
2828
2929
-C No build, only CMake re-configuration. Shows CMake targets.
3030
EOFUSAGE
31+
32+
warn_if_incremental_build
3133
}
3234

3335
# generate Makefiles
@@ -82,6 +84,20 @@ Build commands for respective tools:
8284
list of targets:
8385
ninja -C "$BUILD_TOOLS_DIR/" help
8486
EOFUSAGE
87+
88+
warn_if_incremental_build
89+
}
90+
91+
warn_if_incremental_build()
92+
{
93+
$warn_incremental_build || return 0
94+
cat <<EOF
95+
96+
WARNING: building tools/ is now incremental by default!
97+
To build from scratch delete: $BUILD_TOOLS_DIR
98+
or use the -C option.
99+
100+
EOF
85101
}
86102

87103
main()
@@ -107,6 +123,9 @@ main()
107123
DO_BUILD_topologies=false
108124
CMAKE_ONLY=false
109125

126+
# better safe than sorry
127+
local warn_incremental_build=true
128+
110129
# eval is a sometimes necessary evil
111130
# shellcheck disable=SC2034
112131
while getopts "cfhlptTC" OPTION; do
@@ -123,19 +142,25 @@ main()
123142
esac
124143
done
125144
shift "$((OPTIND - 1))"
126-
reconfigure_build
127145

128146
if "$CMAKE_ONLY"; then
147+
reconfigure_build
129148
print_build_info
130149
exit
131150
fi
132151

152+
if ! test -e "$BUILD_TOOLS_DIR"/CMakeCache.txt; then
153+
warn_incremental_build=false
154+
reconfigure_build
155+
fi
156+
133157
if "$BUILD_ALL"; then
134158
# default CMake targets
135159
make_tool # trust set -e
136160

137-
make_fuzzer
138-
exit $?
161+
make_fuzzer # trust set -e
162+
warn_if_incremental_build
163+
exit 0
139164
fi
140165

141166
# Keep 'topologies' first because it's the noisiest.
@@ -154,6 +179,8 @@ main()
154179
if "$DO_BUILD_fuzzer"; then
155180
make_fuzzer
156181
fi
182+
183+
warn_if_incremental_build
157184
}
158185

159186
main "$@"

0 commit comments

Comments
 (0)