1#
2# Copyright (C) 2010-2012 The Android Open Source Project
3#
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
17LOCAL_PATH := $(call my-dir)
18LIBBCC_ROOT_PATH := $(LOCAL_PATH)
19
20FORCE_BUILD_LLVM_DISABLE_NDEBUG ?= false
21# Legality check: FORCE_BUILD_LLVM_DISABLE_NDEBUG should consist of one word -- either "true" or "false".
22ifneq "$(words $(FORCE_BUILD_LLVM_DISABLE_NDEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DISABLE_NDEBUG)))" "10"
23  $(error FORCE_BUILD_LLVM_DISABLE_NDEBUG may only be true, false, or unset)
24endif
25
26FORCE_BUILD_LLVM_DEBUG ?= false
27# Legality check: FORCE_BUILD_LLVM_DEBUG should consist of one word -- either "true" or "false".
28ifneq "$(words $(FORCE_BUILD_LLVM_DEBUG))$(words $(filter-out true false,$(FORCE_BUILD_LLVM_DEBUG)))" "10"
29  $(error FORCE_BUILD_LLVM_DEBUG may only be true, false, or unset)
30endif
31
32include $(LIBBCC_ROOT_PATH)/libbcc.mk
33
34include frameworks/compile/slang/rs_version.mk
35
36#=====================================================================
37# Whole Static Library to Be Linked In
38#=====================================================================
39
40libbcc_WHOLE_STATIC_LIBRARIES += \
41  libbccRenderscript \
42  libbccCore \
43  libbccSupport
44
45#=====================================================================
46# Device Shared Library libbcc
47#=====================================================================
48ifneq (true,$(DISABLE_LLVM_DEVICE_BUILDS))
49
50include $(CLEAR_VARS)
51
52LOCAL_MODULE := libbcc
53LOCAL_MODULE_TAGS := optional
54LOCAL_MODULE_CLASS := SHARED_LIBRARIES
55
56LOCAL_WHOLE_STATIC_LIBRARIES := $(libbcc_WHOLE_STATIC_LIBRARIES)
57
58LOCAL_SHARED_LIBRARIES := libbcinfo libLLVM libdl libutils libcutils liblog libc++
59
60# Modules that need get installed if and only if the target libbcc.so is
61# installed.
62LOCAL_REQUIRED_MODULES := libclcore.bc libclcore_debug.bc libclcore_g.bc libcompiler_rt
63
64LOCAL_REQUIRED_MODULES_x86 += libclcore_x86.bc
65LOCAL_REQUIRED_MODULES_x86_64 += libclcore_x86.bc
66
67ifeq ($(ARCH_ARM_HAVE_NEON),true)
68  LOCAL_REQUIRED_MODULES_arm += libclcore_neon.bc
69endif
70
71include $(LIBBCC_DEVICE_BUILD_MK)
72include $(LLVM_DEVICE_BUILD_MK)
73include $(BUILD_SHARED_LIBRARY)
74endif
75
76#=====================================================================
77# Host Shared Library libbcc
78#=====================================================================
79
80# Don't build for unbundled branches
81ifeq (,$(TARGET_BUILD_APPS))
82
83include $(CLEAR_VARS)
84
85LOCAL_MODULE := libbcc
86LOCAL_MODULE_HOST_OS := darwin linux windows
87LOCAL_MODULE_CLASS := SHARED_LIBRARIES
88LOCAL_IS_HOST_MODULE := true
89
90LOCAL_WHOLE_STATIC_LIBRARIES += $(libbcc_WHOLE_STATIC_LIBRARIES)
91
92LOCAL_STATIC_LIBRARIES += \
93  libutils \
94  libcutils \
95  liblog
96
97LOCAL_SHARED_LIBRARIES := libbcinfo
98
99LOCAL_LDLIBS_darwin := -ldl -lpthread
100LOCAL_LDLIBS_linux := -ldl -lpthread
101
102include $(LIBBCC_ROOT_PATH)/llvm-loadable-libbcc.mk
103
104ifeq ($(CAN_BUILD_HOST_LLVM_LOADABLE_MODULE),true)
105LOCAL_STATIC_LIBRARIES_linux += libLLVMLinker
106else
107LOCAL_SHARED_LIBRARIES_linux += libLLVM
108endif
109LOCAL_SHARED_LIBRARIES_darwin += libLLVM
110LOCAL_SHARED_LIBRARIES_windows += libLLVM
111
112include $(LIBBCC_HOST_BUILD_MK)
113include $(LLVM_HOST_BUILD_MK)
114include $(BUILD_HOST_SHARED_LIBRARY)
115
116endif # Don't build in unbundled branches
117
118#=====================================================================
119# Include Subdirectories
120#=====================================================================
121include $(call all-makefiles-under,$(LOCAL_PATH))
122