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
17# Don't build for unbundled branches
18ifeq (,$(TARGET_BUILD_APPS))
19
20LOCAL_PATH := $(call my-dir)
21LIBBCC_ROOT_PATH := $(LOCAL_PATH)
22include $(LIBBCC_ROOT_PATH)/libbcc.mk
23
24#=====================================================================
25# Whole Static Library to Be Linked In
26#=====================================================================
27
28libbcc_WHOLE_STATIC_LIBRARIES += \
29  libbccRenderscript \
30  libbccExecutionEngine \
31  libbccCore \
32  libbccSupport
33
34#=====================================================================
35# Calculate SHA1 checksum for libbcc.so, libRS.so and libclcore.bc
36#=====================================================================
37
38include $(CLEAR_VARS)
39
40LOCAL_MODULE := libbcc.sha1
41LOCAL_MODULE_TAGS := optional
42LOCAL_MODULE_CLASS := SHARED_LIBRARIES
43
44libbcc_SHA1_SRCS := \
45  $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libbcc.so \
46  $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libcompiler_rt.so \
47  $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRS.so \
48  $(call intermediates-dir-for,SHARED_LIBRARIES,libclcore.bc,,)/libclcore.bc \
49  $(call intermediates-dir-for,SHARED_LIBRARIES,libclcore_debug.bc,,)/libclcore_debug.bc
50
51ifeq ($(ARCH_ARM_HAVE_NEON),true)
52  libbcc_SHA1_SRCS += \
53    $(call intermediates-dir-for,SHARED_LIBRARIES,libclcore_neon.bc,,)/libclcore_neon.bc
54endif
55
56libbcc_GEN_SHA1_STAMP := $(LOCAL_PATH)/tools/build/gen-sha1-stamp.py
57intermediates := $(call local-intermediates-dir)
58
59libbcc_SHA1_ASM := $(intermediates)/libbcc.sha1.S
60LOCAL_GENERATED_SOURCES += $(libbcc_SHA1_ASM)
61$(libbcc_SHA1_ASM): PRIVATE_SHA1_SRCS := $(libbcc_SHA1_SRCS)
62$(libbcc_SHA1_ASM): $(libbcc_SHA1_SRCS) $(libbcc_GEN_SHA1_STAMP)
63	@echo libbcc.sha1: $@
64	$(hide) mkdir -p $(dir $@)
65	$(hide) $(libbcc_GEN_SHA1_STAMP) $(PRIVATE_SHA1_SRCS) > $@
66
67LOCAL_CFLAGS += -D_REENTRANT -DPIC -fPIC
68LOCAL_CFLAGS += -O3 -nodefaultlibs -nostdlib
69
70include $(BUILD_SHARED_LIBRARY)
71
72#=====================================================================
73# Device Shared Library libbcc
74#=====================================================================
75
76include $(CLEAR_VARS)
77
78LOCAL_MODULE := libbcc
79LOCAL_MODULE_TAGS := optional
80LOCAL_MODULE_CLASS := SHARED_LIBRARIES
81
82LOCAL_WHOLE_STATIC_LIBRARIES := $(libbcc_WHOLE_STATIC_LIBRARIES)
83
84LOCAL_WHOLE_STATIC_LIBRARIES += librsloader
85
86LOCAL_SHARED_LIBRARIES := libbcinfo libLLVM libdl libutils libcutils liblog libstlport
87
88# Modules that need get installed if and only if the target libbcc.so is
89# installed.
90LOCAL_REQUIRED_MODULES := libclcore.bc libclcore_debug.bc libbcc.sha1 libcompiler_rt
91
92ifeq ($(ARCH_X86_HAVE_SSE2),true)
93LOCAL_REQUIRED_MODULES += libclcore_x86.bc
94endif
95
96ifeq ($(ARCH_ARM_HAVE_NEON),true)
97  LOCAL_REQUIRED_MODULES += libclcore_neon.bc
98endif
99
100# Generate build information (Build time + Build git revision + Build Semi SHA1)
101include $(LIBBCC_ROOT_PATH)/libbcc-gen-build-info.mk
102
103include $(LIBBCC_DEVICE_BUILD_MK)
104include $(BUILD_SHARED_LIBRARY)
105
106#=====================================================================
107# Host Shared Library libbcc
108#=====================================================================
109
110include $(CLEAR_VARS)
111
112LOCAL_MODULE := libbcc
113LOCAL_MODULE_TAGS := optional
114LOCAL_MODULE_CLASS := SHARED_LIBRARIES
115LOCAL_IS_HOST_MODULE := true
116
117LOCAL_WHOLE_STATIC_LIBRARIES += $(libbcc_WHOLE_STATIC_LIBRARIES)
118
119LOCAL_WHOLE_STATIC_LIBRARIES += librsloader
120
121LOCAL_STATIC_LIBRARIES += \
122  libutils \
123  libcutils \
124  liblog
125
126LOCAL_SHARED_LIBRARIES := libbcinfo libLLVM
127
128ifndef USE_MINGW
129LOCAL_LDLIBS := -ldl -lpthread
130endif
131
132# Generate build information (Build time + Build git revision + Build Semi SHA1)
133include $(LIBBCC_ROOT_PATH)/libbcc-gen-build-info.mk
134
135include $(LIBBCC_HOST_BUILD_MK)
136include $(BUILD_HOST_SHARED_LIBRARY)
137
138endif # Don't build in unbundled branches
139
140#=====================================================================
141# Include Subdirectories
142#=====================================================================
143include $(call all-makefiles-under,$(LOCAL_PATH))
144