summaryrefslogtreecommitdiff
path: root/driver/runtime/Android.mk
blob: a249bea02fa8fa91225ab5986438c80b1619421a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#
# Copyright (C) 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

LOCAL_PATH := $(call my-dir)

# C/LLVM-IR source files for the library
clcore_base_files := \
    rs_allocation.c \
    rs_cl.c \
    rs_core.c \
    rs_element.c \
    rs_mesh.c \
    rs_matrix.c \
    rs_program.c \
    rs_sample.c \
    rs_sampler.c \
    rs_convert.c

clcore_includes := -Iframeworks/rs/cpu_ref

clcore_base_files_32 := \
    ll32/allocation.ll

clcore_base_files_64 := \
    ll64/allocation.ll

clcore_files := \
    $(clcore_base_files) \
    arch/generic.c

clcore_files_32 := \
    $(clcore_base_files_32) \
    ll32/math.ll

clcore_files_64 := \
    $(clcore_base_files_64) \
    ll64/math.ll

clcore_neon_files := \
    $(clcore_base_files) \
    $(clcore_files_32) \
    arch/neon.ll \
    arch/clamp.c

clcore_arm64_files := \
    $(clcore_files_64) \
    arch/asimd.ll \
    arch/clamp.c

clcore_x86_files := \
    $(clcore_base_files) \
    arch/generic.c \
    arch/x86_sse2.ll \
    arch/x86_sse3.ll

# Grab the current value for $(RS_VERSION_DEFINE)
include frameworks/compile/slang/rs_version.mk

# Build the base version of the library
include $(CLEAR_VARS)

LOCAL_MODULE := libclcore.bc
LOCAL_CFLAGS += $(clcore_includes)
LOCAL_SRC_FILES := $(clcore_base_files)
LOCAL_SRC_FILES_32 := $(clcore_files_32)
LOCAL_SRC_FILES_32 += arch/generic.c

ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64))
LOCAL_SRC_FILES_64 := $(clcore_arm64_files)
LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON
else
LOCAL_SRC_FILES_64 := $(clcore_files_64)
endif

include $(LOCAL_PATH)/build_bc_lib.mk

# Build a debug version of the library
include $(CLEAR_VARS)

LOCAL_MODULE := libclcore_debug.bc
rs_debug_runtime := 1
LOCAL_CFLAGS += $(clcore_includes)
LOCAL_SRC_FILES := $(clcore_base_files)
LOCAL_SRC_FILES_32 := $(clcore_files_32)
LOCAL_SRC_FILES_32 += arch/generic.c

ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64))
LOCAL_SRC_FILES_64 := $(clcore_arm64_files)
LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON
else
LOCAL_SRC_FILES_64 := $(clcore_files_64)
endif

include $(LOCAL_PATH)/build_bc_lib.mk
rs_debug_runtime :=

# Build an optimized version of the library for x86 platforms (all have SSE2/3).
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
include $(CLEAR_VARS)

LOCAL_MODULE := libclcore_x86.bc
LOCAL_CFLAGS += $(clcore_includes)
LOCAL_SRC_FILES := $(clcore_x86_files)
LOCAL_SRC_FILES_32 := $(clcore_base_files_32)
LOCAL_SRC_FILES_64 := $(clcore_base_files_64)

include $(LOCAL_PATH)/build_bc_lib.mk
endif

# Build a NEON-enabled version of the library (if possible)
# Only build on 32-bit, because we don't need a 64-bit NEON lib
ifeq ($(ARCH_ARM_HAVE_NEON),true)
  include $(CLEAR_VARS)

  LOCAL_32_BIT_ONLY := true

  LOCAL_MODULE := libclcore_neon.bc
  LOCAL_CFLAGS += $(clcore_includes)
  LOCAL_SRC_FILES := $(clcore_neon_files)
  LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON

  include $(LOCAL_PATH)/build_bc_lib.mk
endif

### Build new versions (librsrt_<ARCH>.bc) as host shared libraries.
### These will be used with bcc_compat and the support library.

# Build the ARM version of the library
include $(CLEAR_VARS)

# FIXME for 64-bit
LOCAL_32_BIT_ONLY := true

BCC_RS_TRIPLE := armv7-none-linux-gnueabi
RS_TRIPLE_CFLAGS :=
LOCAL_MODULE := librsrt_arm.bc
LOCAL_IS_HOST_MODULE := true
LOCAL_CFLAGS += $(clcore_includes)
LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
include $(LOCAL_PATH)/build_bc_lib.mk

# Build the MIPS version of the library
include $(CLEAR_VARS)

# FIXME for 64-bit
LOCAL_32_BIT_ONLY := true

BCC_RS_TRIPLE := armv7-none-linux-gnueabi
RS_TRIPLE_CFLAGS :=
LOCAL_MODULE := librsrt_mips.bc
LOCAL_IS_HOST_MODULE := true
LOCAL_CFLAGS += $(clcore_includes)
LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32)
include $(LOCAL_PATH)/build_bc_lib.mk

# Build the x86 version of the library
include $(CLEAR_VARS)

# FIXME for 64-bit
LOCAL_32_BIT_ONLY := true

BCC_RS_TRIPLE := armv7-none-linux-gnueabi
RS_TRIPLE_CFLAGS := -D__i386__
LOCAL_MODULE := librsrt_x86.bc
LOCAL_IS_HOST_MODULE := true
LOCAL_CFLAGS += $(clcore_includes)
LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_32)
include $(LOCAL_PATH)/build_bc_lib.mk

include $(CLEAR_VARS)

BCC_RS_TRIPLE := aarch64-linux-android
RS_TRIPLE_CFLAGS :=
LOCAL_MODULE := librsrt_arm64.bc
LOCAL_IS_HOST_MODULE := true
LOCAL_CFLAGS += $(clcore_includes)
LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_64)
include $(LOCAL_PATH)/build_bc_lib.mk