build_bc_lib.mk revision c3cfa12028dc35494a03b0ffd802b800ed9981de
11cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# 21cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# Copyright (C) 2012 The Android Open Source Project 31cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# 41cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# Licensed under the Apache License, Version 2.0 (the "License"); 51cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# you may not use this file except in compliance with the License. 61cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# You may obtain a copy of the License at 71cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# 81cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# http://www.apache.org/licenses/LICENSE-2.0 91cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# 101cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# Unless required by applicable law or agreed to in writing, software 111cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# distributed under the License is distributed on an "AS IS" BASIS, 121cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 131cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# See the License for the specific language governing permissions and 141cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# limitations under the License. 151cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# 161cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato 171cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# Set these values always by default 181cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe OnoratoLOCAL_MODULE_TAGS := optional 191cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe OnoratoLOCAL_MODULE_CLASS := SHARED_LIBRARIES 201cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato 211cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratoinclude $(BUILD_SYSTEM)/base_rules.mk 221cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato 23b13b9bdad2baf6ad1ec2e56b6b7598fa20f55fc4Mathias AgopianBCC_STRIP_ATTR := $(BUILD_OUT_EXECUTABLES)/bcc_strip_attr$(BUILD_EXECUTABLE_SUFFIX) 241cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato 251cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratobc_clang_cc1_cflags := 261cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratoifeq ($(BCC_RS_TRIPLE),armv7-none-linux-gnueabi) 271cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# We need to pass the +long64 flag to the underlying version of Clang, since 284528186e0d65fc68ef0dd1941aa2ac8aefcd55a3Christopher Tate# we are generating a library for use with Renderscript (64-bit long type, 291cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato# not 32-bit). 301cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratobc_clang_cc1_cflags += -target-feature +long64 311cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratoendif 3258b8b24256bdc2b613b7fda9151845ed9898a4c7Ashok Bhatbc_translated_clang_cc1_cflags := $(addprefix -Xclang , $(bc_clang_cc1_cflags)) 331cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato 341cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratobc_cflags := -MD \ 35a3804cf77f0edd93f6247a055cdafb856b117eecElliott Hughes -DRS_VERSION=$(RS_VERSION) \ 361cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato -std=c99 \ 3758b8b24256bdc2b613b7fda9151845ed9898a4c7Ashok Bhat -c \ 381cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato -O3 \ 391cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato -fno-builtin \ 4058b8b24256bdc2b613b7fda9151845ed9898a4c7Ashok Bhat -emit-llvm \ 411cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato -target $(BCC_RS_TRIPLE) \ 421cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato -fsigned-char \ 431cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato $(LOCAL_CFLAGS) \ 4458b8b24256bdc2b613b7fda9151845ed9898a4c7Ashok Bhat $(bc_translated_clang_cc1_cflags) 451cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato 461cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratoifeq ($(rs_debug_runtime),1) 471cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato bc_cflags += -DRS_DEBUG_RUNTIME 481cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratoendif 491cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorators_debug_runtime:= 5058b8b24256bdc2b613b7fda9151845ed9898a4c7Ashok Bhat 511cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratoc_sources := $(filter %.c,$(LOCAL_SRC_FILES)) 521cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratoll_sources := $(filter %.ll,$(LOCAL_SRC_FILES)) 535f15d151b5101fadfe6cba1e8f4aa6367e8c603eJoe Onorato 541cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratoc_bc_files := $(patsubst %.c,%.bc, \ 551cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato $(addprefix $(intermediates)/, $(c_sources))) 562fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate 571cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onoratoll_bc_files := $(patsubst %.ll,%.bc, \ 585f15d151b5101fadfe6cba1e8f4aa6367e8c603eJoe Onorato $(addprefix $(intermediates)/, $(ll_sources))) 595f15d151b5101fadfe6cba1e8f4aa6367e8c603eJoe Onorato 602fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate$(c_bc_files): PRIVATE_INCLUDES := \ 612fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate frameworks/rs/scriptc \ 622fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate external/clang/lib/Headers 632fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate$(c_bc_files): PRIVATE_CFLAGS := $(bc_cflags) 642fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate 652fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate$(c_bc_files): $(intermediates)/%.bc: $(LOCAL_PATH)/%.c $(CLANG) 662fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate @mkdir -p $(dir $@) 672fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate $(hide) $(CLANG) $(addprefix -I, $(PRIVATE_INCLUDES)) $(PRIVATE_CFLAGS) $< -o $@ 682fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate 692fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate$(ll_bc_files): $(intermediates)/%.bc: $(LOCAL_PATH)/%.ll $(LLVM_AS) 702fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate @mkdir -p $(dir $@) 712fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate $(hide) $(LLVM_AS) $< -o $@ 722fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate 732fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate-include $(c_bc_files:%.bc=%.d) 742fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate-include $(ll_bc_files:%.bc=%.d) 751cf587496fcb1d652bab9fc6792fb106b6fefaa4Joe Onorato 762fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate$(LOCAL_BUILT_MODULE): PRIVATE_BC_FILES := $(c_bc_files) $(ll_bc_files) 772fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate$(LOCAL_BUILT_MODULE): $(c_bc_files) $(ll_bc_files) 782fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate$(LOCAL_BUILT_MODULE): $(LLVM_LINK) $(clcore_LLVM_LD) 792fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate$(LOCAL_BUILT_MODULE): $(LLVM_AS) $(BCC_STRIP_ATTR) 802fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate @mkdir -p $(dir $@) 812fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate $(hide) $(LLVM_LINK) $(PRIVATE_BC_FILES) -o $@.unstripped 822fdd428e0f18384160f7c38ce3a2cd9ba7e7b2c2Christopher Tate $(hide) $(BCC_STRIP_ATTR) -o $@ $@.unstripped 835baa3a62a97544669fba6d65a11c07f252e654ddSteve Block