blob: 07ecf645db637f1541ad2c839718a08a9245b0dd [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 Wang06e2f722011-05-26 15:59:56 -070019ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
20ifeq (true,$(WITH_DEXPREOPT))
21ifeq (,$(TARGET_BUILD_APPS))
22ifndef LOCAL_DEX_PREOPT
23LOCAL_DEX_PREOPT := true
24endif
25endif
26endif
27endif
28
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090029ifeq ($(LOCAL_STRIP_MODULE),true)
30 ifdef LOCAL_IS_HOST_MODULE
31 $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
32 endif
33 ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
34 $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
35 endif
36 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
37 $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
38 endif
39 include $(BUILD_SYSTEM)/dynamic_binary.mk
40 built_module := $(linked_module)
41else
42 include $(BUILD_SYSTEM)/base_rules.mk
43 built_module := $(LOCAL_BUILT_MODULE)
44endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080045
46# Deal with the OSX library timestamp issue when installing
47# a prebuilt simulator library.
48ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
49 prebuilt_module_is_a_library := true
50else
51 prebuilt_module_is_a_library :=
52endif
53
Owen Lin64d5a802009-10-16 02:43:05 -070054PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
55
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070056# Ensure that prebuilt .apks have been aligned.
57ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
Ying Wang06e2f722011-05-26 15:59:56 -070058ifeq ($(LOCAL_DEX_PREOPT),true)
59# Make sure the boot jars get dexpreopt-ed first
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090060$(built_module): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT) $(AAPT)
Ying Wang06e2f722011-05-26 15:59:56 -070061endif
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090062$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070063 $(transform-prebuilt-to-target-with-zipalign)
Ying Wang06e2f722011-05-26 15:59:56 -070064ifeq ($(LOCAL_DEX_PREOPT),true)
65 $(hide) rm -f $(patsubst %.apk,%.odex,$@)
66 $(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
67 $(call dexpreopt-remove-classes.dex,$@)
68
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090069built_odex := $(basename $(built_module)).odex
70$(built_odex): $(built_module)
Ying Wang06e2f722011-05-26 15:59:56 -070071endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070072else
Doug Zongker1046d202009-08-06 13:02:19 -070073ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090074$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
Doug Zongker1046d202009-08-06 13:02:19 -070075 $(transform-prebuilt-to-target-strip-comments)
76else
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090077$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -080078 $(transform-prebuilt-to-target)
Doug Zongker1046d202009-08-06 13:02:19 -070079endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070080endif
81
Ying Wanga83940f2010-09-24 18:09:04 -070082ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
83# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
84# 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 -080085# For nonstatic library, $(common_javalib_jar) is the dependency file,
86# while $(common_classes_jar) is used to link.
87common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
88common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
89
90$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
Ying Wanga83940f2010-09-24 18:09:04 -070091 $(transform-prebuilt-to-target)
Ying Wang5b316b62011-02-01 12:57:45 -080092
93$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
94 $(transform-prebuilt-to-target)
95
96# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090097$(built_module) : $(common_javalib_jar)
Ying Wang5b316b62011-02-01 12:57:45 -080098endif # TARGET JAVA_LIBRARIES
Ying Wanga83940f2010-09-24 18:09:04 -070099
Doug Zongkerf6a53aa2009-12-15 15:06:55 -0800100ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
101 # The magic string "EXTERNAL" means this package will be signed with
102 # the test key throughout the build process, but we expect the final
103 # package to be signed with a different key.
104 #
105 # This can be used for packages where we don't have access to the
106 # keys, but want the package to be predexopt'ed.
107 LOCAL_CERTIFICATE := testkey
108 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
109endif
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700110ifeq ($(LOCAL_CERTIFICATE),)
Doug Zongker45302ff2009-12-11 13:50:35 -0800111 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
112 # It is now a build error to add a prebuilt .apk without
113 # specifying a key for it.
114 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)")
115 endif
116else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
117 # The magic string "PRESIGNED" means this package is already checked
118 # signed with its release key.
Doug Zongker714111c2009-12-14 09:56:19 -0800119 #
120 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
121 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
122 # but the dexpreopt process will not try to re-sign the app.
123 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
124 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700125else
Doug Zongker45302ff2009-12-11 13:50:35 -0800126 # If this is not an absolute certificate, assign it to a generic one.
127 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
128 LOCAL_CERTIFICATE := $(SRC_TARGET_DIR)/product/security/$(LOCAL_CERTIFICATE)
129 endif
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700130
Doug Zongker45302ff2009-12-11 13:50:35 -0800131 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
132 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
133 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700134endif
135
The Android Open Source Project88b60792009-03-03 19:28:42 -0800136ifneq ($(prebuilt_module_is_a_library),)
137 ifneq ($(LOCAL_IS_HOST_MODULE),)
138 $(transform-host-ranlib-copy-hack)
139 else
140 $(transform-ranlib-copy-hack)
141 endif
142endif