From 46749752e5e64834bfeeb03b5346b8b82ce099e2 Mon Sep 17 00:00:00 2001
From: William Roberts <william.c.roberts@intel.com>
Date: Mon, 28 Dec 2015 15:26:20 -0800
Subject: [PATCH] Android.mk: clean dependencies and clear variables

Dependencies being built with newline files in between
were also including the list of files without the newlines,
thus make would have to process 3n-1 files instead of 2n-1
where n is the number of files to process.

Additionally the *_with_nl variables were not being cleared
out and polluting Make's global name-space.

Change-Id: I76ea1a3dfae994b32991730aea7e4308da52a583
Signed-off-by: William Roberts <william.c.roberts@intel.com>
---
 Android.mk | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Android.mk b/Android.mk
index 5516d2173..87783b273 100644
--- a/Android.mk
+++ b/Android.mk
@@ -188,7 +188,7 @@ all_fcfiles_with_nl := $(call add_nl, $(all_fc_files), $(built_nl))
 file_contexts.tmp := $(intermediates)/file_contexts.tmp
 $(file_contexts.tmp): PRIVATE_FC_FILES := $(all_fcfiles_with_nl)
 $(file_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
-$(file_contexts.tmp): $(all_fc_files) $(all_fcfiles_with_nl)
+$(file_contexts.tmp): $(all_fcfiles_with_nl)
 	@mkdir -p $(dir $@)
 	$(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_FC_FILES) > $@
 
@@ -200,6 +200,7 @@ $(LOCAL_BUILT_MODULE): $(file_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXECUTA
 
 built_fc := $(LOCAL_BUILT_MODULE)
 all_fc_files :=
+all_fcfiles_with_nl :=
 file_contexts.tmp :=
 
 ##################################
@@ -291,7 +292,7 @@ all_pcfiles_with_nl := $(call add_nl, $(all_pc_files), $(built_nl))
 property_contexts.tmp := $(intermediates)/property_contexts.tmp
 $(property_contexts.tmp): PRIVATE_PC_FILES := $(all_pcfiles_with_nl)
 $(property_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
-$(property_contexts.tmp): $(all_pc_files) $(all_pcfiles_with_nl)
+$(property_contexts.tmp): $(all_pcfiles_with_nl)
 	@mkdir -p $(dir $@)
 	$(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_PC_FILES) > $@
 
@@ -304,6 +305,7 @@ $(LOCAL_BUILT_MODULE): $(property_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXE
 
 built_pc := $(LOCAL_BUILT_MODULE)
 all_pc_files :=
+all_pcfiles_with_nl :=
 property_contexts.tmp :=
 
 ##################################
@@ -344,7 +346,7 @@ all_svcfiles_with_nl := $(call add_nl, $(all_svc_files), $(built_nl))
 service_contexts.tmp := $(intermediates)/service_contexts.tmp
 $(service_contexts.tmp): PRIVATE_SVC_FILES := $(all_svcfiles_with_nl)
 $(service_contexts.tmp): PRIVATE_ADDITIONAL_M4DEFS := $(LOCAL_ADDITIONAL_M4DEFS)
-$(service_contexts.tmp): $(all_svc_files) $(all_svcfiles_with_nl)
+$(service_contexts.tmp): $(all_svcfiles_with_nl)
 	@mkdir -p $(dir $@)
 	$(hide) m4 -s $(PRIVATE_ADDITIONAL_M4DEFS) $(PRIVATE_SVC_FILES) > $@
 
@@ -356,6 +358,7 @@ $(LOCAL_BUILT_MODULE): $(service_contexts.tmp) $(built_sepolicy) $(HOST_OUT_EXEC
 
 built_svc := $(LOCAL_BUILT_MODULE)
 all_svc_files :=
+all_svcfiles_with_nl :=
 service_contexts.tmp :=
 
 ##################################
-- 
GitLab