• 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 paths to shared libraries
27ifneq ($(words $(LOCAL_SRC_FILES)),1)
28$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): The LOCAL_SRC_FILES for a prebuilt static 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 := $(strip $(wildcard $(LOCAL_PATH)/$(LOCAL_SRC_FILES)))
40ifndef prebuilt
41$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_SRC_FILES points to a missing file)
42$(call __ndk_info,Check that $(LOCAL_PATH)/$(LOCAL_SRC_FILES) exists, or that its path is correct)
43$(call __ndk_error,Aborting)
44endif
45
46# If LOCAL_MODULE_FILENAME is defined, it will be used to name the file
47# in the TARGET_OUT directory, and then the installation one. Note that
48# if shouldn't have an .a or .so extension nor contain directory separators.
49#
50# If the variable is not defined, we determine its value from LOCAL_SRC_FILES
51#
52LOCAL_MODULE_FILENAME := $(strip $(LOCAL_MODULE_FILENAME))
53ifndef LOCAL_MODULE_FILENAME
54    LOCAL_MODULE_FILENAME := $(notdir $(LOCAL_SRC_FILES))
55    LOCAL_MODULE_FILENAME := $(LOCAL_MODULE_FILENAME:%$(LOCAL_PREBUILT_SUFFIX)=%)
56endif
57$(eval $(call ev-check-module-filename))
58
59LOCAL_BUILT_MODULE := $(TARGET_OUT)/$(LOCAL_MODULE_FILENAME)$(LOCAL_PREBUILT_SUFFIX)
60LOCAL_OBJS_DIR     := $(TARGET_OBJS)/$(LOCAL_MODULE)
61LOCAL_OBJECTS      := $(prebuilt)
62LOCAL_SRC_FILES    :=
63
64$(LOCAL_BUILT_MODULE): $(LOCAL_OBJECTS)
65
66include $(BUILD_SYSTEM)/build-module.mk
67