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