blob: 0c46341180344d9178f2645d9cd8c00352d97270 [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
Ying Wang5f074802011-11-08 09:31:21 -080030# Deal with the OSX library timestamp issue when installing
31# a prebuilt simulator library.
32ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
33 prebuilt_module_is_a_library := true
34else
35 prebuilt_module_is_a_library :=
36endif
37
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090038ifeq ($(LOCAL_STRIP_MODULE),true)
39 ifdef LOCAL_IS_HOST_MODULE
40 $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
41 endif
42 ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
43 $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
44 endif
45 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
46 $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
47 endif
48 include $(BUILD_SYSTEM)/dynamic_binary.mk
49 built_module := $(linked_module)
50else
51 include $(BUILD_SYSTEM)/base_rules.mk
52 built_module := $(LOCAL_BUILT_MODULE)
The Android Open Source Project88b60792009-03-03 19:28:42 -080053
Ying Wang5f074802011-11-08 09:31:21 -080054ifdef prebuilt_module_is_a_library
55# Create a dummy export_includes.
56$(intermediates)/export_includes:
57 $(hide) mkdir -p $(dir $@) && rm -f $@
58 $(hide) touch $@
59endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080060endif
61
Owen Lin64d5a802009-10-16 02:43:05 -070062PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
63
Doug Zongker08d79c12011-10-05 08:16:30 -070064ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
65 # The magic string "EXTERNAL" means this package will be signed with
66 # the default dev key throughout the build process, but we expect
67 # the final package to be signed with a different key.
68 #
69 # This can be used for packages where we don't have access to the
70 # keys, but want the package to be predexopt'ed.
71 LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
72 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
73
74 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
75 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
76endif
77ifeq ($(LOCAL_CERTIFICATE),)
78 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
79 # It is now a build error to add a prebuilt .apk without
80 # specifying a key for it.
81 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)")
82 endif
83else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
84 # The magic string "PRESIGNED" means this package is already checked
85 # signed with its release key.
86 #
87 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
88 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
89 # but the dexpreopt process will not try to re-sign the app.
90 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
91 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
92else
93 # If this is not an absolute certificate, assign it to a generic one.
94 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
95 LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
96 endif
97
98 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
99 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
100 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
101
102 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
103 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
104endif
105
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -0700106ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
Doug Zongker08d79c12011-10-05 08:16:30 -0700107ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
108# Ensure that presigned .apks have been aligned.
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900109$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -0700110 $(transform-prebuilt-to-target-with-zipalign)
111else
Doug Zongker08d79c12011-10-05 08:16:30 -0700112# Sign and align non-presigned .apks.
113$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
114 $(transform-prebuilt-to-target)
115 $(sign-package)
116 $(align-package)
117endif
118else
Doug Zongker1046d202009-08-06 13:02:19 -0700119ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900120$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
Doug Zongker1046d202009-08-06 13:02:19 -0700121 $(transform-prebuilt-to-target-strip-comments)
122else
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900123$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800124 $(transform-prebuilt-to-target)
Ying Wang5f074802011-11-08 09:31:21 -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
Doug Zongker1046d202009-08-06 13:02:19 -0700132endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -0700133endif
134
Ying Wanga83940f2010-09-24 18:09:04 -0700135ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
136# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
137# 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 -0800138# For nonstatic library, $(common_javalib_jar) is the dependency file,
139# while $(common_classes_jar) is used to link.
140common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
141common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
142
143$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
Ying Wanga83940f2010-09-24 18:09:04 -0700144 $(transform-prebuilt-to-target)
Ying Wang5b316b62011-02-01 12:57:45 -0800145
146$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
147 $(transform-prebuilt-to-target)
148
149# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900150$(built_module) : $(common_javalib_jar)
Ying Wang5b316b62011-02-01 12:57:45 -0800151endif # TARGET JAVA_LIBRARIES