summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2014-05-23 12:26:51 -0700
committerDan Albert <danalbert@google.com>2014-08-20 13:58:36 -0700
commite0f44ac25de925759eb5d615e403f8db5a06f5e0 (patch)
tree238a8ad33922e7aa3e4023a1e1ae8744fbc7e2ca /core
parent36ba1db405637ef97276103fced526f5e5d9e354 (diff)
downloadbuild-e0f44ac25de925759eb5d615e403f8db5a06f5e0.zip
build-e0f44ac25de925759eb5d615e403f8db5a06f5e0.tar.gz
build-e0f44ac25de925759eb5d615e403f8db5a06f5e0.tar.bz2
Performance improvement for whole static libs
Improves performance for LOCAL_WHOLE_STATIC_LIBS by copying the first .a to the new .a rather than extracting and recreating Change-Id: Iecdb5e4bb2ce987bb41a70c3393d18a6d72ae689
Diffstat (limited to 'core')
-rw-r--r--core/definitions.mk17
1 files changed, 13 insertions, 4 deletions
diff --git a/core/definitions.mk b/core/definitions.mk
index b5762e3..9b8a299 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1176,7 +1176,7 @@ endef
# $(1): the full path of the source static library.
define _extract-and-include-single-target-whole-static-lib
-@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(1)]"
+@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(strip $(1))]"
$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\
rm -rf $$ldir; \
mkdir -p $$ldir; \
@@ -1190,8 +1190,16 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;
endef
+# $(1): the full path of the source static library.
+define extract-and-include-whole-static-libs-first
+$(if $(strip $(1)),
+@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(strip $(1))]"
+$(hide) cp $(1) $@)
+endef
+
define extract-and-include-target-whole-static-libs
-$(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \
+$(call extract-and-include-whole-static-libs-first, $(firstword $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)))
+$(foreach lib,$(wordlist 2,999,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)), \
$(call _extract-and-include-single-target-whole-static-lib, $(lib)))
endef
@@ -1213,7 +1221,7 @@ endef
# $(1): the full path of the source static library.
define _extract-and-include-single-host-whole-static-lib
-@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(1)]"
+@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(strip $(1))]"
$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\
rm -rf $$ldir; \
mkdir -p $$ldir; \
@@ -1228,7 +1236,8 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;
endef
define extract-and-include-host-whole-static-libs
-$(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \
+$(call extract-and-include-whole-static-libs-first, $(firstword $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)))
+$(foreach lib,$(wordlist 2,999,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)), \
$(call _extract-and-include-single-host-whole-static-lib, $(lib)))
endef