blob: 8f9eafb2fb5468f7f564019258287cbc1af5378f [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
The Android Open Source Project88b60792009-03-03 19:28:42 -080029include $(BUILD_SYSTEM)/base_rules.mk
30
31# Deal with the OSX library timestamp issue when installing
32# a prebuilt simulator library.
33ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
34 prebuilt_module_is_a_library := true
35else
36 prebuilt_module_is_a_library :=
37endif
38
Owen Lin64d5a802009-10-16 02:43:05 -070039PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
40
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070041# Ensure that prebuilt .apks have been aligned.
42ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
Ying Wang06e2f722011-05-26 15:59:56 -070043ifeq ($(LOCAL_DEX_PREOPT),true)
44# Make sure the boot jars get dexpreopt-ed first
45$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT) $(AAPT)
46endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070047$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
48 $(transform-prebuilt-to-target-with-zipalign)
Ying Wang06e2f722011-05-26 15:59:56 -070049ifeq ($(LOCAL_DEX_PREOPT),true)
50 $(hide) rm -f $(patsubst %.apk,%.odex,$@)
51 $(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
52 $(call dexpreopt-remove-classes.dex,$@)
53
54built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
55$(built_odex): $(LOCAL_BUILT_MODULE)
56endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070057else
Doug Zongker1046d202009-08-06 13:02:19 -070058ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
59$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
60 $(transform-prebuilt-to-target-strip-comments)
61else
The Android Open Source Project88b60792009-03-03 19:28:42 -080062$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
63 $(transform-prebuilt-to-target)
Doug Zongker1046d202009-08-06 13:02:19 -070064endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070065endif
66
Ying Wanga83940f2010-09-24 18:09:04 -070067ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
68# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
69# 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 -080070# For nonstatic library, $(common_javalib_jar) is the dependency file,
71# while $(common_classes_jar) is used to link.
72common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
73common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
74
75$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
Ying Wanga83940f2010-09-24 18:09:04 -070076 $(transform-prebuilt-to-target)
Ying Wang5b316b62011-02-01 12:57:45 -080077
78$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
79 $(transform-prebuilt-to-target)
80
81# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
82$(LOCAL_BUILT_MODULE) : $(common_javalib_jar)
83endif # TARGET JAVA_LIBRARIES
Ying Wanga83940f2010-09-24 18:09:04 -070084
Doug Zongkerf6a53aa2009-12-15 15:06:55 -080085ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
86 # The magic string "EXTERNAL" means this package will be signed with
87 # the test key throughout the build process, but we expect the final
88 # package to be signed with a different key.
89 #
90 # This can be used for packages where we don't have access to the
91 # keys, but want the package to be predexopt'ed.
92 LOCAL_CERTIFICATE := testkey
93 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
94endif
Doug Zongker1b6d0a62009-08-26 18:22:43 -070095ifeq ($(LOCAL_CERTIFICATE),)
Doug Zongker45302ff2009-12-11 13:50:35 -080096 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
97 # It is now a build error to add a prebuilt .apk without
98 # specifying a key for it.
99 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)")
100 endif
101else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
102 # The magic string "PRESIGNED" means this package is already checked
103 # signed with its release key.
Doug Zongker714111c2009-12-14 09:56:19 -0800104 #
105 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
106 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
107 # but the dexpreopt process will not try to re-sign the app.
108 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
109 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700110else
Doug Zongker45302ff2009-12-11 13:50:35 -0800111 # If this is not an absolute certificate, assign it to a generic one.
112 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
113 LOCAL_CERTIFICATE := $(SRC_TARGET_DIR)/product/security/$(LOCAL_CERTIFICATE)
114 endif
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700115
Doug Zongker45302ff2009-12-11 13:50:35 -0800116 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
117 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
118 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
Doug Zongker1b6d0a62009-08-26 18:22:43 -0700119endif
120
The Android Open Source Project88b60792009-03-03 19:28:42 -0800121ifneq ($(prebuilt_module_is_a_library),)
122 ifneq ($(LOCAL_IS_HOST_MODULE),)
123 $(transform-host-ranlib-copy-hack)
124 else
125 $(transform-ranlib-copy-hack)
126 endif
127endif