• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2009-2010 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#
17# This script is used to build all wanted NDK binaries. It is included
18# by several scripts.
19#
20
21# ensure that the following variables are properly defined
22$(call assert-defined,NDK_APPS NDK_APP_OUT)
23
24# ====================================================================
25#
26# Prepare the build for parsing Android.mk files
27#
28# ====================================================================
29
30# These phony targets are used to control various stages of the build
31.PHONY: all \
32        host_libraries host_executables \
33        installed_modules \
34        executables libraries static_libraries shared_libraries \
35        clean clean-objs-dir \
36        clean-executables clean-libraries \
37        clean-installed-modules \
38        clean-installed-binaries
39
40# These macros are used in Android.mk to include the corresponding
41# build script that will parse the LOCAL_XXX variable definitions.
42#
43CLEAR_VARS                := $(BUILD_SYSTEM)/clear-vars.mk
44BUILD_HOST_EXECUTABLE     := $(BUILD_SYSTEM)/build-host-executable.mk
45BUILD_HOST_STATIC_LIBRARY := $(BUILD_SYSTEM)/build-host-static-library.mk
46BUILD_STATIC_LIBRARY      := $(BUILD_SYSTEM)/build-static-library.mk
47BUILD_SHARED_LIBRARY      := $(BUILD_SYSTEM)/build-shared-library.mk
48BUILD_EXECUTABLE          := $(BUILD_SYSTEM)/build-executable.mk
49PREBUILT_SHARED_LIBRARY   := $(BUILD_SYSTEM)/prebuilt-shared-library.mk
50PREBUILT_STATIC_LIBRARY   := $(BUILD_SYSTEM)/prebuilt-static-library.mk
51
52ANDROID_MK_INCLUDED := \
53  $(CLEAR_VARS) \
54  $(BUILD_HOST_EXECUTABLE) \
55  $(BUILD_HOST_STATIC_LIBRARY) \
56  $(BUILD_STATIC_LIBRARY) \
57  $(BUILD_SHARED_LIBRARY) \
58  $(BUILD_EXECUTABLE) \
59  $(PREBUILT_SHARED_LIBRARY) \
60
61
62# this is the list of directories containing dependency information
63# generated during the build. It will be updated by build scripts
64# when module definitions are parsed.
65#
66ALL_DEPENDENCY_DIRS :=
67
68# this is the list of all generated files that we would need to clean
69ALL_HOST_EXECUTABLES      :=
70ALL_HOST_STATIC_LIBRARIES :=
71ALL_STATIC_LIBRARIES      :=
72ALL_SHARED_LIBRARIES      :=
73ALL_EXECUTABLES           :=
74
75WANTED_INSTALLED_MODULES  :=
76
77# the first rule
78all: installed_modules host_libraries host_executables
79
80
81$(foreach _app,$(NDK_APPS),\
82  $(eval include $(BUILD_SYSTEM)/setup-app.mk)\
83)
84
85# ====================================================================
86#
87# Now finish the build preparation with a few rules that depend on
88# what has been effectively parsed and recorded previously
89#
90# ====================================================================
91
92clean: clean-intermediates clean-installed-binaries
93
94distclean: clean
95
96installed_modules: clean-installed-binaries libraries $(WANTED_INSTALLED_MODULES)
97host_libraries: $(HOST_STATIC_LIBRARIES)
98host_executables: $(HOST_EXECUTABLES)
99
100static_libraries: $(STATIC_LIBRARIES)
101shared_libraries: $(SHARED_LIBRARIES)
102executables: $(EXECUTABLES)
103
104libraries: static_libraries shared_libraries
105
106clean-host-intermediates:
107	$(hide) rm -rf $(HOST_EXECUTABLES) $(HOST_STATIC_LIBRARIES)
108
109clean-intermediates: clean-host-intermediates
110	$(hide) rm -rf $(EXECUTABLES) $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
111
112# include dependency information
113ALL_DEPENDENCY_DIRS := $(sort $(ALL_DEPENDENCY_DIRS))
114-include $(wildcard $(ALL_DEPENDENCY_DIRS:%=%/*.d))
115