1 | # shellcheck disable=SC1091
|
---|
2 | # shellcheck disable=SC2086 # we want word splitting
|
---|
3 | if command -V ccache >/dev/null 2>/dev/null; then
|
---|
4 | CCACHE=ccache
|
---|
5 | else
|
---|
6 | CCACHE=
|
---|
7 | fi
|
---|
8 |
|
---|
9 | if echo "$@" | grep -E 'meson-private/tmp[^ /]*/testfile.c' >/dev/null; then
|
---|
10 | # Invoked for meson feature check
|
---|
11 | exec $CCACHE $_COMPILER "$@"
|
---|
12 | fi
|
---|
13 |
|
---|
14 | if [ "$(eval printf "'%s'" "\"\${$(($#-1))}\"")" = "-c" ]; then
|
---|
15 | # Not invoked for linking
|
---|
16 | exec $CCACHE $_COMPILER "$@"
|
---|
17 | fi
|
---|
18 |
|
---|
19 | # Compiler invoked by ninja for linking. Add -Werror to turn compiler warnings into errors
|
---|
20 | # with LTO. (meson's werror should arguably do this, but meanwhile we need to)
|
---|
21 | exec $CCACHE $_COMPILER "$@" -Werror
|
---|