blob: 935bce1f2d92c7c370c32bb97b9293a88e9de1bc [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
Ying Wangc36b4502011-09-15 12:00:52 -070019ifdef LOCAL_IS_HOST_MODULE
20 my_prefix:=HOST_
21else
22 my_prefix:=TARGET_
23endif
24ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
25 # Put the built targets of all shared libraries in a common directory
26 # to simplify the link line.
27 OVERRIDE_BUILT_MODULE_PATH := $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
28endif
29
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090030ifeq ($(LOCAL_STRIP_MODULE),true)
31 ifdef LOCAL_IS_HOST_MODULE
32 $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
33 endif
34 ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
35 $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
36 endif
37 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
38 $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
39 endif
40 include $(BUILD_SYSTEM)/dynamic_binary.mk
41 built_module := $(linked_module)
42else
43 include $(BUILD_SYSTEM)/base_rules.mk
44 built_module := $(LOCAL_BUILT_MODULE)
45endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080046
47# Deal with the OSX library timestamp issue when installing
48# a prebuilt simulator library.
49ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
50 prebuilt_module_is_a_library := true
51else
52 prebuilt_module_is_a_library :=
53endif
54
Owen Lin64d5a802009-10-16 02:43:05 -070055PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
56
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070057# Ensure that prebuilt .apks have been aligned.
58ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090059$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070060 $(transform-prebuilt-to-target-with-zipalign)
61else
Doug Zongker1046d202009-08-06 13:02:19 -070062ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090063$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
Doug Zongker1046d202009-08-06 13:02:19 -070064 $(transform-prebuilt-to-target-strip-comments)
65else
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090066$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -080067 $(transform-prebuilt-to-target)
Doug Zongker1046d202009-08-06 13:02:19 -070068endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070069endif
70
Ying Wanga83940f2010-09-24 18:09:04 -070071ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
72# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
73# 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 -080074# For nonstatic library, $(common_javalib_jar) is the dependency file,
75# while $(common_classes_jar) is used to link.
76common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
77common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
78
79$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
Ying Wanga83940f2010-09-24 18:09:04 -070080 $(transform-prebuilt-to-target)
Ying Wang5b316b62011-02-01 12:57:45 -080081
82$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
83 $(transform-prebuilt-to-target)
84
85# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090086$(built_module) : $(common_javalib_jar)
Ying Wang5b316b62011-02-01 12:57:45 -080087endif # TARGET JAVA_LIBRARIES
Ying Wanga83940f2010-09-24 18:09:04 -070088
Doug Zongkerf6a53aa2009-12-15 15:06:55 -080089ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
90 # The magic string "EXTERNAL" means this package will be signed with
91 # the test key throughout the build process, but we expect the final
92 # package to be signed with a different key.
93 #
94 # This can be used for packages where we don't have access to the
95 # keys, but want the package to be predexopt'ed.
96 LOCAL_CERTIFICATE := testkey
97 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
98endif
Doug Zongker1b6d0a62009-08-26 18:22:43 -070099ifeq ($(LOCAL_CERTIFICATE),)
Doug Zongker45302ff2009-12-11 13:50:35 -0800100 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
101 # It is now a build error to add a prebuilt .apk without
102 # specifying a key for it.
103 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)")
104 endif
105else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
106 # The magic string "PRESIGNED" means this package is already checked
107 # signed with its release key.
Doug Zongker714111c2009-12-14 09:56:19 -0800108 #
109 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
110 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
111 # but the dexpreopt process will not try to re-sign the app.
112 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
113 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700114else
Doug Zongker45302ff2009-12-11 13:50:35 -0800115 # If this is not an absolute certificate, assign it to a generic one.
116 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
117 LOCAL_CERTIFICATE := $(SRC_TARGET_DIR)/product/security/$(LOCAL_CERTIFICATE)
118 endif
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700119
Doug Zongker45302ff2009-12-11 13:50:35 -0800120 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
121 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
122 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700123endif
124
The Android Open Source Project88b60792009-03-03 19:28:42 -0800125ifneq ($(prebuilt_module_is_a_library),)
126 ifneq ($(LOCAL_IS_HOST_MODULE),)
127 $(transform-host-ranlib-copy-hack)
128 else
129 $(transform-ranlib-copy-hack)
130 endif
131endif