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_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 84LOCAL_LICENSE_CONDITIONS := notice 85LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 86LOCAL_CFLAGS += $(clcore_cflags) 87LOCAL_SRC_FILES := $(clcore_base_files) 88LOCAL_SRC_FILES_32 := $(clcore_files_32) 89LOCAL_SRC_FILES_32 += arch/generic.c 90 91ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 92LOCAL_SRC_FILES_64 := $(clcore_arm64_files) 93LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 94else 95LOCAL_SRC_FILES_64 := $(clcore_files_64) 96LOCAL_SRC_FILES_64 += arch/generic.c 97endif 98 99include $(LOCAL_PATH)/build_bc_lib.mk 100 101# Build a debug version of the library 102include $(CLEAR_VARS) 103 104LOCAL_MODULE := libclcore_debug.bc 105LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 106LOCAL_LICENSE_CONDITIONS := notice 107LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 108rs_debug_runtime := 1 109LOCAL_CFLAGS += $(clcore_cflags) 110LOCAL_SRC_FILES := $(clcore_base_files) 111LOCAL_SRC_FILES_32 := $(clcore_files_32) 112LOCAL_SRC_FILES_32 += arch/generic.c 113 114ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 115LOCAL_SRC_FILES_64 := $(clcore_arm64_files) 116LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 117else 118LOCAL_SRC_FILES_64 := $(clcore_files_64) 119LOCAL_SRC_FILES_64 += arch/generic.c 120endif 121 122include $(LOCAL_PATH)/build_bc_lib.mk 123rs_debug_runtime := 124 125# Build an optimized version of the library for x86 platforms (all have SSE2/3). 126ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) 127include $(CLEAR_VARS) 128 129LOCAL_MODULE := libclcore_x86.bc 130LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 131LOCAL_LICENSE_CONDITIONS := notice 132LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 133LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3 134LOCAL_SRC_FILES := $(clcore_x86_files) 135LOCAL_SRC_FILES_32 := $(clcore_base_files_32) 136LOCAL_SRC_FILES_64 := $(clcore_base_files_64) 137 138include $(LOCAL_PATH)/build_bc_lib.mk 139endif 140 141# Build a NEON-enabled version of the library 142# Only build on 32-bit, because we don't need a 64-bit NEON lib 143include $(CLEAR_VARS) 144 145LOCAL_32_BIT_ONLY := true 146 147LOCAL_MODULE := libclcore_neon.bc 148LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 149LOCAL_LICENSE_CONDITIONS := notice 150LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 151LOCAL_CFLAGS += $(clcore_cflags) 152LOCAL_SRC_FILES := $(clcore_neon_files) 153LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON 154 155include $(LOCAL_PATH)/build_bc_lib.mk 156 157# Build a version of the library with debug info 158include $(CLEAR_VARS) 159 160LOCAL_MODULE := libclcore_g.bc 161LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 162LOCAL_LICENSE_CONDITIONS := notice 163LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 164rs_g_runtime := 1 165LOCAL_CFLAGS += $(clcore_cflags) 166LOCAL_CFLAGS += -g -O0 167LOCAL_SRC_FILES := $(clcore_base_files) $(clcore_g_files) 168LOCAL_SRC_FILES_32 := $(clcore_base_files_32) 169LOCAL_SRC_FILES_64 := $(clcore_base_files_64) 170 171ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 172LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 173endif 174 175include $(LOCAL_PATH)/build_bc_lib.mk 176 177# Build a debug version of the library with debug info 178include $(CLEAR_VARS) 179 180LOCAL_MODULE := libclcore_debug_g.bc 181LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 182LOCAL_LICENSE_CONDITIONS := notice 183LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 184rs_debug_runtime := 1 185rs_g_runtime := 1 186LOCAL_CFLAGS += $(clcore_cflags) 187LOCAL_CFLAGS += -g -O0 188LOCAL_SRC_FILES := $(clcore_base_files) 189LOCAL_SRC_FILES += rs_abi_debuginfo.c 190LOCAL_SRC_FILES_32 := $(clcore_base_files_32) 191LOCAL_SRC_FILES_64 := $(clcore_base_files_64) 192 193ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 194LOCAL_SRC_FILES_64 += arch/asimd.ll arch/clamp.c 195LOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 196else 197LOCAL_SRC_FILES_64 += arch/generic.c 198endif 199 200include $(LOCAL_PATH)/build_bc_lib.mk 201rs_debug_runtime := 202rs_g_runtime := 203 204### Build new versions (librsrt_<ARCH>.bc) as host shared libraries. 205### These will be used with bcc_compat and the support library. 206 207# Build the ARM version of the library 208include $(CLEAR_VARS) 209 210# FIXME for 64-bit 211LOCAL_32_BIT_ONLY := true 212 213BCC_RS_TRIPLE := renderscript32-linux-androideabi 214RS_TRIPLE_CFLAGS := 215LOCAL_MODULE := librsrt_arm.bc 216LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 217LOCAL_LICENSE_CONDITIONS := notice 218LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 219LOCAL_IS_HOST_MODULE := true 220LOCAL_CFLAGS += $(clcore_cflags) 221LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32) 222include $(LOCAL_PATH)/build_bc_lib.mk 223 224# Build the MIPS version of the library 225include $(CLEAR_VARS) 226 227# FIXME for 64-bit 228LOCAL_32_BIT_ONLY := true 229 230BCC_RS_TRIPLE := renderscript32-linux-androideabi 231RS_TRIPLE_CFLAGS := 232LOCAL_MODULE := librsrt_mips.bc 233LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 234LOCAL_LICENSE_CONDITIONS := notice 235LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 236LOCAL_IS_HOST_MODULE := true 237LOCAL_CFLAGS += $(clcore_cflags) 238LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32) 239include $(LOCAL_PATH)/build_bc_lib.mk 240 241# Build the x86 version of the library 242include $(CLEAR_VARS) 243 244# FIXME for 64-bit 245LOCAL_32_BIT_ONLY := true 246 247BCC_RS_TRIPLE := renderscript32-linux-androideabi 248RS_TRIPLE_CFLAGS := -D__i386__ 249LOCAL_MODULE := librsrt_x86.bc 250LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 251LOCAL_LICENSE_CONDITIONS := notice 252LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 253LOCAL_IS_HOST_MODULE := true 254LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3 255LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_32) 256include $(LOCAL_PATH)/build_bc_lib.mk 257 258include $(CLEAR_VARS) 259 260BCC_RS_TRIPLE := renderscript64-linux-android 261RS_TRIPLE_CFLAGS := 262LOCAL_MODULE := librsrt_arm64.bc 263LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 264LOCAL_LICENSE_CONDITIONS := notice 265LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 266LOCAL_IS_HOST_MODULE := true 267LOCAL_CFLAGS += $(clcore_cflags) 268LOCAL_SRC_FILES := $(clcore_files) $(clcore_files_64) 269include $(LOCAL_PATH)/build_bc_lib.mk 270 271# Build the x86_64 version of the library 272include $(CLEAR_VARS) 273 274BCC_RS_TRIPLE := renderscript64-linux-android 275RS_TRIPLE_CFLAGS := -D__x86_64__ 276LOCAL_MODULE := librsrt_x86_64.bc 277LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 278LOCAL_LICENSE_CONDITIONS := notice 279LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 280LOCAL_IS_HOST_MODULE := true 281LOCAL_CFLAGS += $(clcore_cflags) -DARCH_X86_HAVE_SSSE3 282LOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_64) 283include $(LOCAL_PATH)/build_bc_lib.mk 284