resolved conflicts for merge of 2b5d2c55 to klp-dev-plus-aosp
Change-Id: Icd9d5eff3f9acba042c100f694309f902c9d56cf
diff --git a/envsetup.sh b/envsetup.sh
index bd66aed..b039bbc 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -603,11 +603,26 @@
fi
}
+# Return driver for "make", if any (eg. static analyzer)
+function getdriver()
+{
+ local T="$1"
+ test "$WITH_STATIC_ANALYZER" = "0" && unset WITH_STATIC_ANALYZER
+ if [ -n "$WITH_STATIC_ANALYZER" ]; then
+ echo "\
+$T/prebuilts/clang/linux-x86/host/3.3/tools/scan-build/scan-build \
+--use-analyzer $T/prebuilts/clang/linux-x86/host/3.3/bin/clang \
+--status-bugs \
+--top=$T"
+ fi
+}
+
function m()
{
- T=$(gettop)
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
if [ "$T" ]; then
- make -C $T -f build/core/main.mk $@
+ $DRV make -C $T -f build/core/main.mk $@
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
@@ -632,13 +647,14 @@
function mm()
{
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
# If we're sitting in the root of the build tree, just do a
# normal make.
if [ -f build/core/envsetup.mk -a -f Makefile ]; then
- make $@
+ $DRV make $@
else
# Find the closest Android.mk file.
- T=$(gettop)
local M=$(findmakefile)
local MODULES=
local GET_INSTALL_PATH=
@@ -662,14 +678,15 @@
MODULES=all_modules
ARGS=$@
fi
- ONE_SHOT_MAKEFILE=$M make -C $T -f build/core/main.mk $MODULES $ARGS
+ ONE_SHOT_MAKEFILE=$M $DRV make -C $T -f build/core/main.mk $MODULES $ARGS
fi
fi
}
function mmm()
{
- T=$(gettop)
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
if [ "$T" ]; then
local MAKEFILE=
local MODULES=
@@ -707,7 +724,7 @@
ARGS=$GET_INSTALL_PATH
MODULES=
fi
- ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T -f build/core/main.mk $DASH_ARGS $MODULES $ARGS
+ ONE_SHOT_MAKEFILE="$MAKEFILE" $DRV make -C $T -f build/core/main.mk $DASH_ARGS $MODULES $ARGS
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
@@ -715,21 +732,23 @@
function mma()
{
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
if [ -f build/core/envsetup.mk -a -f Makefile ]; then
- make $@
+ $DRV make $@
else
- T=$(gettop)
if [ ! "$T" ]; then
echo "Couldn't locate the top of the tree. Try setting TOP."
fi
local MY_PWD=`PWD= /bin/pwd|sed 's:'$T'/::'`
- make -C $T -f build/core/main.mk $@ all_modules BUILD_MODULES_IN_PATHS="$MY_PWD"
+ $DRV make -C $T -f build/core/main.mk $@ all_modules BUILD_MODULES_IN_PATHS="$MY_PWD"
fi
}
function mmma()
{
- T=$(gettop)
+ local T=$(gettop)
+ local DRV=$(getdriver $T)
if [ "$T" ]; then
local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
@@ -756,7 +775,7 @@
esac
fi
done
- make -C $T -f build/core/main.mk $DASH_ARGS $ARGS all_modules BUILD_MODULES_IN_PATHS="$MODULE_PATHS"
+ $DRV make -C $T -f build/core/main.mk $DASH_ARGS $ARGS all_modules BUILD_MODULES_IN_PATHS="$MODULE_PATHS"
else
echo "Couldn't locate the top of the tree. Try setting TOP."
fi