Normalize the product makefile path in inherit-product.

Some vendor product makefiles call $(inherit-product) on the same
product makefile with different paths, by using "../" in relative paths.
However inherit-product requires unique path as ID for a product
makefile, for bookkeeping purpose.
Normalize the product makefile path in inherit-product, if the path
contains "../".

Change-Id: I1a864ce120c713d8e79ec179213b9fc9352aba53
diff --git a/core/config.mk b/core/config.mk
index 680a169..10c66f5 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -113,6 +113,16 @@
 SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS))
 hide := $(if $(SHOW_COMMANDS),,@)
 
+################################################################
+# Tools needed in product configuration makefiles.
+################################################################
+NORMALIZE_PATH := build/tools/normalize_path.py
+
+# $(1): the paths to be normalized
+define normalize-paths
+$(if $(1),$(shell $(NORMALIZE_PATH) $(1)))
+endef
+
 # ###############################################################
 # Set common values
 # ###############################################################
@@ -550,8 +560,6 @@
 MD5SUM:=md5sum
 endif
 
-NORMALIZE_PATH := build/tools/normalize_path.py
-
 APICHECK_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
 APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
 APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX)