blob: bd4d91f714c5cd3320908070497b4f88572146f9 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001###########################################################
2## Standard rules for copying files that are prebuilt
3##
4## Additional inputs from base_rules.make:
5## None.
Doug Zongker1046d202009-08-06 13:02:19 -07006##
The Android Open Source Project88b60792009-03-03 19:28:42 -08007###########################################################
8
9ifneq ($(LOCAL_PREBUILT_LIBS),)
10$(error dont use LOCAL_PREBUILT_LIBS anymore LOCAL_PATH=$(LOCAL_PATH))
11endif
12ifneq ($(LOCAL_PREBUILT_EXECUTABLES),)
13$(error dont use LOCAL_PREBUILT_EXECUTABLES anymore LOCAL_PATH=$(LOCAL_PATH))
14endif
15ifneq ($(LOCAL_PREBUILT_JAVA_LIBRARIES),)
16$(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH))
17endif
18
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090019ifeq ($(LOCAL_STRIP_MODULE),true)
20 ifdef LOCAL_IS_HOST_MODULE
21 $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
22 endif
23 ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
24 $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
25 endif
26 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
27 $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
28 endif
29 include $(BUILD_SYSTEM)/dynamic_binary.mk
30 built_module := $(linked_module)
31else
32 include $(BUILD_SYSTEM)/base_rules.mk
33 built_module := $(LOCAL_BUILT_MODULE)
34endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080035
36# Deal with the OSX library timestamp issue when installing
37# a prebuilt simulator library.
38ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
39 prebuilt_module_is_a_library := true
40else
41 prebuilt_module_is_a_library :=
42endif
43
Owen Lin64d5a802009-10-16 02:43:05 -070044PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
45
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070046# Ensure that prebuilt .apks have been aligned.
47ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090048$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070049 $(transform-prebuilt-to-target-with-zipalign)
50else
Doug Zongker1046d202009-08-06 13:02:19 -070051ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090052$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
Doug Zongker1046d202009-08-06 13:02:19 -070053 $(transform-prebuilt-to-target-strip-comments)
54else
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090055$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -080056 $(transform-prebuilt-to-target)
Doug Zongker1046d202009-08-06 13:02:19 -070057endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070058endif
59
Ying Wanga83940f2010-09-24 18:09:04 -070060ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
61# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
62# while the deps should be in the common dir, so we make a copy in the common dir.
Ying Wang5b316b62011-02-01 12:57:45 -080063# For nonstatic library, $(common_javalib_jar) is the dependency file,
64# while $(common_classes_jar) is used to link.
65common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
66common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
67
68$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
Ying Wanga83940f2010-09-24 18:09:04 -070069 $(transform-prebuilt-to-target)
Ying Wang5b316b62011-02-01 12:57:45 -080070
71$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
72 $(transform-prebuilt-to-target)
73
74# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090075$(built_module) : $(common_javalib_jar)
Ying Wang5b316b62011-02-01 12:57:45 -080076endif # TARGET JAVA_LIBRARIES
Ying Wanga83940f2010-09-24 18:09:04 -070077
Doug Zongkerf6a53aa2009-12-15 15:06:55 -080078ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
79 # The magic string "EXTERNAL" means this package will be signed with
80 # the test key throughout the build process, but we expect the final
81 # package to be signed with a different key.
82 #
83 # This can be used for packages where we don't have access to the
84 # keys, but want the package to be predexopt'ed.
85 LOCAL_CERTIFICATE := testkey
86 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
87endif
Doug Zongker1b6d0a62009-08-26 18:22:43 -070088ifeq ($(LOCAL_CERTIFICATE),)
Doug Zongker45302ff2009-12-11 13:50:35 -080089 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
90 # It is now a build error to add a prebuilt .apk without
91 # specifying a key for it.
92 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)")
93 endif
94else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
95 # The magic string "PRESIGNED" means this package is already checked
96 # signed with its release key.
Doug Zongker714111c2009-12-14 09:56:19 -080097 #
98 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
99 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
100 # but the dexpreopt process will not try to re-sign the app.
101 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
102 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700103else
Doug Zongker45302ff2009-12-11 13:50:35 -0800104 # If this is not an absolute certificate, assign it to a generic one.
105 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
106 LOCAL_CERTIFICATE := $(SRC_TARGET_DIR)/product/security/$(LOCAL_CERTIFICATE)
107 endif
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700108
Doug Zongker45302ff2009-12-11 13:50:35 -0800109 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
110 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
111 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700112endif
113
The Android Open Source Project88b60792009-03-03 19:28:42 -0800114ifneq ($(prebuilt_module_is_a_library),)
115 ifneq ($(LOCAL_IS_HOST_MODULE),)
116 $(transform-host-ranlib-copy-hack)
117 else
118 $(transform-ranlib-copy-hack)
119 endif
120endif