• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2013 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)
18
19# C/LLVM-IR source files for the library
20clcore_base_files := \
21    rs_allocation.c \
22    rs_cl.c \
23    rs_core.c \
24    rs_element.c \
25    rs_f16_math.c \
26    rs_mesh.c \
27    rs_matrix.c \
28    rs_program.c \
29    rs_sample.c \
30    rs_sampler.c \
31    rs_convert.c \
32    rs_quaternion.c
33
34clcore_cflags := -Iframeworks/rs/cpu_ref -DRS_DECLARE_EXPIRED_APIS
35
36clcore_base_files_32 := \
37    ll32/allocation.ll
38
39clcore_base_files_64 := \
40    ll64/allocation.ll
41
42clcore_files := \
43    $(clcore_base_files) \
44    arch/generic.c
45
46clcore_g_files := \
47    rs_abi_debuginfo.c \
48    arch/generic.c
49
50clcore_files_32 := \
51    $(clcore_base_files_32) \
52    ll32/math.ll
53
54clcore_files_64 := \
55    $(clcore_base_files_64) \
56    ll64/math.ll
57
58clcore_neon_files := \
59    $(clcore_base_files) \
60    $(clcore_files_32) \
61    arch/neon.ll \
62    arch/clamp.c
63
64clcore_arm64_files := \
65    $(clcore_files_64) \
66    arch/asimd.ll \
67    arch/clamp.c
68
69clcore_x86_files := \
70    $(clcore_base_files) \
71    arch/generic.c \
72    arch/x86_sse2.ll \
73    arch/x86_sse3.ll
74
75# Grab the current value for $(RS_VERSION_DEFINE)
76include frameworks/compile/slang/rs_version.mk
77
78# Build the base version of the library
79include $(CLEAR_VARS)
80
81LOCAL_MODULE := libclcore.bc
82LOCAL_CFLAGS += $(clcore_cflags)
83LOCAL_SRC_FILES := $(clcore_base_files)
84LOCAL_SRC_FILES_32 := $(clcore_files_32)
85LOCAL_SRC_FILES_32 += arch/generic.c
86
87ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64))
88LOCAL_SRC_FILES_64 := $(clcore_arm64_files)
89LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON
90else
91LOCAL_SRC_FILES_64 := $(clcore_files_64)
92LOCAL_SRC_FILES_64 += arch/generic.c
93endif
94
95include $(LOCAL_PATH)/build_bc_lib.mk
96
97# Build a debug version of the library
98include $(CLEAR_VARS)
99
100LOCAL_MODULE := libclcore_debug.bc
101rs_debug_runtime := 1
102LOCAL_CFLAGS += $(clcore_cflags)
103LOCAL_SRC_FILES := $(clcore_base_files)
104LOCAL_SRC_FILES_32 := $(clcore_files_32)
105LOCAL_SRC_FILES_32 += arch/generic.c
106
107ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64))
108LOCAL_SRC_FILES_64 := $(clcore_arm64_files)
109LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON
110else
111LOCAL_SRC_FILES_64 := $(clcore_files_64)
112LOCAL_SRC_FILES_64 += arch/generic.c
113endif
114
115include $(LOCAL_PATH)/build_bc_lib.mk
116rs_debug_runtime :=
117
118# Build an optimized version of the library for x86 platforms (all have SSE2/3).
119ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
120include $(CLEAR_VARS)
121
122LOCAL_MODULE := libclcore_x86.bc
123LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3
124LOCAL_SRC_FILES := $(clcore_x86_files)
125LOCAL_SRC_FILES_32 := $(clcore_base_files_32)
126LOCAL_SRC_FILES_64 := $(clcore_base_files_64)
127
128include $(LOCAL_PATH)/build_bc_lib.mk
129endif
130
131# Build a NEON-enabled version of the library (if possible)
132# Only build on 32-bit, because we don't need a 64-bit NEON lib
133ifeq ($(ARCH_ARM_HAVE_NEON),true)
134  include $(CLEAR_VARS)
135
136  LOCAL_32_BIT_ONLY := true
137
138  LOCAL_MODULE := libclcore_neon.bc
139  LOCAL_CFLAGS += $(clcore_cflags)
140  LOCAL_SRC_FILES := $(clcore_neon_files)
141  LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON
142
143  include $(LOCAL_PATH)/build_bc_lib.mk
144endif
145
146# Build a version of the library with debug info
147include $(CLEAR_VARS)
148
149LOCAL_MODULE := libclcore_g.bc
150rs_g_runtime := 1
151LOCAL_CFLAGS += $(clcore_cflags)
152LOCAL_CFLAGS += -g -O0
153LOCAL_SRC_FILES := $(clcore_base_files) $(clcore_g_files)
154
155ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64))
156LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON
157endif
158
159include $(LOCAL_PATH)/build_bc_lib.mk
160rs_g_runtime :=
161
162
163### Build new versions (librsrt_<ARCH>.bc) as host shared libraries.
164### These will be used with bcc_compat and the support library.
165
166# Build the ARM version of the library
167include $(CLEAR_VARS)
168
169# FIXME for 64-bit
170LOCAL_32_BIT_ONLY := true
171
172BCC_RS_TRIPLE := armv7-linux-androideabi
173RS_TRIPLE_CFLAGS :=
174LOCAL_MODULE := librsrt_arm.bc
175LOCAL_IS_HOST_MODULE := true
176LOCAL_CFLAGS += $(clcore_cflags)
177LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
178include $(LOCAL_PATH)/build_bc_lib.mk
179
180# Build the MIPS version of the library
181include $(CLEAR_VARS)
182
183# FIXME for 64-bit
184LOCAL_32_BIT_ONLY := true
185
186BCC_RS_TRIPLE := armv7-linux-androideabi
187RS_TRIPLE_CFLAGS :=
188LOCAL_MODULE := librsrt_mips.bc
189LOCAL_IS_HOST_MODULE := true
190LOCAL_CFLAGS += $(clcore_cflags)
191LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
192include $(LOCAL_PATH)/build_bc_lib.mk
193
194# Build the x86 version of the library
195include $(CLEAR_VARS)
196
197# FIXME for 64-bit
198LOCAL_32_BIT_ONLY := true
199
200BCC_RS_TRIPLE := armv7-linux-androideabi
201RS_TRIPLE_CFLAGS := -D__i386__
202LOCAL_MODULE := librsrt_x86.bc
203LOCAL_IS_HOST_MODULE := true
204LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3
205LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_32)
206include $(LOCAL_PATH)/build_bc_lib.mk
207
208include $(CLEAR_VARS)
209
210BCC_RS_TRIPLE := aarch64-linux-android
211RS_TRIPLE_CFLAGS :=
212LOCAL_MODULE := librsrt_arm64.bc
213LOCAL_IS_HOST_MODULE := true
214LOCAL_CFLAGS += $(clcore_cflags)
215LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_64)
216include $(LOCAL_PATH)/build_bc_lib.mk
217
218# Build the x86_64 version of the library
219include $(CLEAR_VARS)
220
221BCC_RS_TRIPLE := aarch64-linux-android
222RS_TRIPLE_CFLAGS := -D__x86_64__
223LOCAL_MODULE := librsrt_x86_64.bc
224LOCAL_IS_HOST_MODULE := true
225LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3
226LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_64)
227include $(LOCAL_PATH)/build_bc_lib.mk
228