Files
lk/scripts/buildall
Travis Geiselbrecht 7fff3510a3 [scripts][buildall] hard set WERROR=0 if -e not passed
This allows it to override the WERROR setting if, say, someone put
WERROR?=1 in their local.mk. (It's a good idea)

Note: I can't really leave WERROR enabled in the default build because
of all of the variants of compilers folks use in the wild, but I do
highly suggest folks use it locally.
2025-01-11 17:24:51 -08:00

80 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -o pipefail
handle_interrupt() {
echo "Caught ctrl-c, exiting"
exit 1
}
trap 'handle_interrupt' SIGINT
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function HELP {
echo "help:"
echo "-e build with WERROR=1"
echo "-r also build DEBUG=0"
echo "-q hide output of build"
echo "-h for help"
exit 1
}
RELEASE=0
WERROR=0
QUIET=0
while getopts ehrq FLAG; do
case $FLAG in
e) WERROR=1;;
h) HELP;;
r) RELEASE=1;;
q) QUIET=1;;
\?)
echo unrecognized option
HELP
esac
done
shift $((OPTIND-1))
echo > buildall.log
function log()
{
if (( $QUIET )); then
"$@" >> buildall.log 2>&1
else
"$@" 2>&1 | tee -a buildall.log
fi
}
# build everything in the projects directory
PROJECTS=$(echo project/*.mk | xargs -n1 basename | sed 's/\.mk//')
FAILED=""
# set the WERROR environment
if (( $WERROR )); then
export WERROR=1
else
# hard set to 0 in case local.mk tries to override it
export WERROR=0
fi
for p in $PROJECTS; do
echo building $p
PROJECT=$p log nice $DIR/make-parallel || FAILED="$FAILED $p"
done
if (( $RELEASE )); then
for p in $PROJECTS; do
echo building $p-release
BUILDDIR_SUFFIX=-release DEBUG=0 PROJECT=$p log nice $DIR/make-parallel || FAILED="$FAILED $p-release"
done
fi
if [ "$FAILED" != "" ]; then
echo
echo some projects have failed to build:
echo $FAILED
fi