Diff options
-rwxr-xr-xtools/build-development.sh9
1 file changed, 7 insertions, 2 deletions
diff --git a/tools/build-development.sh b/tools/build-development.sh
index d340057..00ff569 100755
--- a/tools/build-development.sh
+++ b/tools/build-development.sh
@@ -22,6 +22,11 @@ cd "$(dirname "$0")/.."
# vendor/git.
make cleanall
+# Named once, so the probe and the build use the same compiler. CC goes on
+# make's command line because git's Makefile sets it, which would override
+# the one from the environment.
+CC=${CC:-cc}
+
# OpenBSD's compiler has no AddressSanitizer, so the build falls back to the
# undefined behaviour checks alone, and to no sanitizer where neither links.
probe=$(mktemp "${TMPDIR:-/tmp}/cgit-probe.XXXXXX")
@@ -30,13 +35,13 @@ printf 'int main(void){return 0;}\n' >"$probe.c"
sanitize=""
for checks in address,undefined undefined
do
- if ${CC:-cc} -fsanitize="$checks" -o "$probe" "$probe.c" >/dev/null 2>&1
+ if $CC -fsanitize="$checks" -o "$probe" "$probe.c" >/dev/null 2>&1
then
sanitize="SANITIZE=$checks"
break
fi
done
-make "$@" CFLAGS="-O0 -g3" DEVELOPER=1 $sanitize \
+make "$@" CC="$CC" CFLAGS="-O0 -g3" DEVELOPER=1 $sanitize \
GENERATE_COMPILATION_DATABASE=yes
# clang writes one entry per object under vendor/git/compile_commands, each