Skip to content

Commit 948eb29

Browse files
committed
kbuild: fixup! wrap toolchain with ccache
- redeclaring the variable inside a command wont work since they are already defined in FLAGS so recalling it would overide the declaration - added some other related toolchain to ccache Signed-off-by: UsiFX <xprjkts@gmail.com>
1 parent e36e734 commit 948eb29

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

kbuilder.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,15 @@ for arg in "$@"; do
164164

165165
# Full build
166166
if command -v ccache &> /dev/null; then
167-
PATH="/usr/lib/ccache/bin:${PATH}" make CC="ccache ${CC}" "${DEFCONFIG}" all -j$(nproc --all --ignore=2) "${FLAGS[@]}"
167+
# Wrap toolchain with ccache in array listing
168+
for i in "${!FLAGS[@]}"; do
169+
case "${FLAGS[$i]}" in
170+
CC=clang) FLAGS[$i]="CC=ccache clang" ;;
171+
HOSTCC=clang) FLAGS[$i]="HOSTCC=ccache clang" ;;
172+
HOSTCXX=clang++) FLAGS[$i]="HOSTCXX=ccache clang++" ;;
173+
esac
174+
done
175+
PATH="/usr/lib/ccache/bin:${PATH}" make "${DEFCONFIG}" all -j$(nproc --all --ignore=2) "${FLAGS[@]}"
168176
else
169177
make "${DEFCONFIG}" all -j$(nproc --all --ignore=2) "${FLAGS[@]}"
170178
fi

0 commit comments

Comments
 (0)