config.mk revision 0dd273a3f68364045c0e8bdcc10a4ecd3c07b745
1# 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
6# Only use ANDROID_BUILD_SHELL to wrap around bash.
7# DO NOT use other shells such as zsh.
8ifdef ANDROID_BUILD_SHELL
9SHELL := $(ANDROID_BUILD_SHELL)
10else
11# 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
15endif
16
17# Utility variables.
18empty :=
19space := $(empty) $(empty)
20comma := ,
21
22# Tell python not to spam the source tree with .pyc files.  This
23# only has an effect on python 2.6 and above.
24export PYTHONDONTWRITEBYTECODE := 1
25
26# Standard source directories.
27SRC_DOCS:= $(TOPDIR)docs
28# TODO: Enforce some kind of layering; only add include paths
29#       when a module links against a particular library.
30# TODO: See if we can remove most of these from the global list.
31SRC_HEADERS := \
32	$(TOPDIR)system/core/include \
33	$(TOPDIR)hardware/libhardware/include \
34	$(TOPDIR)hardware/libhardware_legacy/include \
35	$(TOPDIR)hardware/ril/include \
36	$(TOPDIR)libnativehelper/include \
37	$(TOPDIR)frameworks/native/include \
38	$(TOPDIR)frameworks/native/opengl/include \
39	$(TOPDIR)frameworks/av/include \
40	$(TOPDIR)frameworks/base/include \
41	$(TOPDIR)external/skia/include
42SRC_HOST_HEADERS:=$(TOPDIR)tools/include
43SRC_LIBRARIES:= $(TOPDIR)libs
44SRC_SERVERS:= $(TOPDIR)servers
45SRC_TARGET_DIR := $(TOPDIR)build/target
46SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api
47
48# Some specific paths to tools
49SRC_DROIDDOC_DIR := $(TOPDIR)build/tools/droiddoc
50
51# Various mappings to avoid hard-coding paths all over the place
52include $(BUILD_SYSTEM)/pathmap.mk
53
54# ###############################################################
55# Build system internal files
56# ###############################################################
57
58BUILD_COMBOS:= $(BUILD_SYSTEM)/combo
59
60CLEAR_VARS:= $(BUILD_SYSTEM)/clear_vars.mk
61BUILD_HOST_STATIC_LIBRARY:= $(BUILD_SYSTEM)/host_static_library.mk
62BUILD_HOST_SHARED_LIBRARY:= $(BUILD_SYSTEM)/host_shared_library.mk
63BUILD_STATIC_LIBRARY:= $(BUILD_SYSTEM)/static_library.mk
64BUILD_RAW_STATIC_LIBRARY := $(BUILD_SYSTEM)/raw_static_library.mk
65BUILD_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mk
66BUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mk
67BUILD_RAW_EXECUTABLE:= $(BUILD_SYSTEM)/raw_executable.mk
68BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk
69BUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mk
70BUILD_PHONY_PACKAGE:= $(BUILD_SYSTEM)/phony_package.mk
71BUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mk
72BUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mk
73BUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mk
74BUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mk
75BUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mk
76BUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mk
77BUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mk
78BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk
79BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
80BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
81BUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mk
82BUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mk
83BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
84
85
86-include cts/build/config.mk
87
88# ###############################################################
89# Parse out any modifier targets.
90# ###############################################################
91
92# The 'showcommands' goal says to show the full command
93# lines being executed, instead of a short message about
94# the kind of operation being done.
95SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS))
96
97
98# ###############################################################
99# Set common values
100# ###############################################################
101
102# These can be changed to modify both host and device modules.
103COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith
104COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG
105
106COMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promo
107COMMON_RELEASE_CPPFLAGS:= $(COMMON_RELEASE_CFLAGS)
108
109# Set the extensions used for various packages
110COMMON_PACKAGE_SUFFIX := .zip
111COMMON_JAVA_PACKAGE_SUFFIX := .jar
112COMMON_ANDROID_PACKAGE_SUFFIX := .apk
113
114# list of flags to turn specific warnings in to errors
115TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point
116
117# TODO: do symbol compression
118TARGET_COMPRESS_MODULE_SYMBOLS := false
119
120# Default shell is mksh. Other possible value is ash.
121TARGET_SHELL := mksh
122
123# ###############################################################
124# Include sub-configuration files
125# ###############################################################
126
127# ---------------------------------------------------------------
128# Try to include buildspec.mk, which will try to set stuff up.
129# If this file doesn't exist, the environment variables will
130# be used, and if that doesn't work, then the default is an
131# arm build
132ifndef ANDROID_BUILDSPEC
133ANDROID_BUILDSPEC := $(TOPDIR)buildspec.mk
134endif
135-include $(ANDROID_BUILDSPEC)
136
137# ---------------------------------------------------------------
138# Define most of the global variables.  These are the ones that
139# are specific to the user's build configuration.
140include $(BUILD_SYSTEM)/envsetup.mk
141
142# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
143# or under vendor/*/$(TARGET_DEVICE).  Search in both places, but
144# make sure only one exists.
145# Real boards should always be associated with an OEM vendor.
146board_config_mk := \
147	$(strip $(wildcard \
148		$(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
149		$(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
150		$(shell test -d vendor && find vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
151	))
152ifeq ($(board_config_mk),)
153  $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
154endif
155ifneq ($(words $(board_config_mk)),1)
156  $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
157endif
158include $(board_config_mk)
159ifeq ($(TARGET_ARCH),)
160  $(error TARGET_ARCH not defined by board config: $(board_config_mk))
161endif
162TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
163board_config_mk :=
164
165# Perhaps we should move this block to build/core/Makefile,
166# once we don't have TARGET_NO_KERNEL reference in AndroidBoard.mk/Android.mk.
167ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
168  INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
169  ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
170    INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
171  else
172    INSTALLED_2NDBOOTLOADER_TARGET :=
173  endif
174else
175  INSTALLED_BOOTLOADER_MODULE :=
176  INSTALLED_2NDBOOTLOADER_TARGET :=
177endif # TARGET_NO_BOOTLOADER
178ifneq ($(strip $(TARGET_NO_KERNEL)),true)
179  INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
180else
181  INSTALLED_KERNEL_TARGET :=
182endif
183
184
185# The build system exposes several variables for where to find the kernel
186# headers:
187#   TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current
188#       device being built. It is set as $(TARGET_DEVICE_DIR)/kernel-headers,
189#       e.g. device/samsung/tuna/kernel-headers. This directory is not
190#       explicitly set by anyone, the build system always adds this subdir.
191#
192#   TARGET_BOARD_KERNEL_HEADERS is specified by the BoardConfig.mk file
193#       to allow other directories to be included. This is useful if there's
194#       some common place where a few headers are being kept for a group
195#       of devices. For example, device/<vendor>/common/kernel-headers could
196#       contain some headers for several of <vendor>'s devices.
197#
198#   TARGET_PRODUCT_KERNEL_HEADERS is generated by the product inheritance
199#       graph. This allows architecture products to provide headers for the
200#       devices using that architecture. For example,
201#       hardware/ti/omap4xxx/omap4.mk will specify
202#       PRODUCT_VENDOR_KERNEL_HEADERS variable that specify where the omap4
203#       specific headers are, e.g. hardware/ti/omap4xxx/kernel-headers.
204#       The build system then combines all the values specified by all the
205#       PRODUCT_VENDOR_KERNEL_HEADERS directives in the product inheritance
206#       tree and then exports a TARGET_PRODUCT_KERNEL_HEADERS variable.
207#
208# The layout of subdirs in any of the kernel-headers dir should mirror the
209# layout of the kernel include/ directory. For example,
210#     device/samsung/tuna/kernel-headers/linux/,
211#     hardware/ti/omap4xxx/kernel-headers/media/,
212#     etc.
213#
214# NOTE: These directories MUST contain post-processed headers using the
215# bionic/libc/kernel/clean_header.py tool. Additionally, the original kernel
216# headers must also be checked in, but in a different subdirectory. By
217# convention, the originals should be checked into original-kernel-headers
218# directory of the same parent dir. For example,
219#     device/samsung/tuna/kernel-headers            <----- post-processed
220#     device/samsung/tuna/original-kernel-headers   <----- originals
221#
222TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers))
223
224define validate-kernel-headers
225$(if $(firstword $(foreach hdr_dir,$(1),\
226         $(filter-out kernel-headers,$(notdir $(hdr_dir))))),\
227     $(error Kernel header dirs must be end in kernel-headers: $(1)))
228endef
229# also allow the board config to provide additional directories since
230# there could be device/oem/base_hw and device/oem/derived_hw
231# that both are valid devices but derived_hw needs to use kernel headers
232# from base_hw.
233TARGET_BOARD_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_BOARD_KERNEL_HEADERS)))
234TARGET_BOARD_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_BOARD_KERNEL_HEADERS))
235$(call validate-kernel-headers,$(TARGET_BOARD_KERNEL_HEADERS))
236
237# then add product-inherited includes, to allow for
238# hardware/sivendor/chip/chip.mk to include their own headers
239TARGET_PRODUCT_KERNEL_HEADERS := $(strip $(wildcard $(PRODUCT_VENDOR_KERNEL_HEADERS)))
240TARGET_PRODUCT_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_PRODUCT_KERNEL_HEADERS))
241$(call validate-kernel-headers,$(TARGET_PRODUCT_KERNEL_HEADERS))
242
243# Clean up/verify variables defined by the board config file.
244TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
245TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI))
246ifeq ($(TARGET_CPU_ABI),)
247  $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk))
248endif
249TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2))
250
251# $(1): os/arch
252define select-android-config-h
253build/core/combo/include/arch/$(1)/AndroidConfig.h
254endef
255
256combo_target := HOST_
257include $(BUILD_SYSTEM)/combo/select.mk
258
259# on windows, the tools have .exe at the end, and we depend on the
260# host config stuff being done first
261
262combo_target := TARGET_
263include $(BUILD_SYSTEM)/combo/select.mk
264
265# Compute TARGET_TOOLCHAIN_ROOT from TARGET_TOOLS_PREFIX
266# if only TARGET_TOOLS_PREFIX is passed to the make command.
267ifndef TARGET_TOOLCHAIN_ROOT
268TARGET_TOOLCHAIN_ROOT := $(patsubst %/, %, $(dir $(TARGET_TOOLS_PREFIX)))
269TARGET_TOOLCHAIN_ROOT := $(patsubst %/, %, $(dir $(TARGET_TOOLCHAIN_ROOT)))
270TARGET_TOOLCHAIN_ROOT := $(wildcard $(TARGET_TOOLCHAIN_ROOT))
271endif
272
273# Normalize WITH_STATIC_ANALYZER and WITH_SYNTAX_CHECK
274ifeq ($(strip $(WITH_STATIC_ANALYZER)),0)
275  WITH_STATIC_ANALYZER :=
276endif
277ifeq ($(strip $(WITH_SYNTAX_CHECK)),0)
278  WITH_SYNTAX_CHECK :=
279endif
280
281# Disable WITH_STATIC_ANALYZER and WITH_SYNTAX_CHECK if tool can't be found
282SYNTAX_TOOLS_PREFIX := prebuilts/clang/$(HOST_PREBUILT_TAG)/host/3.3/bin
283ifneq ($(strip $(WITH_STATIC_ANALYZER)),)
284  ifeq ($(wildcard $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer),)
285    $(warning *** Disable WITH_STATIC_ANALYZER because $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer does not exist)
286    WITH_STATIC_ANALYZER :=
287  endif
288endif
289ifneq ($(strip $(WITH_SYNTAX_CHECK)),)
290  ifeq ($(wildcard $(SYNTAX_TOOLS_PREFIX)/ccc-syntax),)
291    $(warning *** Disable WITH_SYNTAX_CHECK because $(SYNTAX_TOOLS_PREFIX)/ccc-syntax does not exist)
292    WITH_SYNTAX_CHECK :=
293  endif
294endif
295
296# WITH_STATIC_ANALYZER trumps WITH_SYNTAX_CHECK
297ifneq ($(strip $(WITH_STATIC_ANALYZER)),)
298  ifneq ($(strip $(WITH_SYNTAX_CHECK)),)
299    $(warning *** Disable WITH_SYNTAX_CHECK in the presence of static analyzer WITH_STATIC_ANALYZER)
300    WITH_SYNTAX_CHECK :=
301  endif
302endif
303
304# Pick a Java compiler.
305include $(BUILD_SYSTEM)/combo/javac.mk
306
307# ---------------------------------------------------------------
308# Check that the configuration is current.  We check that
309# BUILD_ENV_SEQUENCE_NUMBER is current against this value.
310# Don't fail if we're called from envsetup, so they have a
311# chance to update their environment.
312
313ifeq (,$(strip $(CALLED_FROM_SETUP)))
314ifneq (,$(strip $(BUILD_ENV_SEQUENCE_NUMBER)))
315ifneq ($(BUILD_ENV_SEQUENCE_NUMBER),$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER))
316$(warning BUILD_ENV_SEQUENCE_NUMBER is set incorrectly.)
317$(info *** If you use envsetup/lunch/choosecombo:)
318$(info ***   - Re-execute envsetup (". envsetup.sh"))
319$(info ***   - Re-run lunch or choosecombo)
320$(info *** If you use buildspec.mk:)
321$(info ***   - Look at buildspec.mk.default to see what has changed)
322$(info ***   - Update BUILD_ENV_SEQUENCE_NUMBER to "$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)")
323$(error bailing..)
324endif
325endif
326endif
327
328
329# ---------------------------------------------------------------
330# Generic tools.
331
332LEX := flex
333# The default PKGDATADIR built in the prebuilt bison is a relative path
334# external/bison/data.
335# To run bison from elsewhere you need to set up enviromental variable
336# BISON_PKGDATADIR.
337BISON_PKGDATADIR := $(PWD)/external/bison/data
338BISON := prebuilts/misc/$(BUILD_OS)-$(BUILD_ARCH)/bison/bison
339YACC := $(BISON) -d
340
341DOXYGEN:= doxygen
342AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX)
343AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX)
344PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX)
345SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
346MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
347MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
348ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
349MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
350else
351MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG)
352endif
353MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/mkyaffs2image$(HOST_EXECUTABLE_SUFFIX)
354APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX)
355FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
356MKEXT2IMG := $(HOST_OUT_EXECUTABLES)/genext2fs$(HOST_EXECUTABLE_SUFFIX)
357MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/make_ext4fs$(HOST_EXECUTABLE_SUFFIX)
358MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg.sh
359MKEXT2BOOTIMG := external/genext2fs/mkbootimg_ext2.sh
360SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX)
361E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
362MKTARBALL := build/tools/mktarball.sh
363TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
364E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
365JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
366PROGUARD := external/proguard/bin/proguard.sh
367JAVATAGS := build/tools/java-event-log-tags.py
368LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX)
369BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat$(HOST_EXECUTABLE_SUFFIX)
370DEXOPT := $(HOST_OUT_EXECUTABLES)/dexopt$(HOST_EXECUTABLE_SUFFIX)
371DEXPREOPT := dalvik/tools/dex-preopt
372LINT := prebuilts/sdk/tools/lint
373RMTYPEDEFS := $(HOST_OUT_EXECUTABLES)/rmtypedefs
374
375# ACP is always for the build OS, not for the host OS
376ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX)
377
378# dx is java behind a shell script; no .exe necessary.
379DX := $(HOST_OUT_EXECUTABLES)/dx
380ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX)
381FINDBUGS := prebuilt/common/findbugs/bin/findbugs
382EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX)
383
384YACC_HEADER_SUFFIX:= .hpp
385
386# Don't use column under Windows, cygwin or not
387ifeq ($(HOST_OS),windows)
388COLUMN:= cat
389else
390COLUMN:= column
391endif
392
393OLD_FLEX := prebuilts/misc/$(HOST_PREBUILT_TAG)/flex/flex-2.5.4a$(HOST_EXECUTABLE_SUFFIX)
394
395ifeq ($(HOST_OS),darwin)
396# Mac OS' screwy version of java uses a non-standard directory layout
397# and doesn't even seem to have tools.jar.  On the other hand, javac seems
398# to be able to magically find the classes in there, wherever they are, so
399# leave this blank
400HOST_JDK_TOOLS_JAR :=
401else
402HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
403ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
404$(error Error: could not find jdk tools.jar, please install JDK6, \
405    which you can download from java.sun.com)
406endif
407endif
408
409# Is the host JDK 64-bit version?
410HOST_JDK_IS_64BIT_VERSION :=
411ifneq ($(filter 64-Bit, $(shell java -version 2>&1)),)
412HOST_JDK_IS_64BIT_VERSION := true
413endif
414
415# It's called md5 on Mac OS and md5sum on Linux
416ifeq ($(HOST_OS),darwin)
417MD5SUM:=md5 -q
418else
419MD5SUM:=md5sum
420endif
421
422APICHECK_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
423APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
424APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX)
425APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)"
426
427# The default key if not set as LOCAL_CERTIFICATE
428ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE
429  DEFAULT_SYSTEM_DEV_CERTIFICATE := $(PRODUCT_DEFAULT_DEV_CERTIFICATE)
430else
431  DEFAULT_SYSTEM_DEV_CERTIFICATE := build/target/product/security/testkey
432endif
433
434# ###############################################################
435# Set up final options.
436# ###############################################################
437
438HOST_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
439HOST_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
440
441HOST_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
442HOST_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
443
444TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
445TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
446
447TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
448TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
449
450HOST_GLOBAL_LD_DIRS += -L$(HOST_OUT_INTERMEDIATE_LIBRARIES)
451TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
452
453HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
454TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \
455		$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
456		$(TARGET_PRODUCT_KERNEL_HEADERS)
457
458# Many host compilers don't support these flags, so we have to make
459# sure to only specify them for the target compilers checked in to
460# the source tree.
461TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
462TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
463
464HOST_GLOBAL_CFLAGS += $(HOST_RELEASE_CFLAGS)
465HOST_GLOBAL_CPPFLAGS += $(HOST_RELEASE_CPPFLAGS)
466
467TARGET_GLOBAL_CFLAGS += $(TARGET_RELEASE_CFLAGS)
468TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS)
469
470# allow overriding default Java libraries on a per-target basis
471ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
472  TARGET_DEFAULT_JAVA_LIBRARIES := core core-junit ext framework framework2
473endif
474
475# define llvm tools and global flags
476include $(BUILD_SYSTEM)/llvm_config.mk
477
478# ###############################################################
479# Collect a list of the SDK versions that we could compile against
480# For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE)
481# ###############################################################
482
483HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk
484HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk
485
486# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N.
487# The 'current' version is whatever this source tree is.
488#
489# sgrax     is the opposite of xargs.  It takes the list of args and puts them
490#           on each line for sort to process.
491# sort -g   is a numeric sort, so 1 2 3 10 instead of 1 10 2 3.
492
493# Numerically sort a list of numbers
494# $(1): the list of numbers to be sorted
495define numerically_sort
496$(shell function sgrax() { \
497    while [ -n "$$1" ] ; do echo $$1 ; shift ; done \
498    } ; \
499    ( sgrax $(1) | sort -g ) )
500endef
501
502TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
503    $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
504    $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
505
506INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt
507
508# This is the standard way to name a directory containing prebuilt target
509# objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so
510TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
511
512# Set up RS prebuilt variables for compatibility library
513
514RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libclcore.bc
515RS_PREBUILT_LIBPATH := -L prebuilts/ndk/8/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib
516RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a
517
518include $(BUILD_SYSTEM)/dumpvar.mk
519