summaryrefslogtreecommitdiffstats
path: root/core/prebuilt.mk
diff options
context:
space:
mode:
authorJi-Hwan Lee <jihwan@google.com>2011-07-07 03:10:14 +0900
committerJi-Hwan Lee <jihwan@google.com>2011-07-07 11:07:18 +0900
commit0219e9292e242b61058475c914930a4880c1acf2 (patch)
tree44cdcc1fe8041ded197fd8e2444ee3968e19f76d /core/prebuilt.mk
parentb8de151fd8b4eea27ac57f177af553960aa36611 (diff)
downloadbuild-0219e9292e242b61058475c914930a4880c1acf2.zip
build-0219e9292e242b61058475c914930a4880c1acf2.tar.gz
build-0219e9292e242b61058475c914930a4880c1acf2.tar.bz2
Enable LOCAL_STRIP_MODULE for prebuilt binaries
Currently, prebuilt binaries with debug symbols are installed unstripped. There are only a few of prebuilt shared library (that I'm trying to fix), so I can do this manually by making intermediate target and applying TARGET_STRIP, each of them, one by one. But dynamic_binary.mk has more features than stripping binaries (like copying unstripped binaries to symbols directory) and if I do it manually, they will lose all the benefits. Note that this doesn't change anything when LOCAL_STRIP_MODULE is not set. I actually tried to force strip every BUILD_PREBUILT'ed modules, but there were a few problems: - Some packages are not installed (i.e. not in PRODUCT_PACAKGES) but are built (i.e. in ALL_MODULES). And some of them are built in spite that they do not have appropriate prebuilt shared library for TARGET_ARCH. Stripping them causes "unknown format". - Some prebuilt modules set LOCAL_MODULE_CLASS incorrectly. Example is default.supp of external/valgrind/main, which should be ETC, not SHARED_LIBRARY. Both are better fixed, but I concluded that it's better to be conservative. Bug: 4585734 Change-Id: If71723b1d76007d45b02429ea5161a8265dd5b6d
Diffstat (limited to 'core/prebuilt.mk')
-rw-r--r--core/prebuilt.mk31
1 files changed, 23 insertions, 8 deletions
diff --git a/core/prebuilt.mk b/core/prebuilt.mk
index 8f9eafb..07ecf64 100644
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -26,7 +26,22 @@ endif
endif
endif
-include $(BUILD_SYSTEM)/base_rules.mk
+ifeq ($(LOCAL_STRIP_MODULE),true)
+ ifdef LOCAL_IS_HOST_MODULE
+ $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
+ endif
+ ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
+ $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
+ endif
+ ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
+ $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
+ endif
+ include $(BUILD_SYSTEM)/dynamic_binary.mk
+ built_module := $(linked_module)
+else
+ include $(BUILD_SYSTEM)/base_rules.mk
+ built_module := $(LOCAL_BUILT_MODULE)
+endif
# Deal with the OSX library timestamp issue when installing
# a prebuilt simulator library.
@@ -42,24 +57,24 @@ PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
ifeq ($(LOCAL_DEX_PREOPT),true)
# Make sure the boot jars get dexpreopt-ed first
-$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT) $(AAPT)
+$(built_module): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT) $(AAPT)
endif
-$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
+$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
$(transform-prebuilt-to-target-with-zipalign)
ifeq ($(LOCAL_DEX_PREOPT),true)
$(hide) rm -f $(patsubst %.apk,%.odex,$@)
$(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
$(call dexpreopt-remove-classes.dex,$@)
-built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
-$(built_odex): $(LOCAL_BUILT_MODULE)
+built_odex := $(basename $(built_module)).odex
+$(built_odex): $(built_module)
endif
else
ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
-$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
+$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
$(transform-prebuilt-to-target-strip-comments)
else
-$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
+$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
$(transform-prebuilt-to-target)
endif
endif
@@ -79,7 +94,7 @@ $(common_javalib_jar) : $(common_classes_jar) | $(ACP)
$(transform-prebuilt-to-target)
# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
-$(LOCAL_BUILT_MODULE) : $(common_javalib_jar)
+$(built_module) : $(common_javalib_jar)
endif # TARGET JAVA_LIBRARIES
ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)