blob: fa6a521756dfabd50e9e019aaf6af2ff9a3a07d7 [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, \
Colin Cross71df0502014-02-04 16:27:32 -080037 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(my_2nd_arch_prefix))/$(lib)$(a_suffix)) \
Logan Chien48dc01d2011-07-13 18:12:06 +080038 $(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
39 $(call intermediates-dir-for, \
Colin Cross71df0502014-02-04 16:27:32 -080040 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(my_2nd_arch_prefix))/$(lib)$(a_suffix)) \
41 $(addprefix $($(my_2nd_arch_prefix)$(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
Colin Cross71df0502014-02-04 16:27:32 -080045GEN := $(call local-intermediates-dir,,$(my_2nd_arch_prefix))/BuildInfo.cpp
Zonr Chang7a5d4232012-04-12 15:39:06 +080046
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
Colin Cross71df0502014-02-04 16:27:32 -080057ifdef LOCAL_IS_HOST_MODULE
Logan Chien48dc01d2011-07-13 18:12:06 +080058LOCAL_GENERATED_SOURCES += $(GEN)
Colin Cross71df0502014-02-04 16:27:32 -080059else
60LOCAL_GENERATED_SOURCES_$(TARGET_$(my_2nd_arch_prefix)ARCH) += $(GEN)
61endif