From e0bba6fa122bc22c98bda50a2f8d124f8f7858f0 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Fri, 9 Dec 2016 21:15:41 -0800 Subject: [PATCH] Fix PDK dupbuild issues The PDK uses pattern rules in order to install files from the PDK. When those files already have build rules, the explicit rules override the pattern rules, and everything works. But because Make (and Kati) doesn't attempt to clean the file paths, if one of the rules has a redundant /, we'll export two ninja rules, and ninja will error out with a dupbuild error. The PDK pattern rules are clean, but the explicit notice file creation was not, it was always adding a double // in between NOTICE_FILES/src and the module path. Some modules were also setting a LOCAL_MODULE_PATH with a trailing /, which is redundant, and also hits the above problem. Instead of fixing all of the modules, just strip a trailing / from my_module_path. Bug: 33451638 Test: Build with a PDK Change-Id: Iff3e98fd191ea90626b9b89f179537e8a75f5ef2 --- core/base_rules.mk | 1 + core/notice_files.mk | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index e9d9c33d18..e89917e8a9 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -161,6 +161,7 @@ my_module_path := $(my_multilib_module_path) else my_module_path := $(strip $(LOCAL_MODULE_PATH)) endif +my_module_path := $(patsubst %/,%,$(my_module_path)) my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH)) ifeq ($(my_module_path),) ifdef LOCAL_IS_HOST_MODULE diff --git a/core/notice_files.mk b/core/notice_files.mk index f0013c2751..8a0ae6f58b 100644 --- a/core/notice_files.mk +++ b/core/notice_files.mk @@ -33,7 +33,7 @@ ifdef notice_file # compliance. # Includes the leading slash ifdef LOCAL_INSTALLED_MODULE - module_installed_filename := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) + module_installed_filename := $(patsubst $(PRODUCT_OUT)/%,%,$(LOCAL_INSTALLED_MODULE)) else # This module isn't installable ifeq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES) @@ -41,7 +41,7 @@ else # We can't use xxx_OUT_STATIC_LIBRARIES because it points into # device-obj or host-obj. module_installed_filename := \ - $(patsubst $(PRODUCT_OUT)%,%,$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE)) + $(patsubst $(PRODUCT_OUT)/%,%,$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE)) else ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) # Stick the static java libraries with the regular java libraries. @@ -53,7 +53,7 @@ else module_leaf := $(LOCAL_MODULE).jar endif module_installed_filename := \ - $(patsubst $(PRODUCT_OUT)%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(module_leaf) + $(patsubst $(PRODUCT_OUT)/%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(module_leaf) else $(error Cannot determine where to install NOTICE file for $(LOCAL_MODULE)) endif # JAVA_LIBRARIES @@ -61,8 +61,8 @@ else endif # In case it's actually a host file -module_installed_filename := $(patsubst $(HOST_OUT)%,%,$(module_installed_filename)) -module_installed_filename := $(patsubst $(HOST_CROSS_OUT)%,%,$(module_installed_filename)) +module_installed_filename := $(patsubst $(HOST_OUT)/%,%,$(module_installed_filename)) +module_installed_filename := $(patsubst $(HOST_CROSS_OUT)/%,%,$(module_installed_filename)) installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt