• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2010 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16# this file is included from prebuilt-shared-library.mk or
17# prebuilt-static-library.mk to declare prebuilt library binaries.
18#
19
20$(call assert-defined, LOCAL_BUILD_SCRIPT LOCAL_MAKEFILE LOCAL_PREBUILT_PREFIX LOCAL_PREBUILT_SUFFIX)
21
22$(call check-defined-LOCAL_MODULE,$(LOCAL_BUILD_SCRIPT))
23$(call check-LOCAL_MODULE,$(LOCAL_MAKEFILE))
24$(call check-LOCAL_MODULE_FILENAME)
25
26# Check that LOCAL_SRC_FILES contains only the path to one library
27ifneq ($(words $(LOCAL_SRC_FILES)),1)
28$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): The LOCAL_SRC_FILES for a prebuilt library should only contain one item))
29$(call __ndk_error,Aborting)
30endif
31
32bad_prebuilts := $(filter-out %$(LOCAL_PREBUILT_SUFFIX),$(LOCAL_SRC_FILES))
33ifdef bad_prebuilts
34$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_SRC_FILES should point to a file ending with "$(LOCAL_PREBUILT_SUFFIX)")
35$(call __ndk_info,The following file is unsupported: $(bad_prebuilts))
36$(call __ndk_error,Aborting)
37endif
38
39prebuilt_path := $(call local-prebuilt-path,$(LOCAL_SRC_FILES))
40prebuilt := $(strip $(wildcard $(prebuilt_path)))
41
42ifndef prebuilt
43$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_SRC_FILES points to a missing file)
44$(call __ndk_info,Check that $(prebuilt_path) exists, or that its path is correct)
45$(call __ndk_error,Aborting)
46endif
47
48# If LOCAL_MODULE_FILENAME is defined, it will be used to name the file
49# in the TARGET_OUT directory, and then the installation one. Note that
50# it shouldn't have an .a or .so extension nor contain directory separators.
51#
52# If the variable is not defined, we determine its value from LOCAL_SRC_FILES
53#
54LOCAL_MODULE_FILENAME := $(strip $(LOCAL_MODULE_FILENAME))
55ifndef LOCAL_MODULE_FILENAME
56    LOCAL_MODULE_FILENAME := $(notdir $(LOCAL_SRC_FILES))
57    LOCAL_MODULE_FILENAME := $(LOCAL_MODULE_FILENAME:%$(LOCAL_PREBUILT_SUFFIX)=%)
58endif
59$(eval $(call ev-check-module-filename))
60
61# If LOCAL_BUILT_MODULE is not defined, then ensure that the prebuilt is
62# copied to TARGET_OUT during the build.
63LOCAL_BUILT_MODULE := $(strip $(LOCAL_BUILT_MODULE))
64ifndef LOCAL_BUILT_MODULE
65  LOCAL_BUILT_MODULE := $(TARGET_OUT)/$(LOCAL_MODULE_FILENAME)$(LOCAL_PREBUILT_SUFFIX)
66  LOCAL_OBJECTS      := $(prebuilt)
67
68  $(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
69endif
70
71LOCAL_OBJS_DIR  := $(TARGET_OBJS)/$(LOCAL_MODULE)
72LOCAL_SRC_FILES :=
73
74include $(BUILD_SYSTEM)/build-module.mk
75