Android.mk revision 1ed5ef9b253850a199eecff6b7941e57c408e509
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    convert.ll \
31    allocation.ll \
32    rsClamp.ll
33
34clcore_files := \
35    $(clcore_base_files) \
36    math.ll \
37    arch/generic.c \
38    arch/sqrt.c \
39    arch/dot_length.c
40
41clcore_neon_files := \
42    $(clcore_base_files) \
43    math.ll \
44    arch/neon.ll \
45    arch/sqrt.c \
46    arch/dot_length.c \
47    arch/clamp.c
48
49ifeq ($(ARCH_X86_HAVE_SSE2), true)
50    clcore_x86_files := \
51    $(clcore_base_files) \
52    arch/x86_generic.c \
53    arch/x86_clamp.ll \
54    arch/x86_math.ll
55
56    ifeq ($(ARCH_X86_HAVE_SSE3), true)
57        clcore_x86_files += arch/x86_dot_length.ll
58    else
59        # FIXME: without SSE3, it is still able to get better code through PSHUFD. But,
60        # so far, there is no such device with SSE2 only.
61        clcore_x86_files += arch/dot_length.c
62    endif
63endif
64
65ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
66  RS_VERSION := $(PLATFORM_SDK_VERSION)
67else
68  # Increment by 1 whenever this is not a final release build, since we want to
69  # be able to see the RS version number change during development.
70  # See build/core/version_defaults.mk for more information about this.
71  RS_VERSION := "(1 + $(PLATFORM_SDK_VERSION))"
72endif
73
74# Build the base version of the library
75include $(CLEAR_VARS)
76LOCAL_MODULE := libclcore.bc
77LOCAL_MODULE_TAGS := optional
78LOCAL_MODULE_CLASS := SHARED_LIBRARIES
79LOCAL_SRC_FILES := $(clcore_files)
80
81include $(LOCAL_PATH)/build_bc_lib.mk
82
83# Build a debug version of the library
84include $(CLEAR_VARS)
85LOCAL_MODULE := libclcore_debug.bc
86LOCAL_MODULE_TAGS := optional
87LOCAL_MODULE_CLASS := SHARED_LIBRARIES
88rs_debug_runtime := 1
89LOCAL_SRC_FILES := $(clcore_files)
90
91include $(LOCAL_PATH)/build_bc_lib.mk
92
93# Build an optimized version of the library if the device is SSE2- or above
94# capable.
95ifeq ($(ARCH_X86_HAVE_SSE2),true)
96include $(CLEAR_VARS)
97LOCAL_MODULE := libclcore_x86.bc
98LOCAL_MODULE_TAGS := optional
99LOCAL_MODULE_CLASS := SHARED_LIBRARIES
100LOCAL_SRC_FILES := $(clcore_x86_files)
101
102include $(LOCAL_PATH)/build_bc_lib.mk
103endif
104
105# Build a NEON-enabled version of the library (if possible)
106ifeq ($(ARCH_ARM_HAVE_NEON),true)
107  include $(CLEAR_VARS)
108  LOCAL_MODULE := libclcore_neon.bc
109  LOCAL_MODULE_TAGS := optional
110  LOCAL_MODULE_CLASS := SHARED_LIBRARIES
111  LOCAL_SRC_FILES := $(clcore_neon_files)
112  LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON
113
114  include $(LOCAL_PATH)/build_bc_lib.mk
115endif
116