Merge "Refactor how MODULES-IN-* is defined" am: 0c263fd271 am: e2e3df64b0 am: bc09fa8b55 am: 6f52047eeb

Original change: https://android-review.googlesource.com/c/platform/build/+/1326241

Change-Id: I3d91266cb83f1a33de3f5c36e38d690b43894fb9
This commit is contained in:
Treehugger Robot 2020-06-17 02:33:21 +00:00 committed by Automerger Merge Worker
commit 9630e3b0ee

View file

@ -452,12 +452,33 @@ endif
# Set up phony targets that covers all modules under the given paths.
# This allows us to build everything in given paths by running mmma/mma.
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 .PHONY : $(my_path_prefix))\
$(eval $(my_path_prefix) : $(my_all_targets)))
define my_path_comp
parent := $(patsubst %/,%,$(dir $(1)))
parent_target := MODULES-IN-$$(subst /,-,$$(parent))
.PHONY: $$(parent_target)
$$(parent_target): $(2)
ifndef $$(parent_target)
$$(parent_target) := true
ifneq (,$$(findstring /,$$(parent)))
$$(eval $$(call my_path_comp,$$(parent),$$(parent_target)))
endif
endif
endef
_local_path := $(patsubst %/,%,$(LOCAL_PATH))
_local_path_target := MODULES-IN-$(subst /,-,$(_local_path))
.PHONY: $(_local_path_target)
$(_local_path_target): $(my_register_name)
ifndef $(_local_path_target)
$(_local_path_target) := true
$(eval $(call my_path_comp,$(_local_path),$(_local_path_target)))
endif
_local_path :=
_local_path_target :=
my_path_comp :=
###########################################################
## Module installation rule