Make inherit-product loop over all files passed to it

Currently inherit-product and the rest of the product
configuration infrastructure does not handle wildcards.
However, they still get passed through unchanged, until
they reach the raw Make include statement, which expands
them. This essentially makes a meta-product that is the
result of combining all the makefiles that were matched.

In Starlark, the behavior is to actually treat each file
as it's own product. This causes a discrepency when using
`m product-graph`, where make shows one node for all those
files and Stalark has a node for each.

This is probably unintentional behavior, so change Make
to also import each file as separate products. On the
product I was investigating, the only difference this
made in the ninja file was in the product graph.

Bug: 221312856
Test: Presubmits
Change-Id: I9ca7aff0b0790aeb6e42861ce2745feed8a1a7c4
diff --git a/core/product.mk b/core/product.mk
index 60b2dc9..032ca6b 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -400,17 +400,20 @@
 # See e.g. product-graph.mk for an example of this.
 #
 define inherit-product
-  $(if $(findstring ../,$(1)),\
-    $(eval np := $(call normalize-paths,$(1))),\
-    $(eval np := $(strip $(1))))\
-  $(foreach v,$(_product_var_list), \
-      $(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \
-  $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
-  $(eval inherit_var := PRODUCTS.$(current_mk).INHERITS_FROM) \
-  $(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \
-  $(eval PARENT_PRODUCT_FILES := $(sort $(PARENT_PRODUCT_FILES) $(current_mk))) \
-  $(call dump-inherit,$(strip $(word 1,$(_include_stack))),$(1)) \
-  $(call dump-config-vals,$(current_mk),inherit)
+  $(eval _inherit_product_wildcard := $(wildcard $(1)))\
+  $(if $(_inherit_product_wildcard),,$(error $(1) does not exist.))\
+  $(foreach part,$(_inherit_product_wildcard),\
+    $(if $(findstring ../,$(part)),\
+      $(eval np := $(call normalize-paths,$(part))),\
+      $(eval np := $(strip $(part))))\
+    $(foreach v,$(_product_var_list), \
+        $(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \
+    $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
+    $(eval inherit_var := PRODUCTS.$(current_mk).INHERITS_FROM) \
+    $(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \
+    $(eval PARENT_PRODUCT_FILES := $(sort $(PARENT_PRODUCT_FILES) $(current_mk))) \
+    $(call dump-inherit,$(strip $(word 1,$(_include_stack))),$(1)) \
+    $(call dump-config-vals,$(current_mk),inherit))
 endef
 
 # Specifies a number of path prefixes, relative to PRODUCT_OUT, where the