Android.mk revision 14c8aa51782107afb6f84187233f5ac8f6da0373
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_files_32 := \
47    $(clcore_base_files_32) \
48    ll32/math.ll
49
50clcore_files_64 := \
51    $(clcore_base_files_64) \
52    ll64/math.ll
53
54clcore_neon_files := \
55    $(clcore_base_files) \
56    $(clcore_files_32) \
57    arch/neon.ll \
58    arch/clamp.c
59
60clcore_arm64_files := \
61    $(clcore_files_64) \
62    arch/asimd.ll \
63    arch/clamp.c
64
65clcore_x86_files := \
66    $(clcore_base_files) \
67    arch/generic.c \
68    arch/x86_sse2.ll \
69    arch/x86_sse3.ll
70
71# Grab the current value for $(RS_VERSION_DEFINE)
72include frameworks/compile/slang/rs_version.mk
73
74# Build the base version of the library
75include $(CLEAR_VARS)
76
77LOCAL_MODULE := libclcore.bc
78LOCAL_CFLAGS += $(clcore_cflags)
79LOCAL_SRC_FILES := $(clcore_base_files)
80LOCAL_SRC_FILES_32 := $(clcore_files_32)
81LOCAL_SRC_FILES_32 += arch/generic.c
82
83ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64))
84LOCAL_SRC_FILES_64 := $(clcore_arm64_files)
85LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON
86else
87LOCAL_SRC_FILES_64 := $(clcore_files_64)
88LOCAL_SRC_FILES_64 += arch/generic.c
89endif
90
91include $(LOCAL_PATH)/build_bc_lib.mk
92
93# Build a debug version of the library
94include $(CLEAR_VARS)
95
96LOCAL_MODULE := libclcore_debug.bc
97rs_debug_runtime := 1
98LOCAL_CFLAGS += $(clcore_cflags)
99LOCAL_SRC_FILES := $(clcore_base_files)
100LOCAL_SRC_FILES_32 := $(clcore_files_32)
101LOCAL_SRC_FILES_32 += arch/generic.c
102
103ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64))
104LOCAL_SRC_FILES_64 := $(clcore_arm64_files)
105LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON
106else
107LOCAL_SRC_FILES_64 := $(clcore_files_64)
108LOCAL_SRC_FILES_64 += arch/generic.c
109endif
110
111include $(LOCAL_PATH)/build_bc_lib.mk
112rs_debug_runtime :=
113
114# Build an optimized version of the library for x86 platforms (all have SSE2/3).
115ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
116include $(CLEAR_VARS)
117
118LOCAL_MODULE := libclcore_x86.bc
119LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3
120LOCAL_SRC_FILES := $(clcore_x86_files)
121LOCAL_SRC_FILES_32 := $(clcore_base_files_32)
122LOCAL_SRC_FILES_64 := $(clcore_base_files_64)
123
124include $(LOCAL_PATH)/build_bc_lib.mk
125endif
126
127# Build a NEON-enabled version of the library (if possible)
128# Only build on 32-bit, because we don't need a 64-bit NEON lib
129ifeq ($(ARCH_ARM_HAVE_NEON),true)
130  include $(CLEAR_VARS)
131
132  LOCAL_32_BIT_ONLY := true
133
134  LOCAL_MODULE := libclcore_neon.bc
135  LOCAL_CFLAGS += $(clcore_cflags)
136  LOCAL_SRC_FILES := $(clcore_neon_files)
137  LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON
138
139  include $(LOCAL_PATH)/build_bc_lib.mk
140endif
141
142### Build new versions (librsrt_<ARCH>.bc) as host shared libraries.
143### These will be used with bcc_compat and the support library.
144
145# Build the ARM version of the library
146include $(CLEAR_VARS)
147
148# FIXME for 64-bit
149LOCAL_32_BIT_ONLY := true
150
151BCC_RS_TRIPLE := armv7-none-linux-gnueabi
152RS_TRIPLE_CFLAGS :=
153LOCAL_MODULE := librsrt_arm.bc
154LOCAL_IS_HOST_MODULE := true
155LOCAL_CFLAGS += $(clcore_cflags)
156LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
157include $(LOCAL_PATH)/build_bc_lib.mk
158
159# Build the MIPS version of the library
160include $(CLEAR_VARS)
161
162# FIXME for 64-bit
163LOCAL_32_BIT_ONLY := true
164
165BCC_RS_TRIPLE := armv7-none-linux-gnueabi
166RS_TRIPLE_CFLAGS :=
167LOCAL_MODULE := librsrt_mips.bc
168LOCAL_IS_HOST_MODULE := true
169LOCAL_CFLAGS += $(clcore_cflags)
170LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
171include $(LOCAL_PATH)/build_bc_lib.mk
172
173# Build the x86 version of the library
174include $(CLEAR_VARS)
175
176# FIXME for 64-bit
177LOCAL_32_BIT_ONLY := true
178
179BCC_RS_TRIPLE := armv7-none-linux-gnueabi
180RS_TRIPLE_CFLAGS := -D__i386__
181LOCAL_MODULE := librsrt_x86.bc
182LOCAL_IS_HOST_MODULE := true
183LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3
184LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_32)
185include $(LOCAL_PATH)/build_bc_lib.mk
186
187include $(CLEAR_VARS)
188
189BCC_RS_TRIPLE := aarch64-linux-android
190RS_TRIPLE_CFLAGS :=
191LOCAL_MODULE := librsrt_arm64.bc
192LOCAL_IS_HOST_MODULE := true
193LOCAL_CFLAGS += $(clcore_cflags)
194LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_64)
195include $(LOCAL_PATH)/build_bc_lib.mk
196