blob: 54a7fa9f650720441977e33e9646c69b50283fde [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
Doug Zongker08d79c12011-10-05 08:16:30 -070057ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
58 # The magic string "EXTERNAL" means this package will be signed with
59 # the default dev key throughout the build process, but we expect
60 # the final package to be signed with a different key.
61 #
62 # This can be used for packages where we don't have access to the
63 # keys, but want the package to be predexopt'ed.
64 LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
65 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
66
67 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
68 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
69endif
70ifeq ($(LOCAL_CERTIFICATE),)
71 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
72 # It is now a build error to add a prebuilt .apk without
73 # specifying a key for it.
74 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)")
75 endif
76else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
77 # The magic string "PRESIGNED" means this package is already checked
78 # signed with its release key.
79 #
80 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
81 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
82 # but the dexpreopt process will not try to re-sign the app.
83 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
84 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
85else
86 # If this is not an absolute certificate, assign it to a generic one.
87 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
88 LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
89 endif
90
91 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
92 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
93 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
94
95 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
96 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
97endif
98
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -070099ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
Doug Zongker08d79c12011-10-05 08:16:30 -0700100ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
101# Ensure that presigned .apks have been aligned.
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900102$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -0700103 $(transform-prebuilt-to-target-with-zipalign)
104else
Doug Zongker08d79c12011-10-05 08:16:30 -0700105# Sign and align non-presigned .apks.
106$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
107 $(transform-prebuilt-to-target)
108 $(sign-package)
109 $(align-package)
110endif
111else
Doug Zongker1046d202009-08-06 13:02:19 -0700112ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900113$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
Doug Zongker1046d202009-08-06 13:02:19 -0700114 $(transform-prebuilt-to-target-strip-comments)
115else
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900116$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800117 $(transform-prebuilt-to-target)
Doug Zongker1046d202009-08-06 13:02:19 -0700118endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -0700119endif
120
Ying Wanga83940f2010-09-24 18:09:04 -0700121ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
122# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
123# 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 -0800124# For nonstatic library, $(common_javalib_jar) is the dependency file,
125# while $(common_classes_jar) is used to link.
126common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
127common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
128
129$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
Ying Wanga83940f2010-09-24 18:09:04 -0700130 $(transform-prebuilt-to-target)
Ying Wang5b316b62011-02-01 12:57:45 -0800131
132$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
133 $(transform-prebuilt-to-target)
134
135# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900136$(built_module) : $(common_javalib_jar)
Ying Wang5b316b62011-02-01 12:57:45 -0800137endif # TARGET JAVA_LIBRARIES
Ying Wanga83940f2010-09-24 18:09:04 -0700138
The Android Open Source Project88b60792009-03-03 19:28:42 -0800139ifneq ($(prebuilt_module_is_a_library),)
140 ifneq ($(LOCAL_IS_HOST_MODULE),)
141 $(transform-host-ranlib-copy-hack)
142 else
143 $(transform-ranlib-copy-hack)
144 endif
145endif