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