diff options
author | Khalid Zubair <kzubair@cyngn.com> | 2015-10-06 11:00:55 -0700 |
---|---|---|
committer | Michael Bestas <mikeioannina@gmail.com> | 2015-10-27 00:45:16 +0200 |
commit | abcd19499d0ba475715dd76a8d0f7c08c630c7ea (patch) | |
tree | ea77e6ccbe5327a19e19aefa436831884d1c7ab6 /envsetup.sh | |
parent | 093f92c383fcf2a6c7566cb52378d53b6f466bc6 (diff) | |
download | build-abcd19499d0ba475715dd76a8d0f7c08c630c7ea.zip build-abcd19499d0ba475715dd76a8d0f7c08c630c7ea.tar.gz build-abcd19499d0ba475715dd76a8d0f7c08c630c7ea.tar.bz2 |
mka: allow mka to be run from anywhere in the tree
The Android build system expects to be launched from the top of the
tree. Invoking mka at any other level often has unintended consequence
(e.g. targets the host ARCH because ARCH was not set). The various
build shortcuts like m and mm invoke Make from the top of the tree. mka
now does the same.
Change-Id: Id956cf04cbaf1d12d12549ca54e32b9c2ce1fc29
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/envsetup.sh b/envsetup.sh index 8f9dfdb..140f80c 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -2096,14 +2096,20 @@ function cmrebase() { } function mka() { - case `uname -s` in - Darwin) - make -j `sysctl hw.ncpu|cut -d" " -f2` "$@" - ;; - *) - mk_timer schedtool -B -n 1 -e ionice -n 1 make -j$(cat /proc/cpuinfo | grep "^processor" | wc -l) "$@" - ;; - esac + local T=$(gettop) + if [ "$T" ]; then + case `uname -s` in + Darwin) + make -C $T -j `sysctl hw.ncpu|cut -d" " -f2` "$@" + ;; + *) + mk_timer schedtool -B -n 1 -e ionice -n 1 make -C $T -j$(cat /proc/cpuinfo | grep "^processor" | wc -l) "$@" + ;; + esac + + else + echo "Couldn't locate the top of the tree. Try setting TOP." + fi } function cmka() { |