1 # 2 # Copyright (C) 2012 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 include $(BUILD_SYSTEM)/base_rules.mk 18 19 # We need to pass the +long64 flag to the underlying version of Clang, since 20 # we are generating a library for use with Renderscript (64-bit long type, 21 # not 32-bit). 22 bc_clang_cc1_cflags := -target-feature +long64 23 bc_translated_clang_cc1_cflags := $(addprefix -Xclang , $(bc_clang_cc1_cflags)) 24 25 bc_cflags := -MD \ 26 -DRS_VERSION=$(RS_VERSION) \ 27 -std=c99 \ 28 -c \ 29 -O3 \ 30 -fno-builtin \ 31 -emit-llvm \ 32 -ccc-host-triple armv7-none-linux-gnueabi \ 33 -fsigned-char \ 34 $(bc_translated_clang_cc1_cflags) 35 36 c_sources := $(filter %.c,$(LOCAL_SRC_FILES)) 37 ll_sources := $(filter %.ll,$(LOCAL_SRC_FILES)) 38 39 c_bc_files := $(patsubst %.c,%.bc, \ 40 $(addprefix $(intermediates)/, $(c_sources))) 41 42 ll_bc_files := $(patsubst %.ll,%.bc, \ 43 $(addprefix $(intermediates)/, $(ll_sources))) 44 45 $(c_bc_files): PRIVATE_INCLUDES := \ 46 frameworks/rs/scriptc \ 47 external/clang/lib/Headers 48 49 $(c_bc_files): $(intermediates)/%.bc: $(LOCAL_PATH)/%.c $(CLANG) 50 @mkdir -p $(dir $@) 51 $(hide) $(CLANG) $(addprefix -I, $(PRIVATE_INCLUDES)) $(bc_cflags) $< -o $@ 52 53 $(ll_bc_files): $(intermediates)/%.bc: $(LOCAL_PATH)/%.ll $(LLVM_AS) 54 @mkdir -p $(dir $@) 55 $(hide) $(LLVM_AS) $< -o $@ 56 57 -include $(c_bc_files:%.bc=%.d) 58 -include $(ll_bc_files:%.bc=%.d) 59 60 $(LOCAL_BUILT_MODULE): PRIVATE_BC_FILES := $(c_bc_files) $(ll_bc_files) 61 $(LOCAL_BUILT_MODULE): $(c_bc_files) $(ll_bc_files) 62 $(LOCAL_BUILT_MODULE): $(LLVM_LINK) $(clcore_LLVM_LD) 63 $(LOCAL_BUILT_MODULE): $(LLVM_AS) 64 @mkdir -p $(dir $@) 65 $(hide) $(LLVM_LINK) $(PRIVATE_BC_FILES) -o $@ 66