Android.mk revision b370582ff4f5487cbe2bde954200e509da63be8d
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)
86LOCAL_SRC_FILES_64 += arch/generic.c
87endif
88
89include $(LOCAL_PATH)/build_bc_lib.mk
90
91# Build a debug version of the library
92include $(CLEAR_VARS)
93
94LOCAL_MODULE := libclcore_debug.bc
95rs_debug_runtime := 1
96LOCAL_CFLAGS += $(clcore_cflags)
97LOCAL_SRC_FILES := $(clcore_base_files)
98LOCAL_SRC_FILES_32 := $(clcore_files_32)
99LOCAL_SRC_FILES_32 += arch/generic.c
100
101ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64))
102LOCAL_SRC_FILES_64 := $(clcore_arm64_files)
103LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON
104else
105LOCAL_SRC_FILES_64 := $(clcore_files_64)
106endif
107
108include $(LOCAL_PATH)/build_bc_lib.mk
109rs_debug_runtime :=
110
111# Build an optimized version of the library for x86 platforms (all have SSE2/3).
112ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
113include $(CLEAR_VARS)
114
115LOCAL_MODULE := libclcore_x86.bc
116LOCAL_CFLAGS += $(clcore_cflags)
117LOCAL_SRC_FILES := $(clcore_x86_files)
118LOCAL_SRC_FILES_32 := $(clcore_base_files_32)
119LOCAL_SRC_FILES_64 := $(clcore_base_files_64)
120
121include $(LOCAL_PATH)/build_bc_lib.mk
122endif
123
124# Build a NEON-enabled version of the library (if possible)
125# Only build on 32-bit, because we don't need a 64-bit NEON lib
126ifeq ($(ARCH_ARM_HAVE_NEON),true)
127  include $(CLEAR_VARS)
128
129  LOCAL_32_BIT_ONLY := true
130
131  LOCAL_MODULE := libclcore_neon.bc
132  LOCAL_CFLAGS += $(clcore_cflags)
133  LOCAL_SRC_FILES := $(clcore_neon_files)
134  LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON
135
136  include $(LOCAL_PATH)/build_bc_lib.mk
137endif
138
139### Build new versions (librsrt_<ARCH>.bc) as host shared libraries.
140### These will be used with bcc_compat and the support library.
141
142# Build the ARM version of the library
143include $(CLEAR_VARS)
144
145# FIXME for 64-bit
146LOCAL_32_BIT_ONLY := true
147
148BCC_RS_TRIPLE := armv7-none-linux-gnueabi
149RS_TRIPLE_CFLAGS :=
150LOCAL_MODULE := librsrt_arm.bc
151LOCAL_IS_HOST_MODULE := true
152LOCAL_CFLAGS += $(clcore_cflags)
153LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
154include $(LOCAL_PATH)/build_bc_lib.mk
155
156# Build the MIPS version of the library
157include $(CLEAR_VARS)
158
159# FIXME for 64-bit
160LOCAL_32_BIT_ONLY := true
161
162BCC_RS_TRIPLE := armv7-none-linux-gnueabi
163RS_TRIPLE_CFLAGS :=
164LOCAL_MODULE := librsrt_mips.bc
165LOCAL_IS_HOST_MODULE := true
166LOCAL_CFLAGS += $(clcore_cflags)
167LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
168include $(LOCAL_PATH)/build_bc_lib.mk
169
170# Build the x86 version of the library
171include $(CLEAR_VARS)
172
173# FIXME for 64-bit
174LOCAL_32_BIT_ONLY := true
175
176BCC_RS_TRIPLE := armv7-none-linux-gnueabi
177RS_TRIPLE_CFLAGS := -D__i386__
178LOCAL_MODULE := librsrt_x86.bc
179LOCAL_IS_HOST_MODULE := true
180LOCAL_CFLAGS += $(clcore_cflags)
181LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_32)
182include $(LOCAL_PATH)/build_bc_lib.mk
183
184include $(CLEAR_VARS)
185
186BCC_RS_TRIPLE := aarch64-linux-android
187RS_TRIPLE_CFLAGS :=
188LOCAL_MODULE := librsrt_arm64.bc
189LOCAL_IS_HOST_MODULE := true
190LOCAL_CFLAGS += $(clcore_cflags)
191LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_64)
192include $(LOCAL_PATH)/build_bc_lib.mk
193