blob: cbc485989729e1283de0c49b9bd69e234770eda3 [file] [log] [blame]
# Copyright (C) 2009-2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# This script is used to build all wanted NDK binaries. It is included
# by several scripts.
#
# ensure that the following variables are properly defined
$(call assert-defined,NDK_APPS NDK_APP_OUT)
# ====================================================================
#
# Check the import path
#
# ====================================================================
NDK_MODULE_PATH := $(strip $(NDK_MODULE_PATH))
ifdef NDK_MODULE_PATH
ifneq ($(words $(NDK_MODULE_PATH)),1)
$(call __ndk_info,ERROR: You NDK_MODULE_PATH variable contains spaces)
$(call __ndk_info,Please fix the error and start again.)
$(call __ndk_error,Aborting)
endif
endif
$(call import-init)
$(foreach __path,$(patsubst $(HOST_DIRSEP),$(space),$(NDK_MODULE_PATH)),\
$(call import-add-path,$(__path))\
)
$(call import-add-path-optional,$(NDK_ROOT)/sources)
$(call import-add-path-optional,$(NDK_ROOT)/../development/ndk/sources)
# ====================================================================
#
# Prepare the build for parsing Android.mk files
#
# ====================================================================
# These phony targets are used to control various stages of the build
.PHONY: all \
host_libraries host_executables \
installed_modules \
executables libraries static_libraries shared_libraries \
clean clean-objs-dir \
clean-executables clean-libraries \
clean-installed-modules \
clean-installed-binaries
# These macros are used in Android.mk to include the corresponding
# build script that will parse the LOCAL_XXX variable definitions.
#
CLEAR_VARS := $(BUILD_SYSTEM)/clear-vars.mk
BUILD_HOST_EXECUTABLE := $(BUILD_SYSTEM)/build-host-executable.mk
BUILD_HOST_STATIC_LIBRARY := $(BUILD_SYSTEM)/build-host-static-library.mk
BUILD_STATIC_LIBRARY := $(BUILD_SYSTEM)/build-static-library.mk
BUILD_SHARED_LIBRARY := $(BUILD_SYSTEM)/build-shared-library.mk
BUILD_EXECUTABLE := $(BUILD_SYSTEM)/build-executable.mk
PREBUILT_SHARED_LIBRARY := $(BUILD_SYSTEM)/prebuilt-shared-library.mk
ANDROID_MK_INCLUDED := \
$(CLEAR_VARS) \
$(BUILD_HOST_EXECUTABLE) \
$(BUILD_HOST_STATIC_LIBRARY) \
$(BUILD_STATIC_LIBRARY) \
$(BUILD_SHARED_LIBRARY) \
$(BUILD_EXECUTABLE) \
$(PREBUILT_SHARED_LIBRARY) \
# this is the list of directories containing dependency information
# generated during the build. It will be updated by build scripts
# when module definitions are parsed.
#
ALL_DEPENDENCY_DIRS :=
# this is the list of all generated files that we would need to clean
ALL_HOST_EXECUTABLES :=
ALL_HOST_STATIC_LIBRARIES :=
ALL_STATIC_LIBRARIES :=
ALL_SHARED_LIBRARIES :=
ALL_EXECUTABLES :=
WANTED_INSTALLED_MODULES :=
# the first rule
all: installed_modules host_libraries host_executables
$(foreach _app,$(NDK_APPS),\
$(eval include $(BUILD_SYSTEM)/setup-app.mk)\
)
# ====================================================================
#
# Now finish the build preparation with a few rules that depend on
# what has been effectively parsed and recorded previously
#
# ====================================================================
clean: clean-intermediates clean-installed-binaries
distclean: clean
installed_modules: clean-installed-binaries libraries $(WANTED_INSTALLED_MODULES)
host_libraries: $(HOST_STATIC_LIBRARIES)
host_executables: $(HOST_EXECUTABLES)
static_libraries: $(STATIC_LIBRARIES)
shared_libraries: $(SHARED_LIBRARIES)
executables: $(EXECUTABLES)
libraries: static_libraries shared_libraries
clean-host-intermediates:
$(hide) rm -rf $(HOST_EXECUTABLES) $(HOST_STATIC_LIBRARIES)
clean-intermediates: clean-host-intermediates
$(hide) rm -rf $(EXECUTABLES) $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
# include dependency information
ALL_DEPENDENCY_DIRS := $(sort $(ALL_DEPENDENCY_DIRS))
-include $(wildcard $(ALL_DEPENDENCY_DIRS:%=%/*.d))