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_f16_math.c \ 26 rs_mesh.c \ 27 rs_matrix.c \ 28 rs_program.c \ 29 rs_sample.c \ 30 rs_sampler.c \ 31 rs_convert.c \ 32 rs_quaternion.c 33 34clcore_cflags := -Werror -Wall -Wextra \ 35 -Iframeworks/rs/cpu_ref -DRS_DECLARE_EXPIRED_APIS 36 37clcore_base_files_32 := \ 38 ll32/allocation.ll 39 40clcore_base_files_64 := \ 41 ll64/allocation.ll 42 43clcore_files := \ 44 $(clcore_base_files) \ 45 arch/generic.c 46 47clcore_g_files := \ 48 rs_abi_debuginfo.c \ 49 arch/generic.c 50 51clcore_files_32 := \ 52 $(clcore_base_files_32) \ 53 ll32/math.ll 54 55clcore_files_64 := \ 56 $(clcore_base_files_64) \ 57 ll64/math.ll 58 59clcore_neon_files := \ 60 $(clcore_base_files) \ 61 $(clcore_files_32) \ 62 arch/neon.ll \ 63 arch/clamp.c 64 65clcore_arm64_files := \ 66 $(clcore_files_64) \ 67 arch/asimd.ll \ 68 arch/clamp.c 69 70clcore_x86_files := \ 71 $(clcore_base_files) \ 72 arch/generic.c \ 73 arch/x86_sse2.ll \ 74 arch/x86_sse3.ll 75 76# Grab the current value for $(RS_VERSION_DEFINE) 77include frameworks/compile/slang/rs_version.mk 78 79# Build the base version of the library 80include $(CLEAR_VARS) 81 82LOCAL_MODULE := libclcore.bc 83LOCAL_CFLAGS += $(clcore_cflags) 84LOCAL_SRC_FILES := $(clcore_base_files) 85LOCAL_SRC_FILES_32 := $(clcore_files_32) 86LOCAL_SRC_FILES_32 += arch/generic.c 87 88ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 89LOCAL_SRC_FILES_64 := $(clcore_arm64_files) 90LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 91else 92LOCAL_SRC_FILES_64 := $(clcore_files_64) 93LOCAL_SRC_FILES_64 += arch/generic.c 94endif 95 96include $(LOCAL_PATH)/build_bc_lib.mk 97 98# Build a debug version of the library 99include $(CLEAR_VARS) 100 101LOCAL_MODULE := libclcore_debug.bc 102rs_debug_runtime := 1 103LOCAL_CFLAGS += $(clcore_cflags) 104LOCAL_SRC_FILES := $(clcore_base_files) 105LOCAL_SRC_FILES_32 := $(clcore_files_32) 106LOCAL_SRC_FILES_32 += arch/generic.c 107 108ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 109LOCAL_SRC_FILES_64 := $(clcore_arm64_files) 110LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 111else 112LOCAL_SRC_FILES_64 := $(clcore_files_64) 113LOCAL_SRC_FILES_64 += arch/generic.c 114endif 115 116include $(LOCAL_PATH)/build_bc_lib.mk 117rs_debug_runtime := 118 119# Build an optimized version of the library for x86 platforms (all have SSE2/3). 120ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) 121include $(CLEAR_VARS) 122 123LOCAL_MODULE := libclcore_x86.bc 124LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3 125LOCAL_SRC_FILES := $(clcore_x86_files) 126LOCAL_SRC_FILES_32 := $(clcore_base_files_32) 127LOCAL_SRC_FILES_64 := $(clcore_base_files_64) 128 129include $(LOCAL_PATH)/build_bc_lib.mk 130endif 131 132# Build a NEON-enabled version of the library 133# Only build on 32-bit, because we don't need a 64-bit NEON lib 134include $(CLEAR_VARS) 135 136LOCAL_32_BIT_ONLY := true 137 138LOCAL_MODULE := libclcore_neon.bc 139LOCAL_CFLAGS += $(clcore_cflags) 140LOCAL_SRC_FILES := $(clcore_neon_files) 141LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON 142 143include $(LOCAL_PATH)/build_bc_lib.mk 144 145# Build a version of the library with debug info 146include $(CLEAR_VARS) 147 148LOCAL_MODULE := libclcore_g.bc 149rs_g_runtime := 1 150LOCAL_CFLAGS += $(clcore_cflags) 151LOCAL_CFLAGS += -g -O0 152LOCAL_SRC_FILES := $(clcore_base_files) $(clcore_g_files) 153LOCAL_SRC_FILES_32 := $(clcore_base_files_32) 154LOCAL_SRC_FILES_64 := $(clcore_base_files_64) 155 156ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 157LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 158endif 159 160include $(LOCAL_PATH)/build_bc_lib.mk 161 162# Build a debug version of the library with debug info 163include $(CLEAR_VARS) 164 165LOCAL_MODULE := libclcore_debug_g.bc 166rs_debug_runtime := 1 167rs_g_runtime := 1 168LOCAL_CFLAGS += $(clcore_cflags) 169LOCAL_CFLAGS += -g -O0 170LOCAL_SRC_FILES := $(clcore_base_files) 171LOCAL_SRC_FILES += rs_abi_debuginfo.c 172LOCAL_SRC_FILES_32 := $(clcore_base_files_32) 173LOCAL_SRC_FILES_64 := $(clcore_base_files_64) 174 175ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 176LOCAL_SRC_FILES_64 += arch/asimd.ll arch/clamp.c 177LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 178else 179LOCAL_SRC_FILES_64 += arch/generic.c 180endif 181 182include $(LOCAL_PATH)/build_bc_lib.mk 183rs_debug_runtime := 184rs_g_runtime := 185 186### Build new versions (librsrt_<ARCH>.bc) as host shared libraries. 187### These will be used with bcc_compat and the support library. 188 189# Build the ARM version of the library 190include $(CLEAR_VARS) 191 192# FIXME for 64-bit 193LOCAL_32_BIT_ONLY := true 194 195BCC_RS_TRIPLE := renderscript32-linux-androideabi 196RS_TRIPLE_CFLAGS := 197LOCAL_MODULE := librsrt_arm.bc 198LOCAL_IS_HOST_MODULE := true 199LOCAL_CFLAGS += $(clcore_cflags) 200LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32) 201include $(LOCAL_PATH)/build_bc_lib.mk 202 203# Build the MIPS version of the library 204include $(CLEAR_VARS) 205 206# FIXME for 64-bit 207LOCAL_32_BIT_ONLY := true 208 209BCC_RS_TRIPLE := renderscript32-linux-androideabi 210RS_TRIPLE_CFLAGS := 211LOCAL_MODULE := librsrt_mips.bc 212LOCAL_IS_HOST_MODULE := true 213LOCAL_CFLAGS += $(clcore_cflags) 214LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32) 215include $(LOCAL_PATH)/build_bc_lib.mk 216 217# Build the x86 version of the library 218include $(CLEAR_VARS) 219 220# FIXME for 64-bit 221LOCAL_32_BIT_ONLY := true 222 223BCC_RS_TRIPLE := renderscript32-linux-androideabi 224RS_TRIPLE_CFLAGS := -D__i386__ 225LOCAL_MODULE := librsrt_x86.bc 226LOCAL_IS_HOST_MODULE := true 227LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3 228LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_32) 229include $(LOCAL_PATH)/build_bc_lib.mk 230 231include $(CLEAR_VARS) 232 233BCC_RS_TRIPLE := renderscript64-linux-android 234RS_TRIPLE_CFLAGS := 235LOCAL_MODULE := librsrt_arm64.bc 236LOCAL_IS_HOST_MODULE := true 237LOCAL_CFLAGS += $(clcore_cflags) 238LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_64) 239include $(LOCAL_PATH)/build_bc_lib.mk 240 241# Build the x86_64 version of the library 242include $(CLEAR_VARS) 243 244BCC_RS_TRIPLE := renderscript64-linux-android 245RS_TRIPLE_CFLAGS := -D__x86_64__ 246LOCAL_MODULE := librsrt_x86_64.bc 247LOCAL_IS_HOST_MODULE := true 248LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3 249LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_64) 250include $(LOCAL_PATH)/build_bc_lib.mk 251