[make] add BUILDDIR_SUFFIX build variable

This allows you to tag your build dirs with an optional string.

Update scripts/buildall to also allow building all release (DEBUG=0)
builds. Add a few other convenience switches.
This commit is contained in:
Travis Geiselbrecht
2022-07-23 15:57:53 -07:00
parent 576a7a7c82
commit 3dff26ae7b
2 changed files with 52 additions and 2 deletions

View File

@@ -2,14 +2,63 @@
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=""
if (( $WERROR )); then
export WERROR=1
fi
for p in $PROJECTS; do
PROJECT=$p nice $DIR/make-parallel || FAILED="$FAILED $p"
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: