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