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