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 script is included repeatedly by main.mk to add a new toolchain
     17 # definition to the NDK build system.
     18 #
     19 # '_config_mk' must be defined as the path of a toolchain
     20 # configuration file (config.mk) that will be included here.
     21 #
     22 $(call assert-defined, _config_mk)
     23 
     24 # The list of variables that must or may be defined
     25 # by the toolchain configuration file
     26 #
     27 NDK_TOOLCHAIN_VARS_REQUIRED := TOOLCHAIN_ABIS
     28 NDK_TOOLCHAIN_VARS_OPTIONAL :=
     29 
     30 # Clear variables that are supposed to be defined by the config file
     31 $(call clear-vars,$(NDK_TOOLCHAIN_VARS_REQUIRED))
     32 $(call clear-vars,$(NDK_TOOLCHAIN_VARS_OPTIONAL))
     33 
     34 # Include the config file
     35 include $(_config_mk)
     36 
     37 # Check that the proper variables were defined
     38 $(call check-required-vars,$(NDK_TOOLCHAIN_VARS_REQUIRED),$(_config_mk))
     39 
     40 # Check that the file didn't do something stupid
     41 $(call assert-defined, _config_mk)
     42 
     43 # Now record the toolchain-specific information
     44 _dir  := $(patsubst %/,%,$(dir $(_config_mk)))
     45 _name := $(notdir $(_dir))
     46 _abis := $(TOOLCHAIN_ABIS)
     47 
     48 _toolchain := NDK_TOOLCHAIN.$(_name)
     49 
     50 # check that the toolchain name is unique
     51 $(if $(strip $($(_toolchain).defined)),\
     52   $(call __ndk_error,Toolchain $(_name) defined in $(_parent) is\
     53                      already defined in $(NDK_TOOLCHAIN.$(_name).defined)))
     54 
     55 $(_toolchain).defined := $(_toolchain_config)
     56 $(_toolchain).abis    := $(_abis)
     57 $(_toolchain).setup   := $(wildcard $(_dir)/setup.mk)
     58 
     59 $(if $(strip $($(_toolchain).setup)),,\
     60   $(call __ndk_error, Toolchain $(_name) lacks a setup.mk in $(_dir)))
     61 
     62 NDK_ALL_TOOLCHAINS += $(_name)
     63 NDK_ALL_ABIS       += $(_abis)
     64 
     65 # NKD_ABI.<abi>.toolchains records the list of toolchains that support
     66 # a given ABI
     67 #
     68 $(foreach _abi,$(_abis),\
     69     $(eval NDK_ABI.$(_abi).toolchains += $(_name)) \
     70 )
     71 
     72 # done
     73