Skip to content

Commit

Permalink
[make] add BUILDDIR_SUFFIX build variable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
travisg committed Jul 23, 2022
1 parent 576a7a7 commit 3dff26a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
3 changes: 2 additions & 1 deletion engine.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ endif # PROJECT == null

DEBUG ?= 2

BUILDDIR := $(BUILDROOT)/build-$(PROJECT)
BUILDDIR_SUFFIX ?=
BUILDDIR := $(BUILDROOT)/build-$(PROJECT)$(BUILDDIR_SUFFIX)
OUTBIN := $(BUILDDIR)/lk.bin
OUTELF := $(BUILDDIR)/lk.elf
CONFIGHEADER := $(BUILDDIR)/config.h
Expand Down
51 changes: 50 additions & 1 deletion scripts/buildall
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,62 @@

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
echo building $p
PROJECT=$p log nice $DIR/make-parallel || FAILED="$FAILED $p"
done

if (( $RELEASE )); then
for p in $PROJECTS; do
PROJECT=$p nice $DIR/make-parallel || FAILED="$FAILED $p"
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
Expand Down

0 comments on commit 3dff26a

Please sign in to comment.