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 repeatedly from build/core/main.mk 17# and is used to prepare for app-specific build rules. 18# 19 20$(call assert-defined,_app) 21 22_map := NDK_APP.$(_app) 23 24# which platform/abi/toolchain are we going to use? 25TARGET_PLATFORM := $(call get,$(_map),APP_PLATFORM) 26TARGET_ARCH_ABI := arm 27TARGET_ARCH := arm 28TARGET_TOOLCHAIN := $(NDK_TARGET_TOOLCHAIN) 29 30# the location of generated files for this app 31HOST_OUT := $(NDK_APP_OUT)/$(_app)/$(HOST_TAG) 32HOST_OBJS := $(HOST_OUT)/objs 33 34TARGET_OUT := $(NDK_APP_OUT)/$(_app)/$(TARGET_ABI) 35TARGET_OBJS := $(TARGET_OUT)/objs 36 37TARGET_GDB_SETUP := $(TARGET_OUT)/setup.gdb 38 39# ok, let's parse all Android.mk source files in order to build 40# the modules for this app. 41# 42 43# Restore the APP_XXX variables just for this pass as NDK_APP_XXX 44# 45NDK_APP_NAME := $(_app) 46NDK_APP_APPLICATION_MK := $(call get,$(_map),Application.mk) 47 48$(foreach __name,$(NDK_APP_VARS),\ 49 $(eval NDK_$(__name) := $(call get,$(_map),$(__name)))\ 50) 51 52# set release/debug build flags 53# 54ifeq ($(NDK_APP_OPTIM),debug) 55 NDK_APP_CFLAGS := -O0 -g $(NDK_APP_CFLAGS) 56else 57 NDK_APP_CFLAGS := -O2 -DNDEBUG -g $(NDK_APP_CFLAGS) 58endif 59 60# make the application depend on the modules it requires 61.PHONY: ndk-app-$(_app) 62ndk-app-$(_app): $(NDK_APP_MODULES) 63all: ndk-app-$(_app) 64 65include $(BUILD_SYSTEM)/setup-toolchain.mk 66