1 # Copyright (C) 2012 The Android Open Source Project 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 # 15 16 # this file is used to prepare the NDK to build with the mipsel llvm-3.2 17 # toolchain any number of source files 18 # 19 # its purpose is to define (or re-define) templates used to build 20 # various sources into target object files, libraries or executables. 21 # 22 # Note that this file may end up being parsed several times in future 23 # revisions of the NDK. 24 # 25 26 # 27 # Override the toolchain prefix 28 # 29 30 LLVM_VERSION := 3.2 31 LLVM_NAME := llvm-$(LLVM_VERSION) 32 LLVM_TOOLCHAIN_ROOT := $(NDK_ROOT)/toolchains/$(LLVM_NAME) 33 LLVM_TOOLCHAIN_PREBUILT_ROOT := $(call host-prebuilt-tag,$(LLVM_TOOLCHAIN_ROOT)) 34 LLVM_TOOLCHAIN_PREFIX := $(LLVM_TOOLCHAIN_PREBUILT_ROOT)/bin/ 35 36 TOOLCHAIN_VERSION := 4.8 37 TOOLCHAIN_NAME := mipsel-linux-android-$(TOOLCHAIN_VERSION) 38 TOOLCHAIN_ROOT := $(NDK_ROOT)/toolchains/$(TOOLCHAIN_NAME) 39 TOOLCHAIN_PREBUILT_ROOT := $(call host-prebuilt-tag,$(TOOLCHAIN_ROOT)) 40 TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/mipsel-linux-android- 41 42 TARGET_CC := $(LLVM_TOOLCHAIN_PREFIX)clang$(HOST_EXEEXT) 43 TARGET_CXX := $(LLVM_TOOLCHAIN_PREFIX)clang++$(HOST_EXEEXT) 44 45 # 46 # CFLAGS, C_INCLUDES, and LDFLAGS 47 # 48 49 LLVM_TRIPLE := mipsel-none-linux-android 50 51 TARGET_CFLAGS := \ 52 -gcc-toolchain $(call host-path,$(TOOLCHAIN_PREBUILT_ROOT)) \ 53 -target $(LLVM_TRIPLE) \ 54 -fpic \ 55 -fno-strict-aliasing \ 56 -finline-functions \ 57 -ffunction-sections \ 58 -funwind-tables \ 59 -fmessage-length=0 \ 60 -no-canonical-prefixes 61 62 TARGET_LDFLAGS += \ 63 -gcc-toolchain $(call host-path,$(TOOLCHAIN_PREBUILT_ROOT)) \ 64 -target $(LLVM_TRIPLE) \ 65 -no-canonical-prefixes 66 67 TARGET_C_INCLUDES := \ 68 $(SYSROOT_INC)/usr/include 69 70 TARGET_mips_release_CFLAGS := -O2 \ 71 -g \ 72 -DNDEBUG \ 73 -fomit-frame-pointer 74 75 TARGET_mips_debug_CFLAGS := -O0 \ 76 -g \ 77 -fno-omit-frame-pointer 78 79 80 # This function will be called to determine the target CFLAGS used to build 81 # a C or Assembler source file, based on its tags. 82 TARGET-process-src-files-tags = \ 83 $(eval __debug_sources := $(call get-src-files-with-tag,debug)) \ 84 $(eval __release_sources := $(call get-src-files-without-tag,debug)) \ 85 $(call set-src-files-target-cflags, \ 86 $(__debug_sources),\ 87 $(TARGET_mips_debug_CFLAGS)) \ 88 $(call set-src-files-target-cflags,\ 89 $(__release_sources),\ 90 $(TARGET_mips_release_CFLAGS)) \ 91 $(call set-src-files-text,$(__debug_sources),mips$(space)) \ 92 $(call set-src-files-text,$(__release_sources),mips$(space)) \ 93