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