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