blob: 7112a1a1d9ef03675ca9ed346d5c374d94be1c2a [file] [log] [blame]
Logan Chien48dc01d2011-07-13 18:12:06 +08001#
Zonr Chang7a5d4232012-04-12 15:39:06 +08002# Copyright (C) 2012 The Android Open Source Project
Logan Chien48dc01d2011-07-13 18:12:06 +08003#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# NOTE: Following rules are extracted from base_rules.mk and binary.mk.
18# We must ensure that they are synchronized.
19
20LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
21ifdef LOCAL_IS_HOST_MODULE
22 ifneq ($(LOCAL_IS_HOST_MODULE),true)
23 $(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
24 endif
25 my_prefix:=HOST_
26else
27 my_prefix:=TARGET_
28endif
29
30so_suffix := $($(my_prefix)SHLIB_SUFFIX)
31a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
32
33# Extract Depended Libraries
34LOCAL_LIBBCC_LIB_DEPS := \
35 $(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
36 $(call intermediates-dir-for, \
37 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix)) \
38 $(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
39 $(call intermediates-dir-for, \
40 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix)) \
41 $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
Logan Chienf68882e2011-07-18 19:11:39 +080042 $(addsuffix $(so_suffix), $(LOCAL_SHARED_LIBRARIES))) \
Logan Chien48dc01d2011-07-13 18:12:06 +080043
Zonr Chang7a5d4232012-04-12 15:39:06 +080044# Build Rules for Automatically Generated Build Information
45GEN := $(local-intermediates-dir)/BuildInfo.cpp
46
47gen_build_info := $(LOCAL_PATH)/tools/build/gen-build-info.py
Logan Chien48dc01d2011-07-13 18:12:06 +080048
49$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
50$(GEN): PRIVATE_DEPS := $(LOCAL_LIBBCC_LIB_DEPS)
Zonr Chang7a5d4232012-04-12 15:39:06 +080051$(GEN): PRIVATE_CUSTOM_TOOL = $(gen_build_info) $(PRIVATE_PATH) \
52 $(PRIVATE_DEPS) > $@
53$(GEN): $(gen_build_info) $(LOCAL_LIBBCC_LIB_DEPS) \
Logan Chien3d600522011-07-15 11:10:54 +080054 $(wildcard $(LOCAL_PATH)/.git/COMMIT_EDITMSG)
Logan Chien48dc01d2011-07-13 18:12:06 +080055 $(transform-generated-source)
56
57LOCAL_GENERATED_SOURCES += $(GEN)