aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaewoong Jung2019-01-02 15:36:48 -0600
committerJaewoong Jung2019-01-02 16:19:40 -0600
commitb6112cdcc53ac245576f488f6577c3a5b4890649 (patch)
tree5f49e7e9ed2df806a353dbe99e0147695dbd2e21 /envsetup.sh
parent632d154393f4455e90c5de1189de4ca476cc9e78 (diff)
downloadplatform-build-b6112cdcc53ac245576f488f6577c3a5b4890649.tar.gz
platform-build-b6112cdcc53ac245576f488f6577c3a5b4890649.tar.xz
platform-build-b6112cdcc53ac245576f488f6577c3a5b4890649.zip
Improve mmm behavior when targets are specified.
When target directories are specified, mmm now scans their parent direcotries to when searching for build config files. Also make it look more like mm as minor refactoring. Bug: 62899341 Test: Manual builds. Change-Id: Ic9c081090e1baeb0849508e9086f2976b108c0ee
Diffstat (limited to 'envsetup.sh')
-rw-r--r--envsetup.sh34
1 files changed, 21 insertions, 13 deletions
diff --git a/envsetup.sh b/envsetup.sh
index 561083d38..d63c65859 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -765,6 +765,9 @@ function findmakefile()
765{ 765{
766 local TOPFILE=build/make/core/envsetup.mk 766 local TOPFILE=build/make/core/envsetup.mk
767 local HERE=$PWD 767 local HERE=$PWD
768 if [ "$1" ]; then
769 \cd $1
770 fi;
768 local T= 771 local T=
769 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do 772 while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
770 T=`PWD= /bin/pwd` 773 T=`PWD= /bin/pwd`
@@ -845,24 +848,29 @@ function mmm()
845 # Remove the leading ./ and trailing / if any exists. 848 # Remove the leading ./ and trailing / if any exists.
846 DIR=${DIR#./} 849 DIR=${DIR#./}
847 DIR=${DIR%/} 850 DIR=${DIR%/}
848 if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then 851 local M
849 local TO_CHOP=`(\cd -P -- $T && pwd -P) | wc -c | tr -d ' '` 852 if [ "$DIR_MODULES" = "" ]; then
850 local TO_CHOP=`expr $TO_CHOP + 1` 853 M=$(findmakefile $DIR)
851 local START=`PWD= /bin/pwd` 854 else
852 local MDIR=`echo $START | cut -c${TO_CHOP}-` 855 # Only check the target directory if a module is specified.
853 if [ "$MDIR" = "" ] ; then 856 if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then
854 MDIR=$DIR 857 local HERE=$PWD
855 else 858 cd $DIR
856 MDIR=$MDIR/$DIR 859 M=`PWD= /bin/pwd`
860 M=$M/Android.mk
861 cd $HERE
857 fi 862 fi
858 MDIR=${MDIR%/.} 863 fi
864 if [ "$M" ]; then
865 # Remove the path to top as the makefilepath needs to be relative
866 local M=`echo $M|sed 's:'$T'/::'`
859 if [ "$DIR_MODULES" = "" ]; then 867 if [ "$DIR_MODULES" = "" ]; then
860 MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$MDIR" 868 MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$(dirname ${M})"
861 GET_INSTALL_PATHS="$GET_INSTALL_PATHS GET-INSTALL-PATH-IN-$MDIR" 869 GET_INSTALL_PATHS="$GET_INSTALL_PATHS GET-INSTALL-PATH-IN-$(dirname ${M})"
862 else 870 else
863 MODULES="$MODULES $DIR_MODULES" 871 MODULES="$MODULES $DIR_MODULES"
864 fi 872 fi
865 MAKEFILE="$MAKEFILE $MDIR/Android.mk" 873 MAKEFILE="$MAKEFILE $M"
866 else 874 else
867 case $DIR in 875 case $DIR in
868 showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";; 876 showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";;