15a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# 25a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# Copyright (C) 2013 The Android Open Source Project 35a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# 45a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# Licensed under the Apache License, Version 2.0 (the "License"); 55a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# you may not use this file except in compliance with the License. 65a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# You may obtain a copy of the License at 75a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# 85a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# http://www.apache.org/licenses/LICENSE-2.0 95a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# 105a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# Unless required by applicable law or agreed to in writing, software 115a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# distributed under the License is distributed on an "AS IS" BASIS, 125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 135a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# See the License for the specific language governing permissions and 145a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# limitations under the License. 155a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# 165a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 175a47020542c52af3e879c1cd67674ca979ff0a18Stephen HinesLOCAL_PATH := $(call my-dir) 185a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# C/LLVM-IR source files for the library 205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesclcore_base_files := \ 215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_allocation.c \ 225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_cl.c \ 235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_core.c \ 245a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_element.c \ 255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_mesh.c \ 265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_matrix.c \ 275a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_program.c \ 285a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_sample.c \ 295a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines rs_sampler.c \ 30be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray rs_convert.c 31be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray 32496d0f8f3ce1b12d7d76bae2ecf6fe15a8b3811fJean-Luc Brouilletclcore_cflags := -Iframeworks/rs/cpu_ref -DRS_DECLARE_EXPIRED_APIS 33dced5c96bc53c45a1aac782ea9bd738b0d50fd09David Gross 34be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murrayclcore_base_files_32 := \ 35be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray ll32/allocation.ll 36be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray 37be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murrayclcore_base_files_64 := \ 38be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray ll64/allocation.ll 395a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 405a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesclcore_files := \ 415a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines $(clcore_base_files) \ 42146e138f5c6eb4980ee6d85d33b951b87b6e8efeStephen Hines arch/generic.c 435a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 44be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murrayclcore_files_32 := \ 45be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray $(clcore_base_files_32) \ 46be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray ll32/math.ll 47be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray 48be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murrayclcore_files_64 := \ 49be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray $(clcore_base_files_64) \ 50be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray ll64/math.ll 51be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray 525a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesclcore_neon_files := \ 535a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines $(clcore_base_files) \ 54be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray $(clcore_files_32) \ 555a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines arch/neon.ll \ 565a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines arch/clamp.c 575a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 58974467797f45a7e4ac191eb158edb78492a48e56Tim Murrayclcore_arm64_files := \ 59974467797f45a7e4ac191eb158edb78492a48e56Tim Murray $(clcore_files_64) \ 60974467797f45a7e4ac191eb158edb78492a48e56Tim Murray arch/asimd.ll \ 61974467797f45a7e4ac191eb158edb78492a48e56Tim Murray arch/clamp.c 62974467797f45a7e4ac191eb158edb78492a48e56Tim Murray 63c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hinesclcore_x86_files := \ 645a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines $(clcore_base_files) \ 65146e138f5c6eb4980ee6d85d33b951b87b6e8efeStephen Hines arch/generic.c \ 664da42506a08ed7fdb61615b3524f111df939fc6eStephen Hines arch/x86_sse2.ll \ 674da42506a08ed7fdb61615b3524f111df939fc6eStephen Hines arch/x86_sse3.ll 685a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 69c17fa065b6fee1d2176bd057de98b93d723b59e5Stephen Hines# Grab the current value for $(RS_VERSION_DEFINE) 70c17fa065b6fee1d2176bd057de98b93d723b59e5Stephen Hinesinclude frameworks/compile/slang/rs_version.mk 715a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 725a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# Build the base version of the library 735a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesinclude $(CLEAR_VARS) 74e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 755a47020542c52af3e879c1cd67674ca979ff0a18Stephen HinesLOCAL_MODULE := libclcore.bc 76496d0f8f3ce1b12d7d76bae2ecf6fe15a8b3811fJean-Luc BrouilletLOCAL_CFLAGS += $(clcore_cflags) 77bc1136f44f7816be807cfaf75a9e1e7983eace38Tim MurrayLOCAL_SRC_FILES := $(clcore_base_files) 78be46aa62ed595c517dbf236dfbb3d22e1c194907Tim MurrayLOCAL_SRC_FILES_32 := $(clcore_files_32) 79bc1136f44f7816be807cfaf75a9e1e7983eace38Tim MurrayLOCAL_SRC_FILES_32 += arch/generic.c 80974467797f45a7e4ac191eb158edb78492a48e56Tim Murray 81974467797f45a7e4ac191eb158edb78492a48e56Tim Murrayifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 82974467797f45a7e4ac191eb158edb78492a48e56Tim MurrayLOCAL_SRC_FILES_64 := $(clcore_arm64_files) 83bc1136f44f7816be807cfaf75a9e1e7983eace38Tim MurrayLOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 84974467797f45a7e4ac191eb158edb78492a48e56Tim Murrayelse 85be46aa62ed595c517dbf236dfbb3d22e1c194907Tim MurrayLOCAL_SRC_FILES_64 := $(clcore_files_64) 86974467797f45a7e4ac191eb158edb78492a48e56Tim Murrayendif 875a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 885a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesinclude $(LOCAL_PATH)/build_bc_lib.mk 895a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 905a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# Build a debug version of the library 915a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesinclude $(CLEAR_VARS) 92e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 935a47020542c52af3e879c1cd67674ca979ff0a18Stephen HinesLOCAL_MODULE := libclcore_debug.bc 945a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesrs_debug_runtime := 1 95496d0f8f3ce1b12d7d76bae2ecf6fe15a8b3811fJean-Luc BrouilletLOCAL_CFLAGS += $(clcore_cflags) 96bc1136f44f7816be807cfaf75a9e1e7983eace38Tim MurrayLOCAL_SRC_FILES := $(clcore_base_files) 97be46aa62ed595c517dbf236dfbb3d22e1c194907Tim MurrayLOCAL_SRC_FILES_32 := $(clcore_files_32) 98bc1136f44f7816be807cfaf75a9e1e7983eace38Tim MurrayLOCAL_SRC_FILES_32 += arch/generic.c 99bc1136f44f7816be807cfaf75a9e1e7983eace38Tim Murray 100bc1136f44f7816be807cfaf75a9e1e7983eace38Tim Murrayifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm64)) 101bc1136f44f7816be807cfaf75a9e1e7983eace38Tim MurrayLOCAL_SRC_FILES_64 := $(clcore_arm64_files) 102bc1136f44f7816be807cfaf75a9e1e7983eace38Tim MurrayLOCAL_CFLAGS_64 += -DARCH_ARM64_HAVE_NEON 103bc1136f44f7816be807cfaf75a9e1e7983eace38Tim Murrayelse 104be46aa62ed595c517dbf236dfbb3d22e1c194907Tim MurrayLOCAL_SRC_FILES_64 := $(clcore_files_64) 105bc1136f44f7816be807cfaf75a9e1e7983eace38Tim Murrayendif 1065a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 1075a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesinclude $(LOCAL_PATH)/build_bc_lib.mk 10816cfba29a921308efad37855c487d4278de5f571Tim Murrayrs_debug_runtime := 1095a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 1104da42506a08ed7fdb61615b3524f111df939fc6eStephen Hines# Build an optimized version of the library for x86 platforms (all have SSE2/3). 1114da42506a08ed7fdb61615b3524f111df939fc6eStephen Hinesifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) 1125a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesinclude $(CLEAR_VARS) 113e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 1145a47020542c52af3e879c1cd67674ca979ff0a18Stephen HinesLOCAL_MODULE := libclcore_x86.bc 115496d0f8f3ce1b12d7d76bae2ecf6fe15a8b3811fJean-Luc BrouilletLOCAL_CFLAGS += $(clcore_cflags) 1165a47020542c52af3e879c1cd67674ca979ff0a18Stephen HinesLOCAL_SRC_FILES := $(clcore_x86_files) 117be46aa62ed595c517dbf236dfbb3d22e1c194907Tim MurrayLOCAL_SRC_FILES_32 := $(clcore_base_files_32) 118be46aa62ed595c517dbf236dfbb3d22e1c194907Tim MurrayLOCAL_SRC_FILES_64 := $(clcore_base_files_64) 1195a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 1205a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesinclude $(LOCAL_PATH)/build_bc_lib.mk 1215a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesendif 1225a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 1235a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines# Build a NEON-enabled version of the library (if possible) 124be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray# Only build on 32-bit, because we don't need a 64-bit NEON lib 1255a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesifeq ($(ARCH_ARM_HAVE_NEON),true) 1265a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines include $(CLEAR_VARS) 127e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 128be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray LOCAL_32_BIT_ONLY := true 129be46aa62ed595c517dbf236dfbb3d22e1c194907Tim Murray 1305a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines LOCAL_MODULE := libclcore_neon.bc 131496d0f8f3ce1b12d7d76bae2ecf6fe15a8b3811fJean-Luc Brouillet LOCAL_CFLAGS += $(clcore_cflags) 1325a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines LOCAL_SRC_FILES := $(clcore_neon_files) 1335a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines LOCAL_CFLAGS += -DARCH_ARM_HAVE_NEON 1345a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines 1355a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hines include $(LOCAL_PATH)/build_bc_lib.mk 1365a47020542c52af3e879c1cd67674ca979ff0a18Stephen Hinesendif 137c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hines 138c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hines### Build new versions (librsrt_<ARCH>.bc) as host shared libraries. 139c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hines### These will be used with bcc_compat and the support library. 140c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hines 141c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hines# Build the ARM version of the library 142c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hinesinclude $(CLEAR_VARS) 143e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 144e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray# FIXME for 64-bit 145e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim MurrayLOCAL_32_BIT_ONLY := true 146e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 147c3cfa12028dc35494a03b0ffd802b800ed9981deStephen HinesBCC_RS_TRIPLE := armv7-none-linux-gnueabi 1488641b7ce4e963122603d7498d860d5679437a206Stephen HinesRS_TRIPLE_CFLAGS := 149c3cfa12028dc35494a03b0ffd802b800ed9981deStephen HinesLOCAL_MODULE := librsrt_arm.bc 150c3cfa12028dc35494a03b0ffd802b800ed9981deStephen HinesLOCAL_IS_HOST_MODULE := true 151496d0f8f3ce1b12d7d76bae2ecf6fe15a8b3811fJean-Luc BrouilletLOCAL_CFLAGS += $(clcore_cflags) 1521d279546c73b667c5afd855554c0120503e48f9fTim MurrayLOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32) 153c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hinesinclude $(LOCAL_PATH)/build_bc_lib.mk 154c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hines 155c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hines# Build the MIPS version of the library 156c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hinesinclude $(CLEAR_VARS) 157e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 158e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray# FIXME for 64-bit 159e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim MurrayLOCAL_32_BIT_ONLY := true 160e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 1618641b7ce4e963122603d7498d860d5679437a206Stephen HinesBCC_RS_TRIPLE := armv7-none-linux-gnueabi 1628641b7ce4e963122603d7498d860d5679437a206Stephen HinesRS_TRIPLE_CFLAGS := 163c3cfa12028dc35494a03b0ffd802b800ed9981deStephen HinesLOCAL_MODULE := librsrt_mips.bc 164c3cfa12028dc35494a03b0ffd802b800ed9981deStephen HinesLOCAL_IS_HOST_MODULE := true 165496d0f8f3ce1b12d7d76bae2ecf6fe15a8b3811fJean-Luc BrouilletLOCAL_CFLAGS += $(clcore_cflags) 1661d279546c73b667c5afd855554c0120503e48f9fTim MurrayLOCAL_SRC_FILES := $(clcore_files) $(clcore_files_32) 167c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hinesinclude $(LOCAL_PATH)/build_bc_lib.mk 168c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hines 169c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hines# Build the x86 version of the library 170c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hinesinclude $(CLEAR_VARS) 171e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 172e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray# FIXME for 64-bit 173e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim MurrayLOCAL_32_BIT_ONLY := true 174e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 1758641b7ce4e963122603d7498d860d5679437a206Stephen HinesBCC_RS_TRIPLE := armv7-none-linux-gnueabi 1768641b7ce4e963122603d7498d860d5679437a206Stephen HinesRS_TRIPLE_CFLAGS := -D__i386__ 177c3cfa12028dc35494a03b0ffd802b800ed9981deStephen HinesLOCAL_MODULE := librsrt_x86.bc 178c3cfa12028dc35494a03b0ffd802b800ed9981deStephen HinesLOCAL_IS_HOST_MODULE := true 179496d0f8f3ce1b12d7d76bae2ecf6fe15a8b3811fJean-Luc BrouilletLOCAL_CFLAGS += $(clcore_cflags) 1801d279546c73b667c5afd855554c0120503e48f9fTim MurrayLOCAL_SRC_FILES := $(clcore_x86_files) $(clcore_base_files_32) 181c3cfa12028dc35494a03b0ffd802b800ed9981deStephen Hinesinclude $(LOCAL_PATH)/build_bc_lib.mk 182e195a3f57ace3b66d313a6ee88c6e93d5c9d87f4Tim Murray 1838c24cd62187fb963cb1b76d2e91ae8c247c7f6fbTim Murrayinclude $(CLEAR_VARS) 1848c24cd62187fb963cb1b76d2e91ae8c247c7f6fbTim Murray 185bdceed58826b6b4191a7f483764347895d0172d7Tim MurrayBCC_RS_TRIPLE := aarch64-linux-android 1868641b7ce4e963122603d7498d860d5679437a206Stephen HinesRS_TRIPLE_CFLAGS := 1878c24cd62187fb963cb1b76d2e91ae8c247c7f6fbTim MurrayLOCAL_MODULE := librsrt_arm64.bc 1888c24cd62187fb963cb1b76d2e91ae8c247c7f6fbTim MurrayLOCAL_IS_HOST_MODULE := true 189496d0f8f3ce1b12d7d76bae2ecf6fe15a8b3811fJean-Luc BrouilletLOCAL_CFLAGS += $(clcore_cflags) 1901d279546c73b667c5afd855554c0120503e48f9fTim MurrayLOCAL_SRC_FILES := $(clcore_files) $(clcore_files_64) 1918c24cd62187fb963cb1b76d2e91ae8c247c7f6fbTim Murrayinclude $(LOCAL_PATH)/build_bc_lib.mk 192