[build] Add clang option to buildall

Add an option (-c) to build with clang as well as with gcc.  Also,
change the way that BUILDDIR_SUFFIX is handled.  If the environment
specifies a BUILDDIR_SUFFIX, always use it verbatim.   Otherwise,
append -clang or -release (or -clang-release) as appropriate.
Previously, the way the build scripts worked, saying "USE_CLANG=true
buildall -r" would produce build output dirs with no -clang in the
directory suffix.

TL;DR?
you can now say
  ./scripts/buildall -c -r
to build every flavor of every project.

Change-Id: I9bdac9bb348ab78f4f4a1d1c36a46104e1d9c3e4
Esse commit está contido em:
John Grossman
2017-01-27 12:49:49 -08:00
commit 3306e88a01
3 arquivos alterados com 40 adições e 6 exclusões
+14 -4
Ver Arquivo
@@ -31,13 +31,23 @@ LKNAME ?= magenta
CLANG_TARGET_FUCHSIA ?= false
USE_LINKER_GC ?= true
# add -clang to the build-* dir if using clang and not otherwise overridden by the environment
ifeq ($(call TOBOOL,$(USE_CLANG)),true)
BUILDDIR_SUFFIX ?= -clang
else
# If no build directory suffix has been explicitly supplied by the environment,
# generate a default based on build options. Start with no suffix, then add
# "-clang" if we are building with clang, and "-release" if we are building with
# DEBUG=0
BUILDDIR_SUFFIX ?=
ifeq ($(strip $(BUILDDIR_SUFFIX)),)
ifeq ($(call TOBOOL,$(USE_CLANG)),true)
BUILDDIR_SUFFIX := $(BUILDDIR_SUFFIX)-clang
endif
ifeq ($(call TOBOOL,$(DEBUG)),false)
BUILDDIR_SUFFIX := $(BUILDDIR_SUFFIX)-release
endif
endif # if BUILDDIR_SUFFIX is empty
# special rule for handling make spotless
ifeq ($(MAKECMDGOALS),spotless)
spotless:
+25 -1
Ver Arquivo
@@ -13,21 +13,24 @@ function HELP {
echo "-f : Exit on first failure"
echo "-m : Build magenta targets only"
echo "-r : Also build release mode builds"
echo "-c : Also build with clang"
echo "-h for help"
exit 1
}
FAIL_FAST=0
DO_RELEASE=0
DO_CLANG=0
MAGENTA_ONLY=0
MAKE_ARGS=
while getopts a:fhmr FLAG; do
while getopts a:fhmrc FLAG; do
case $FLAG in
a) MAKE_ARGS="${MAKE_ARGS} ${OPTARG}";;
f) FAIL_FAST=1;;
h) HELP;;
r) DO_RELEASE=1;;
c) DO_CLANG=1;;
m) MAGENTA_ONLY=1;;
\?)
echo unrecognized option
@@ -57,6 +60,17 @@ for p in $PROJECTS; do
fi
fi
if [ "$DO_CLANG" -eq 1 ]; then
nice $DIR/make-parallel $p ${MAKE_ARGS} USE_CLANG=true
STATUS=$?
if [ "$STATUS" -ne 0 ]; then
FAILED="$FAILED $p-clang"
if [ "$FAIL_FAST" -eq 1 ]; then
break
fi
fi
fi
if [ "$DO_RELEASE" -eq 1 ]; then
nice $DIR/make-release $p ${MAKE_ARGS}
STATUS=$?
@@ -66,6 +80,16 @@ for p in $PROJECTS; do
break
fi
fi
if [ "$DO_CLANG" -eq 1 ]; then
nice $DIR/make-release $p ${MAKE_ARGS} USE_CLANG=true
STATUS=$?
if [ "$STATUS" -ne 0 ]; then
FAILED="$FAILED $p-clang-release"
if [ "$FAIL_FAST" -eq 1 ]; then
break
fi
fi
fi
fi
done
+1 -1
Ver Arquivo
@@ -11,4 +11,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# make a release build
#
# release builds are regular builds with DEBUG=0 and the -release suffix added to the build dir
DEBUG=0 BUILDDIR_SUFFIX=-release $DIR/make-parallel "$@"
DEBUG=0 $DIR/make-parallel "$@"