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 bc_cflags := -MD \ 20 -DRS_VERSION=$(RS_VERSION) \ 21 -std=c99 \ 22 -c \ 23 -O3 \ 24 -fno-builtin \ 25 -emit-llvm \ 26 -ccc-host-triple armv7-none-linux-gnueabi \ 27 -fsigned-char 28 29 c_sources := $(filter %.c,$(LOCAL_SRC_FILES)) 30 ll_sources := $(filter %.ll,$(LOCAL_SRC_FILES)) 31 32 c_bc_files := $(patsubst %.c,%.bc, \ 33 $(addprefix $(intermediates)/, $(c_sources))) 34 35 ll_bc_files := $(patsubst %.ll,%.bc, \ 36 $(addprefix $(intermediates)/, $(ll_sources))) 37 38 $(c_bc_files): PRIVATE_INCLUDES := \ 39 frameworks/rs/scriptc \ 40 external/clang/lib/Headers 41 42 $(c_bc_files): $(intermediates)/%.bc: $(LOCAL_PATH)/%.c $(CLANG) 43 @mkdir -p $(dir $@) 44 $(hide) $(CLANG) $(addprefix -I, $(PRIVATE_INCLUDES)) $(bc_cflags) $< -o $@ 45 46 $(ll_bc_files): $(intermediates)/%.bc: $(LOCAL_PATH)/%.ll $(LLVM_AS) 47 @mkdir -p $(dir $@) 48 $(hide) $(LLVM_AS) $< -o $@ 49 50 -include $(c_bc_files:%.bc=%.d) 51 -include $(ll_bc_files:%.bc=%.d) 52 53 $(LOCAL_BUILT_MODULE): PRIVATE_BC_FILES := $(c_bc_files) $(ll_bc_files) 54 $(LOCAL_BUILT_MODULE): $(c_bc_files) $(ll_bc_files) 55 $(LOCAL_BUILT_MODULE): $(LLVM_LINK) $(clcore_LLVM_LD) 56 $(LOCAL_BUILT_MODULE): $(LLVM_AS) 57 @mkdir -p $(dir $@) 58 $(hide) $(LLVM_LINK) $(PRIVATE_BC_FILES) -o $@ 59