blob: 31ea0e07dfd469ee5858aa93f3dfcb7c8fb7a169 [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
Ying Wangb1a4e4e2012-05-15 15:31:41 -070038# Don't install static libraries by default.
39ifndef LOCAL_UNINSTALLABLE_MODULE
40ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS))
41 LOCAL_UNINSTALLABLE_MODULE := true
42endif
43endif
44
Ji-Hwan Lee0219e922011-07-07 03:10:14 +090045ifeq ($(LOCAL_STRIP_MODULE),true)
46 ifdef LOCAL_IS_HOST_MODULE
47 $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
48 endif
49 ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
50 $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
51 endif
52 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
53 $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
54 endif
55 include $(BUILD_SYSTEM)/dynamic_binary.mk
56 built_module := $(linked_module)
57else
58 include $(BUILD_SYSTEM)/base_rules.mk
59 built_module := $(LOCAL_BUILT_MODULE)
The Android Open Source Project88b60792009-03-03 19:28:42 -080060
Ying Wang5f074802011-11-08 09:31:21 -080061ifdef prebuilt_module_is_a_library
Ying Wang383ecfa2012-12-03 18:24:55 -080062export_includes := $(intermediates)/export_includes
63$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
64$(export_includes) : $(LOCAL_MODULE_MAKEFILE)
65 @echo Export includes file: $< -- $@
Ying Wang5f074802011-11-08 09:31:21 -080066 $(hide) mkdir -p $(dir $@) && rm -f $@
Ying Wang383ecfa2012-12-03 18:24:55 -080067ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
68 $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
69 echo "-I $$d" >> $@; \
70 done
71else
Ying Wang5f074802011-11-08 09:31:21 -080072 $(hide) touch $@
Ying Wang383ecfa2012-12-03 18:24:55 -080073endif
Ying Wang616e5962012-04-18 17:35:55 -070074
75$(LOCAL_BUILT_MODULE) : | $(intermediates)/export_includes
Ying Wang5f074802011-11-08 09:31:21 -080076endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080077endif
78
Owen Lin64d5a802009-10-16 02:43:05 -070079PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
80
Doug Zongker08d79c12011-10-05 08:16:30 -070081ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
82 # The magic string "EXTERNAL" means this package will be signed with
83 # the default dev key throughout the build process, but we expect
84 # the final package to be signed with a different key.
85 #
86 # This can be used for packages where we don't have access to the
87 # keys, but want the package to be predexopt'ed.
88 LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
89 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
90
91 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
92 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
93endif
94ifeq ($(LOCAL_CERTIFICATE),)
95 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
96 # It is now a build error to add a prebuilt .apk without
97 # specifying a key for it.
98 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(LOCAL_SRC_FILES)")
99 endif
100else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
101 # The magic string "PRESIGNED" means this package is already checked
102 # signed with its release key.
103 #
104 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
105 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
106 # but the dexpreopt process will not try to re-sign the app.
107 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
108 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
109else
110 # If this is not an absolute certificate, assign it to a generic one.
111 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
112 LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
113 endif
114
115 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
116 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
117 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
118
119 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
120 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
121endif
122
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -0700123ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
Doug Zongker08d79c12011-10-05 08:16:30 -0700124ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
125# Ensure that presigned .apks have been aligned.
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900126$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -0700127 $(transform-prebuilt-to-target-with-zipalign)
128else
Doug Zongker08d79c12011-10-05 08:16:30 -0700129# Sign and align non-presigned .apks.
130$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
131 $(transform-prebuilt-to-target)
132 $(sign-package)
133 $(align-package)
134endif
135else
Doug Zongker1046d202009-08-06 13:02:19 -0700136ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900137$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
Doug Zongker1046d202009-08-06 13:02:19 -0700138 $(transform-prebuilt-to-target-strip-comments)
139else
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900140$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800141 $(transform-prebuilt-to-target)
Ying Wang5f074802011-11-08 09:31:21 -0800142ifneq ($(prebuilt_module_is_a_library),)
143 ifneq ($(LOCAL_IS_HOST_MODULE),)
144 $(transform-host-ranlib-copy-hack)
145 else
146 $(transform-ranlib-copy-hack)
147 endif
148endif
Doug Zongker1046d202009-08-06 13:02:19 -0700149endif
Dianne Hackborn9c0c4b72009-08-11 19:16:46 -0700150endif
151
Ying Wanga83940f2010-09-24 18:09:04 -0700152ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
153# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
154# 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 -0800155# For nonstatic library, $(common_javalib_jar) is the dependency file,
156# while $(common_classes_jar) is used to link.
157common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
158common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
159
160$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
Ying Wanga83940f2010-09-24 18:09:04 -0700161 $(transform-prebuilt-to-target)
Ying Wang5b316b62011-02-01 12:57:45 -0800162
163$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
164 $(transform-prebuilt-to-target)
165
166# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
Ji-Hwan Lee0219e922011-07-07 03:10:14 +0900167$(built_module) : $(common_javalib_jar)
Ying Wang5b316b62011-02-01 12:57:45 -0800168endif # TARGET JAVA_LIBRARIES