Home | History | Annotate | Download | only in core
      1 # Copyright (C) 2009 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 included multiple times by build/core/setup-app.mk
     17 #
     18 
     19 $(call ndk_log,Building application '$(NDK_APP_NAME)' for ABI '$(TARGET_ARCH_ABI)')
     20 
     21 TARGET_ARCH := $(strip $(NDK_ABI.$(TARGET_ARCH_ABI).arch))
     22 ifndef TARGET_ARCH
     23     $(call __ndk_info,ERROR: The $(TARGET_ARCH_ABI) ABI has no associated architecture!)
     24     $(call __ndk_error,Aborting...)
     25 endif
     26 
     27 TARGET_OUT := $(NDK_APP_OUT)/$(_app)/$(TARGET_ARCH_ABI)
     28 
     29 # Special handling for x86 and mips: The minimal platform is android-9 here
     30 # For now, handle this with a simple substitution. We may want to implement
     31 # more general filtering in the future when introducing other ABIs.
     32 TARGET_PLATFORM_SAVED := $(TARGET_PLATFORM)
     33 ifneq ($(filter %x86 %mips,$(TARGET_ARCH_ABI)),)
     34 $(foreach _plat,3 4 5 8,\
     35     $(eval TARGET_PLATFORM := $$(subst android-$(_plat),android-9,$$(TARGET_PLATFORM)))\
     36 )
     37 endif
     38 
     39 # The first platform for 64-bit ABIs is android-$(NDK_PREVIEW_LEVEL)
     40 ifneq ($(filter $(NDK_KNOWN_DEVICE_ABI64S),$(TARGET_ARCH_ABI)),)
     41 $(foreach _plat,3 4 5 8 9 10 11 12 13 14 15 16 17 18 19 20 21,\
     42     $(eval TARGET_PLATFORM := $$(subst android-$(_plat),android-$(NDK_PREVIEW_LEVEL),$$(TARGET_PLATFORM)))\
     43 )
     44 endif
     45 
     46 TARGET_PLATFORM_LEVEL := $(strip $(subst android-,,$(TARGET_PLATFORM)))
     47 ifneq ($(TARGET_PLATFORM_LEVEL),$(NDK_PREVIEW_LEVEL))
     48     ifneq (,$(call gte,$(TARGET_PLATFORM_LEVEL),$(NDK_PIE_PLATFORM_LEVEL)))
     49         TARGET_PIE := true
     50         $(call ndk_log,  Enabling -fPIE for TARGET_PLATFORM $(TARGET_PLATFORM))
     51     else
     52         TARGET_PIE := false
     53     endif
     54 else
     55     TARGET_PIE := true
     56 endif
     57 
     58 # Separate the debug and release objects. This prevents rebuilding
     59 # everything when you switch between these two modes. For projects
     60 # with lots of C++ sources, this can be a considerable time saver.
     61 ifeq ($(NDK_APP_OPTIM),debug)
     62 TARGET_OBJS := $(TARGET_OUT)/objs-debug
     63 else
     64 TARGET_OBJS := $(TARGET_OUT)/objs
     65 endif
     66 
     67 TARGET_GDB_SETUP := $(TARGET_OUT)/setup.gdb
     68 
     69 # RS triple
     70 ifneq ($(filter $(TARGET_ARCH_ABI), armeabi-v7a armeabi-v7a-hard),)
     71   RS_TRIPLE := armv7-none-linux-gnueabi
     72 endif
     73 ifeq ($(TARGET_ARCH_ABI),armeabi)
     74   RS_TRIPLE := arm-none-linux-gnueabi
     75 endif
     76 ifeq ($(TARGET_ARCH_ABI),mips)
     77   RS_TRIPLE := mipsel-unknown-linux
     78 endif
     79 ifeq ($(TARGET_ARCH_ABI),x86)
     80   RS_TRIPLE := i686-unknown-linux
     81 endif
     82 
     83 
     84 include $(BUILD_SYSTEM)/setup-toolchain.mk
     85 
     86 # Restore TARGET_PLATFORM, see above.
     87 TARGET_PLATFORM := $(TARGET_PLATFORM_SAVED)
     88