blob: 47d675a651c73e6d9e43cc1d1489190ec5407ba9 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# This is included by the top-level Makefile.
2# It sets up standard variables based on the
3# current configuration and platform, which
4# are not specific to what is being built.
5
Ying Wang6714dbc2010-03-30 16:42:15 -07006# Only use ANDROID_BUILD_SHELL to wrap around bash.
7# DO NOT use other shells such as zsh.
Ying Wang2ce495a2010-03-30 12:55:13 -07008ifdef ANDROID_BUILD_SHELL
9SHELL := $(ANDROID_BUILD_SHELL)
10else
The Android Open Source Project88b60792009-03-03 19:28:42 -080011# Use bash, not whatever shell somebody has installed as /bin/sh
12# This is repeated from main.mk, since envsetup.sh runs this file
13# directly.
14SHELL := /bin/bash
Ying Wang2ce495a2010-03-30 12:55:13 -070015endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080016
Joe Onoratobc8abb62010-01-04 12:57:38 -080017# Tell python not to spam the source tree with .pyc files. This
18# only has an effect on python 2.6 and above.
19export PYTHONDONTWRITEBYTECODE := 1
20
The Android Open Source Project88b60792009-03-03 19:28:42 -080021# Standard source directories.
22SRC_DOCS:= $(TOPDIR)docs
23# TODO: Enforce some kind of layering; only add include paths
24# when a module links against a particular library.
25# TODO: See if we can remove most of these from the global list.
26SRC_HEADERS := \
27 $(TOPDIR)system/core/include \
28 $(TOPDIR)hardware/libhardware/include \
29 $(TOPDIR)hardware/libhardware_legacy/include \
30 $(TOPDIR)hardware/ril/include \
31 $(TOPDIR)dalvik/libnativehelper/include \
32 $(TOPDIR)frameworks/base/include \
33 $(TOPDIR)frameworks/base/opengl/include \
Dianne Hackborn93b01602010-05-04 11:31:59 -070034 $(TOPDIR)frameworks/base/native/include \
The Android Open Source Project88b60792009-03-03 19:28:42 -080035 $(TOPDIR)external/skia/include
36SRC_HOST_HEADERS:=$(TOPDIR)tools/include
37SRC_LIBRARIES:= $(TOPDIR)libs
38SRC_SERVERS:= $(TOPDIR)servers
39SRC_TARGET_DIR := $(TOPDIR)build/target
40SRC_API_DIR := $(TOPDIR)frameworks/base/api
41
42# Some specific paths to tools
43SRC_DROIDDOC_DIR := $(TOPDIR)build/tools/droiddoc
44
45# Various mappings to avoid hard-coding paths all over the place
46include $(BUILD_SYSTEM)/pathmap.mk
47
48# ###############################################################
49# Build system internal files
50# ###############################################################
51
52BUILD_COMBOS:= $(BUILD_SYSTEM)/combo
53
54CLEAR_VARS:= $(BUILD_SYSTEM)/clear_vars.mk
55BUILD_HOST_STATIC_LIBRARY:= $(BUILD_SYSTEM)/host_static_library.mk
56BUILD_HOST_SHARED_LIBRARY:= $(BUILD_SYSTEM)/host_shared_library.mk
57BUILD_STATIC_LIBRARY:= $(BUILD_SYSTEM)/static_library.mk
58BUILD_RAW_STATIC_LIBRARY := $(BUILD_SYSTEM)/raw_static_library.mk
59BUILD_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mk
60BUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mk
61BUILD_RAW_EXECUTABLE:= $(BUILD_SYSTEM)/raw_executable.mk
62BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk
63BUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mk
Dima Zavinf625bf22010-09-16 00:25:16 -070064BUILD_PHONY_PACKAGE:= $(BUILD_SYSTEM)/phony_package.mk
The Android Open Source Project88b60792009-03-03 19:28:42 -080065BUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mk
66BUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mk
67BUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mk
68BUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mk
69BUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mk
70BUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mk
71BUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mk
72BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk
Ying Wang4c681742010-07-20 11:08:47 -070073BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
74BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
The Android Open Source Project88b60792009-03-03 19:28:42 -080075
76# ###############################################################
77# Parse out any modifier targets.
78# ###############################################################
79
80# The 'showcommands' goal says to show the full command
81# lines being executed, instead of a short message about
82# the kind of operation being done.
83SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS))
84
85
86# ###############################################################
87# Set common values
88# ###############################################################
89
90# These can be changed to modify both host and device modules.
Marco Nelissene4aaa362009-07-13 20:42:49 -070091COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith
The Android Open Source Project88b60792009-03-03 19:28:42 -080092COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG
93
Marco Nelissen7f0a18f2009-08-13 11:13:21 -070094COMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promo
Marco Nelissen73a075d2009-07-08 17:51:18 -070095COMMON_RELEASE_CPPFLAGS:= $(COMMON_RELEASE_CFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -080096
97# Set the extensions used for various packages
98COMMON_PACKAGE_SUFFIX := .zip
99COMMON_JAVA_PACKAGE_SUFFIX := .jar
100COMMON_ANDROID_PACKAGE_SUFFIX := .apk
101
102# list of flags to turn specific warnings in to errors
Marco Nelissenbac9a7f2009-07-13 17:51:59 -0700103TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point
The Android Open Source Project88b60792009-03-03 19:28:42 -0800104
Patrick Scottf4f85a22009-06-25 10:38:26 -0400105# TODO: do symbol compression
106TARGET_COMPRESS_MODULE_SYMBOLS := false
107
Jean-Baptiste Queru772a0f62011-05-18 13:49:08 -0700108# Default shell is mksh. Other possible value is ash.
109TARGET_SHELL := mksh
Thorsten Glaser2213aab2010-06-03 19:57:02 +0200110
The Android Open Source Project88b60792009-03-03 19:28:42 -0800111# ###############################################################
112# Include sub-configuration files
113# ###############################################################
114
115# ---------------------------------------------------------------
116# Try to include buildspec.mk, which will try to set stuff up.
117# If this file doesn't exist, the environemnt variables will
118# be used, and if that doesn't work, then the default is an
119# arm build
Ying Wangd4495e92011-11-02 13:49:08 -0700120ifndef ANDROID_BUILDSPEC
121ANDROID_BUILDSPEC := $(TOPDIR)buildspec.mk
122endif
123-include $(ANDROID_BUILDSPEC)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800124
125# ---------------------------------------------------------------
126# Define most of the global variables. These are the ones that
127# are specific to the user's build configuration.
128include $(BUILD_SYSTEM)/envsetup.mk
129
Patrick Scott87c86572009-06-23 15:25:06 -0400130# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
131# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
132# make sure only one exists.
133# Real boards should always be associated with an OEM vendor.
134board_config_mk := \
135 $(strip $(wildcard \
136 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
Jean-Baptiste Queru8d054162010-01-22 13:25:24 -0800137 device/*/$(TARGET_DEVICE)/BoardConfig.mk \
Patrick Scott87c86572009-06-23 15:25:06 -0400138 vendor/*/$(TARGET_DEVICE)/BoardConfig.mk \
139 ))
140ifeq ($(board_config_mk),)
141 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
142endif
143ifneq ($(words $(board_config_mk)),1)
144 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
145endif
146include $(board_config_mk)
147TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
148board_config_mk :=
149
150# Clean up/verify variables defined by the board config file.
151TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
152TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI))
153ifeq ($(TARGET_CPU_ABI),)
154 $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk))
155endif
David 'Digit' Turner2edfb712009-11-06 15:12:00 -0800156TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2))
Patrick Scott87c86572009-06-23 15:25:06 -0400157
The Android Open Source Project88b60792009-03-03 19:28:42 -0800158# $(1): os/arch
159define select-android-config-h
160system/core/include/arch/$(1)/AndroidConfig.h
161endef
162
163combo_target := HOST_
164include $(BUILD_SYSTEM)/combo/select.mk
165
166# on windows, the tools have .exe at the end, and we depend on the
167# host config stuff being done first
168
169combo_target := TARGET_
170include $(BUILD_SYSTEM)/combo/select.mk
171
Ying Wangdf2b4b32012-01-12 16:38:17 -0800172# Compute TARGET_TOOLCHAIN_ROOT from TARGET_TOOLS_PREFIX
173# if only TARGET_TOOLS_PREFIX is passed to the make command.
174ifndef TARGET_TOOLCHAIN_ROOT
175TARGET_TOOLCHAIN_ROOT := $(patsubst %/, %, $(dir $(TARGET_TOOLS_PREFIX)))
176TARGET_TOOLCHAIN_ROOT := $(patsubst %/, %, $(dir $(TARGET_TOOLCHAIN_ROOT)))
177TARGET_TOOLCHAIN_ROOT := $(wildcard $(TARGET_TOOLCHAIN_ROOT))
178endif
179
The Android Open Source Project88b60792009-03-03 19:28:42 -0800180# Pick a Java compiler.
181include $(BUILD_SYSTEM)/combo/javac.mk
182
183# ---------------------------------------------------------------
184# Check that the configuration is current. We check that
185# BUILD_ENV_SEQUENCE_NUMBER is current against this value.
186# Don't fail if we're called from envsetup, so they have a
187# chance to update their environment.
188
189ifeq (,$(strip $(CALLED_FROM_SETUP)))
190ifneq (,$(strip $(BUILD_ENV_SEQUENCE_NUMBER)))
191ifneq ($(BUILD_ENV_SEQUENCE_NUMBER),$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER))
192$(warning BUILD_ENV_SEQUENCE_NUMBER is set incorrectly.)
193$(info *** If you use envsetup/lunch/choosecombo:)
194$(info *** - Re-execute envsetup (". envsetup.sh"))
195$(info *** - Re-run lunch or choosecombo)
196$(info *** If you use buildspec.mk:)
197$(info *** - Look at buildspec.mk.default to see what has changed)
198$(info *** - Update BUILD_ENV_SEQUENCE_NUMBER to "$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)")
199$(error bailing..)
200endif
201endif
202endif
203
204
205# ---------------------------------------------------------------
206# Generic tools.
207
208LEX:= flex
209YACC:= bison -d
210DOXYGEN:= doxygen
211AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800212AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX)
Wink Savillee7890832010-11-05 11:28:51 -0700213PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800214ICUDATA := $(HOST_OUT_EXECUTABLES)/icudata$(HOST_EXECUTABLE_SUFFIX)
215SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
216MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
Doug Zongker8b70e8c2009-05-27 09:14:25 -0700217MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800218MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
219MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/mkyaffs2image$(HOST_EXECUTABLE_SUFFIX)
220APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX)
221FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
222MKEXT2IMG := $(HOST_OUT_EXECUTABLES)/genext2fs$(HOST_EXECUTABLE_SUFFIX)
Colin Cross9dd4ba82010-08-03 14:43:15 -0700223MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/make_ext4fs$(HOST_EXECUTABLE_SUFFIX)
Ying Wang542903a2010-11-17 15:40:38 -0800224MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg.sh
The Android Open Source Project88b60792009-03-03 19:28:42 -0800225MKEXT2BOOTIMG := external/genext2fs/mkbootimg_ext2.sh
226MKTARBALL := build/tools/mktarball.sh
Colin Cross0a7b2c52010-05-07 02:23:59 -0700227TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
228E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
Steve Howardef5c6402010-05-03 15:01:38 -0700229JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
Joe Onorato2daa2b32009-08-30 13:39:24 -0700230PROGUARD := external/proguard/bin/proguard.sh
Doug Zongker9bd49622009-11-30 14:28:59 -0800231JAVATAGS := build/tools/java-event-log-tags.py
Shih-wei Liaod01fadb2010-10-08 16:57:46 -0700232LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX)
Shih-wei Liaof7b32bf2010-10-11 10:36:42 -0700233LLVM_RS_LINK := $(HOST_OUT_EXECUTABLES)/llvm-rs-link$(HOST_EXECUTABLE_SUFFIX)
Ying Wange7874c42010-09-17 16:36:06 -0700234DEXOPT := $(HOST_OUT_EXECUTABLES)/dexopt$(HOST_EXECUTABLE_SUFFIX)
235DEXPREOPT := dalvik/tools/dex-preopt
The Android Open Source Project88b60792009-03-03 19:28:42 -0800236
Raphael9ca16282010-04-16 17:50:09 -0700237# ACP is always for the build OS, not for the host OS
238ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX)
239
The Android Open Source Project88b60792009-03-03 19:28:42 -0800240# dx is java behind a shell script; no .exe necessary.
241DX := $(HOST_OUT_EXECUTABLES)/dx
The Android Open Source Project88b60792009-03-03 19:28:42 -0800242ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX)
243FINDBUGS := prebuilt/common/findbugs/bin/findbugs
244LOCALIZE := $(HOST_OUT_EXECUTABLES)/localize$(HOST_EXECUTABLE_SUFFIX)
245EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX)
246
The Android Open Source Project88b60792009-03-03 19:28:42 -0800247# Deal with archaic version of bison on Mac OS X.
248ifeq ($(filter 1.28,$(shell $(YACC) -V)),)
249YACC_HEADER_SUFFIX:= .hpp
250else
251YACC_HEADER_SUFFIX:= .cpp.h
252endif
253
254# Don't use column under Windows, cygwin or not
255ifeq ($(HOST_OS),windows)
256COLUMN:= cat
257else
258COLUMN:= column
259endif
260
261dir := $(shell uname)
262ifeq ($(HOST_OS),windows)
263dir := $(HOST_OS)
264endif
265ifeq ($(HOST_OS),darwin)
266dir := $(HOST_OS)-$(HOST_ARCH)
267endif
268OLD_FLEX := prebuilt/$(HOST_PREBUILT_TAG)/flex/flex-2.5.4a$(HOST_EXECUTABLE_SUFFIX)
269
270ifeq ($(HOST_OS),darwin)
271# Mac OS' screwy version of java uses a non-standard directory layout
272# and doesn't even seem to have tools.jar. On the other hand, javac seems
273# to be able to magically find the classes in there, wherever they are, so
274# leave this blank
275HOST_JDK_TOOLS_JAR :=
276else
277HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
Ying Wangec5e7292010-04-26 18:36:52 -0700278ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
Ying Wang31a95702010-09-22 17:45:35 -0700279$(error Error: could not find jdk tools.jar, please install JDK6, \
Ying Wang1613f4f2010-09-22 14:11:49 -0700280 which you can download from java.sun.com)
Ying Wangec5e7292010-04-26 18:36:52 -0700281endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800282endif
283
Ying Wang053dccb2011-05-24 15:46:15 -0700284# Is the host JDK 64-bit version?
285HOST_JDK_IS_64BIT_VERSION :=
286ifneq ($(filter 64-Bit, $(shell java -version 2>&1)),)
287HOST_JDK_IS_64BIT_VERSION := true
288endif
289
The Android Open Source Project88b60792009-03-03 19:28:42 -0800290# It's called md5 on Mac OS and md5sum on Linux
291ifeq ($(HOST_OS),darwin)
292MD5SUM:=md5 -q
293else
294MD5SUM:=md5sum
295endif
296
Joe Onorato2a6e0522011-04-08 17:32:52 -0700297APICHECK_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
298APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
299APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX)
300APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)"
301
Ying Wang3c21fe52011-10-04 10:50:08 -0700302# The default key if not set as LOCAL_CERTIFICATE
303ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE
304 DEFAULT_SYSTEM_DEV_CERTIFICATE := $(PRODUCT_DEFAULT_DEV_CERTIFICATE)
305else
306 DEFAULT_SYSTEM_DEV_CERTIFICATE := build/target/product/security/testkey
307endif
308
The Android Open Source Project88b60792009-03-03 19:28:42 -0800309# ###############################################################
310# Set up final options.
311# ###############################################################
312
313HOST_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800314HOST_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
315
316HOST_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800317HOST_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
318
319TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800320TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
321
322TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800323TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
324
325HOST_GLOBAL_LD_DIRS += -L$(HOST_OUT_INTERMEDIATE_LIBRARIES)
326TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
327
328HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
329TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS)
330
331# Many host compilers don't support these flags, so we have to make
332# sure to only specify them for the target compilers checked in to
Jeff Browne33ba4c2011-07-11 22:11:46 -0700333# the source tree.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800334TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
335TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800336
Dave Bort95282482009-04-23 18:44:55 -0700337HOST_GLOBAL_CFLAGS += $(HOST_RELEASE_CFLAGS)
338HOST_GLOBAL_CPPFLAGS += $(HOST_RELEASE_CPPFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800339
Dave Bort95282482009-04-23 18:44:55 -0700340TARGET_GLOBAL_CFLAGS += $(TARGET_RELEASE_CFLAGS)
341TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800342
The Android Open Source Project88b60792009-03-03 19:28:42 -0800343PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true)
344
The Android Open Source Project88b60792009-03-03 19:28:42 -0800345# ###############################################################
346# Collect a list of the SDK versions that we could compile against
347# For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE)
348# ###############################################################
349
Ying Wang9978faf2011-11-29 10:24:27 -0800350HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk
Ying Wangb50bd7f2011-11-29 11:20:16 -0800351HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk
Ying Wang0f6f4ca2010-06-09 10:26:26 -0700352
353# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N.
354# The 'current' version is whatever this source tree is.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800355#
356# sgrax is the opposite of xargs. It takes the list of args and puts them
357# on each line for sort to process.
358# sort -g is a numeric sort, so 1 2 3 10 instead of 1 10 2 3.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800359
Ying Wang0f6f4ca2010-06-09 10:26:26 -0700360# Numerically sort a list of numbers
361# $(1): the list of numbers to be sorted
362define numerically_sort
363$(shell function sgrax() { \
364 while [ -n "$$1" ] ; do echo $$1 ; shift ; done \
365 } ; \
366 ( sgrax $(1) | sort -g ) )
367endef
368
369TARGET_AVAILABLE_SDK_VERSIONS := current $(call numerically_sort,\
370 $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
371 $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800372
Ying Wang1a081002010-07-13 14:55:47 -0700373TARGET_AVAILABLE_NDK_VERSIONS := $(call numerically_sort,\
374 $(patsubst $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r%,%, \
375 $(wildcard $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r*)))
376
Joe Onorato15ee93b2011-04-08 15:03:48 -0700377INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt
Gary King1e80c292010-03-08 17:16:57 -0800378
Bruce Bearef1582e52010-10-14 14:31:48 -0700379# This is the standard way to name a directory containing prebuilt target
380# objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so
Jeff Browne33ba4c2011-07-11 22:11:46 -0700381TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
Bruce Bearef1582e52010-10-14 14:31:48 -0700382
Gary King1e80c292010-03-08 17:16:57 -0800383include $(BUILD_SYSTEM)/dumpvar.mk