From 61cd884a111de0c06a6836da0fb5d20e20f5a411 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Thu, 24 Sep 2015 16:19:19 -0700 Subject: [PATCH] Substitue "/" with "-" in the MODULES-IN phony goal names. This avoids Ninja's path canonicalization on those goal names. Without this, Ninja complains about duplicate rules for MODULES-IN/a/b/.. and MODULES-IN/a. Bug: 24309760 Change-Id: Id3aa9da5d3887a2cd1426cbb5fdf35659c65805e --- core/base_rules.mk | 2 +- envsetup.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index d96502d9b..21b59a3b7 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -260,7 +260,7 @@ $(my_register_name): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE) my_path_components := $(subst /,$(space),$(LOCAL_PATH)) my_path_prefix := MODULES-IN $(foreach c, $(my_path_components),\ - $(eval my_path_prefix := $(my_path_prefix)/$(c))\ + $(eval my_path_prefix := $(my_path_prefix)-$(c))\ $(eval .PHONY : $(my_path_prefix))\ $(eval $(my_path_prefix) : $(my_register_name))) diff --git a/envsetup.sh b/envsetup.sh index 1ff5f4a64..c24e1f0dd 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -780,7 +780,10 @@ function mma() return 1 fi local MY_PWD=`PWD= /bin/pwd|sed 's:'$T'/::'` - $DRV make -C $T -f build/core/main.mk $@ MODULES-IN/$MY_PWD + local MODULES_IN_PATHS=MODULES-IN-$MY_PWD + # Convert "/" to "-". + MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-} + $DRV make -C $T -f build/core/main.mk $@ $MODULES_IN_PATHS fi } @@ -808,7 +811,7 @@ function mmma() if [ "$MY_PWD" != "" ]; then DIR=$MY_PWD/$DIR fi - MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN/$DIR" + MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$DIR" else case $DIR in showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";; @@ -816,6 +819,8 @@ function mmma() esac fi done + # Convert "/" to "-". + MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-} $DRV make -C $T -f build/core/main.mk $DASH_ARGS $ARGS $MODULES_IN_PATHS else echo "Couldn't locate the top of the tree. Try setting TOP."