Skip to content

Commit 3dff26a

Browse files
committed
[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.
1 parent 576a7a7 commit 3dff26a

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

engine.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ endif # PROJECT == null
5454

5555
DEBUG ?= 2
5656

57-
BUILDDIR := $(BUILDROOT)/build-$(PROJECT)
57+
BUILDDIR_SUFFIX ?=
58+
BUILDDIR := $(BUILDROOT)/build-$(PROJECT)$(BUILDDIR_SUFFIX)
5859
OUTBIN := $(BUILDDIR)/lk.bin
5960
OUTELF := $(BUILDDIR)/lk.elf
6061
CONFIGHEADER := $(BUILDDIR)/config.h

scripts/buildall

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,62 @@
22

33
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
44

5+
function HELP {
6+
echo "help:"
7+
echo "-e build with WERROR=1"
8+
echo "-r also build DEBUG=0"
9+
echo "-q hide output of build"
10+
echo "-h for help"
11+
exit 1
12+
}
13+
14+
RELEASE=0
15+
WERROR=0
16+
QUIET=0
17+
18+
while getopts ehrq FLAG; do
19+
case $FLAG in
20+
e) WERROR=1;;
21+
h) HELP;;
22+
r) RELEASE=1;;
23+
q) QUIET=1;;
24+
\?)
25+
echo unrecognized option
26+
HELP
27+
esac
28+
done
29+
30+
shift $((OPTIND-1))
31+
32+
echo > buildall.log
33+
function log()
34+
{
35+
if (( $QUIET )); then
36+
"$@" >> buildall.log 2>&1
37+
else
38+
"$@" 2>&1 | tee -a buildall.log
39+
fi
40+
}
41+
542
# build everything in the projects directory
643
PROJECTS=$(echo project/*.mk | xargs -n1 basename | sed 's/\.mk//')
744
FAILED=""
845

46+
if (( $WERROR )); then
47+
export WERROR=1
48+
fi
49+
50+
for p in $PROJECTS; do
51+
echo building $p
52+
PROJECT=$p log nice $DIR/make-parallel || FAILED="$FAILED $p"
53+
done
54+
55+
if (( $RELEASE )); then
956
for p in $PROJECTS; do
10-
PROJECT=$p nice $DIR/make-parallel || FAILED="$FAILED $p"
57+
echo building $p-release
58+
BUILDDIR_SUFFIX=-release DEBUG=0 PROJECT=$p log nice $DIR/make-parallel || FAILED="$FAILED $p-release"
1159
done
60+
fi
1261

1362
if [ "$FAILED" != "" ]; then
1463
echo

0 commit comments

Comments
 (0)