Android.mk revision 6ddb349243e03b30b9d11cc0405d048cd07b6378
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
49clcore_files_32 := \
50    $(clcore_base_files_32) \
51    ll32/math.ll
52
53clcore_files_64 := \
54    $(clcore_base_files_64) \
55    ll64/math.ll
56
57clcore_neon_files := \
58    $(clcore_base_files) \
59    $(clcore_files_32) \
60    arch/neon.ll \
61    arch/clamp.c
62
63clcore_arm64_files := \
64    $(clcore_files_64) \
65    arch/asimd.ll \
66    arch/clamp.c
67
68clcore_x86_files := \
69    $(clcore_base_files) \
70    arch/generic.c \
71    arch/x86_sse2.ll \
72    arch/x86_sse3.ll \
73    arch/x86_trunc.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)
154LOCAL_SRC_FILES_x86 := arch/x86_trunc.ll
155LOCAL_SRC_FILES_32 := arch/generic.c
156
157ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64))
158LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON
159LOCAL_SRC_FILES_64 := arch/generic.c
160endif
161
162include $(LOCAL_PATH)/build_bc_lib.mk
163rs_g_runtime :=
164
165
166### Build new versions (librsrt_<ARCH>.bc) as host shared libraries.
167### These will be used with bcc_compat and the support library.
168
169# Build the ARM version of the library
170include $(CLEAR_VARS)
171
172# FIXME for 64-bit
173LOCAL_32_BIT_ONLY := true
174
175BCC_RS_TRIPLE := armv7-none-linux-gnueabi
176RS_TRIPLE_CFLAGS :=
177LOCAL_MODULE := librsrt_arm.bc
178LOCAL_IS_HOST_MODULE := true
179LOCAL_CFLAGS += $(clcore_cflags)
180LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
181include $(LOCAL_PATH)/build_bc_lib.mk
182
183# Build the MIPS version of the library
184include $(CLEAR_VARS)
185
186# FIXME for 64-bit
187LOCAL_32_BIT_ONLY := true
188
189BCC_RS_TRIPLE := armv7-none-linux-gnueabi
190RS_TRIPLE_CFLAGS :=
191LOCAL_MODULE := librsrt_mips.bc
192LOCAL_IS_HOST_MODULE := true
193LOCAL_CFLAGS += $(clcore_cflags)
194LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
195include $(LOCAL_PATH)/build_bc_lib.mk
196
197# Build the x86 version of the library
198include $(CLEAR_VARS)
199
200# FIXME for 64-bit
201LOCAL_32_BIT_ONLY := true
202
203BCC_RS_TRIPLE := armv7-none-linux-gnueabi
204RS_TRIPLE_CFLAGS := -D__i386__
205LOCAL_MODULE := librsrt_x86.bc
206LOCAL_IS_HOST_MODULE := true
207LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3
208LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_32)
209include $(LOCAL_PATH)/build_bc_lib.mk
210
211include $(CLEAR_VARS)
212
213BCC_RS_TRIPLE := aarch64-linux-android
214RS_TRIPLE_CFLAGS :=
215LOCAL_MODULE := librsrt_arm64.bc
216LOCAL_IS_HOST_MODULE := true
217LOCAL_CFLAGS += $(clcore_cflags)
218LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_64)
219include $(LOCAL_PATH)/build_bc_lib.mk
220