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