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