2023-12-24 17:13:17 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Copyright (c) 2023 Emma Tebibyte <emma@tebibyte.media>
|
|
|
|
# SPDX-License-Identifier: FSFAP
|
|
|
|
#
|
|
|
|
# Copying and distribution of this file, with or without modification, are
|
|
|
|
# permitted in any medium without royalty provided the copyright notice and this
|
|
|
|
# notice are preserved. This file is offered as-is, without any warranty.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if ! ls GNUmakefile >/dev/null 2>&1
|
|
|
|
then
|
|
|
|
printf '%s: Run this script in the root of the project.\n' "$0" 1>&2
|
2023-12-24 17:31:17 -07:00
|
|
|
exit 64 # sysexits.h(3) EX_USAGE
|
2023-12-24 17:13:17 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
make clean
|
|
|
|
|
2023-12-24 17:31:17 -07:00
|
|
|
for CC in cc \
|
2023-12-24 17:13:17 -07:00
|
|
|
clang \
|
|
|
|
gcc \
|
|
|
|
tcc \
|
|
|
|
'zig cc'
|
|
|
|
do
|
|
|
|
export CC
|
2023-12-24 17:31:17 -07:00
|
|
|
|
|
|
|
command -v "$(printf '%s\n' "$CC" | cut -d ' ' -f1)" >/dev/null 2>&1 \
|
|
|
|
|| continue
|
|
|
|
|
2023-12-24 17:13:17 -07:00
|
|
|
printf '%s: %s: Testing build.\n' "$0" "$CC"
|
|
|
|
|
|
|
|
make CC="$CC" && printf '%s: Build successful.\n' "$0"
|
|
|
|
|
2023-12-24 19:24:30 -07:00
|
|
|
ls -lA build/bin
|
2023-12-24 17:13:17 -07:00
|
|
|
|
|
|
|
make clean
|
|
|
|
printf '\n'
|
|
|
|
done
|