config.mk revision f7661706b03e4258d1b48c6ad71ce4a5e287ee2a
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# 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 21# 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 \ 34 $(TOPDIR)frameworks/base/native/include \ 35 $(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 64BUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mk 65BUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mk 66BUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mk 67BUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mk 68BUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mk 69BUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mk 70BUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mk 71BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk 72BUILD_KEY_CHAR_MAP := $(BUILD_SYSTEM)/key_char_map.mk 73 74# ############################################################### 75# Parse out any modifier targets. 76# ############################################################### 77 78# The 'showcommands' goal says to show the full command 79# lines being executed, instead of a short message about 80# the kind of operation being done. 81SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS)) 82 83 84# ############################################################### 85# Set common values 86# ############################################################### 87 88# These can be changed to modify both host and device modules. 89COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith 90COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG 91 92COMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promo 93COMMON_RELEASE_CPPFLAGS:= $(COMMON_RELEASE_CFLAGS) 94 95# Set the extensions used for various packages 96COMMON_PACKAGE_SUFFIX := .zip 97COMMON_JAVA_PACKAGE_SUFFIX := .jar 98COMMON_ANDROID_PACKAGE_SUFFIX := .apk 99 100# list of flags to turn specific warnings in to errors 101TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point 102 103# TODO: do symbol compression 104TARGET_COMPRESS_MODULE_SYMBOLS := false 105 106# Default is to prelink modules. 107TARGET_PRELINK_MODULE := true 108 109# ############################################################### 110# Include sub-configuration files 111# ############################################################### 112 113# --------------------------------------------------------------- 114# Try to include buildspec.mk, which will try to set stuff up. 115# If this file doesn't exist, the environemnt variables will 116# be used, and if that doesn't work, then the default is an 117# arm build 118-include $(TOPDIR)buildspec.mk 119 120# --------------------------------------------------------------- 121# Define most of the global variables. These are the ones that 122# are specific to the user's build configuration. 123include $(BUILD_SYSTEM)/envsetup.mk 124 125# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE) 126# or under vendor/*/$(TARGET_DEVICE). Search in both places, but 127# make sure only one exists. 128# Real boards should always be associated with an OEM vendor. 129board_config_mk := \ 130 $(strip $(wildcard \ 131 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \ 132 device/*/$(TARGET_DEVICE)/BoardConfig.mk \ 133 vendor/*/$(TARGET_DEVICE)/BoardConfig.mk \ 134 )) 135ifeq ($(board_config_mk),) 136 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE)) 137endif 138ifneq ($(words $(board_config_mk)),1) 139 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk)) 140endif 141include $(board_config_mk) 142TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk))) 143board_config_mk := 144 145include $(BUILD_SYSTEM)/dumpvar.mk 146 147# Clean up/verify variables defined by the board config file. 148TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME)) 149TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI)) 150ifeq ($(TARGET_CPU_ABI),) 151 $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk)) 152endif 153TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2)) 154 155# $(1): os/arch 156define select-android-config-h 157system/core/include/arch/$(1)/AndroidConfig.h 158endef 159 160combo_target := HOST_ 161include $(BUILD_SYSTEM)/combo/select.mk 162 163# on windows, the tools have .exe at the end, and we depend on the 164# host config stuff being done first 165 166combo_target := TARGET_ 167include $(BUILD_SYSTEM)/combo/select.mk 168 169# Pick a Java compiler. 170include $(BUILD_SYSTEM)/combo/javac.mk 171 172# --------------------------------------------------------------- 173# Check that the configuration is current. We check that 174# BUILD_ENV_SEQUENCE_NUMBER is current against this value. 175# Don't fail if we're called from envsetup, so they have a 176# chance to update their environment. 177 178ifeq (,$(strip $(CALLED_FROM_SETUP))) 179ifneq (,$(strip $(BUILD_ENV_SEQUENCE_NUMBER))) 180ifneq ($(BUILD_ENV_SEQUENCE_NUMBER),$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)) 181$(warning BUILD_ENV_SEQUENCE_NUMBER is set incorrectly.) 182$(info *** If you use envsetup/lunch/choosecombo:) 183$(info *** - Re-execute envsetup (". envsetup.sh")) 184$(info *** - Re-run lunch or choosecombo) 185$(info *** If you use buildspec.mk:) 186$(info *** - Look at buildspec.mk.default to see what has changed) 187$(info *** - Update BUILD_ENV_SEQUENCE_NUMBER to "$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)") 188$(error bailing..) 189endif 190endif 191endif 192 193 194# --------------------------------------------------------------- 195# Generic tools. 196 197LEX:= flex 198YACC:= bison -d 199DOXYGEN:= doxygen 200AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX) 201AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX) 202ICUDATA := $(HOST_OUT_EXECUTABLES)/icudata$(HOST_EXECUTABLE_SUFFIX) 203SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) 204MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX) 205MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX) 206MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX) 207MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/mkyaffs2image$(HOST_EXECUTABLE_SUFFIX) 208APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX) 209FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX) 210MKEXT2IMG := $(HOST_OUT_EXECUTABLES)/genext2fs$(HOST_EXECUTABLE_SUFFIX) 211MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/make_ext4fs$(HOST_EXECUTABLE_SUFFIX) 212MKEXT2USERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg.sh 213MKEXT2BOOTIMG := external/genext2fs/mkbootimg_ext2.sh 214MKTARBALL := build/tools/mktarball.sh 215TUNE2FS := tune2fs 216E2FSCK := e2fsck 217JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar 218PROGUARD := external/proguard/bin/proguard.sh 219JAVATAGS := build/tools/java-event-log-tags.py 220DEXOPT := $(HOST_OUT_EXECUTABLES)/dexopt$(HOST_EXECUTABLE_SUFFIX) 221DEXPREOPT := dalvik/tools/dex-preopt 222 223# ACP is always for the build OS, not for the host OS 224ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX) 225 226# dx is java behind a shell script; no .exe necessary. 227DX := $(HOST_OUT_EXECUTABLES)/dx 228KCM := $(HOST_OUT_EXECUTABLES)/kcm$(HOST_EXECUTABLE_SUFFIX) 229ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX) 230FINDBUGS := prebuilt/common/findbugs/bin/findbugs 231LOCALIZE := $(HOST_OUT_EXECUTABLES)/localize$(HOST_EXECUTABLE_SUFFIX) 232EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX) 233 234# Binary prelinker/compressor tools 235APRIORI := $(HOST_OUT_EXECUTABLES)/apriori$(HOST_EXECUTABLE_SUFFIX) 236LSD := $(HOST_OUT_EXECUTABLES)/lsd$(HOST_EXECUTABLE_SUFFIX) 237 238# Deal with archaic version of bison on Mac OS X. 239ifeq ($(filter 1.28,$(shell $(YACC) -V)),) 240YACC_HEADER_SUFFIX:= .hpp 241else 242YACC_HEADER_SUFFIX:= .cpp.h 243endif 244 245# Don't use column under Windows, cygwin or not 246ifeq ($(HOST_OS),windows) 247COLUMN:= cat 248else 249COLUMN:= column 250endif 251 252dir := $(shell uname) 253ifeq ($(HOST_OS),windows) 254dir := $(HOST_OS) 255endif 256ifeq ($(HOST_OS),darwin) 257dir := $(HOST_OS)-$(HOST_ARCH) 258endif 259OLD_FLEX := prebuilt/$(HOST_PREBUILT_TAG)/flex/flex-2.5.4a$(HOST_EXECUTABLE_SUFFIX) 260 261ifeq ($(HOST_OS),darwin) 262# Mac OS' screwy version of java uses a non-standard directory layout 263# and doesn't even seem to have tools.jar. On the other hand, javac seems 264# to be able to magically find the classes in there, wherever they are, so 265# leave this blank 266HOST_JDK_TOOLS_JAR := 267else 268HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh) 269endif 270 271# Is the host JDK 64-bit version? 272HOST_JDK_IS_64BIT_VERSION := 273ifneq ($(filter 64-Bit, $(shell java -version 2>&1)),) 274HOST_JDK_IS_64BIT_VERSION := true 275endif 276 277# It's called md5 on Mac OS and md5sum on Linux 278ifeq ($(HOST_OS),darwin) 279MD5SUM:=md5 -q 280else 281MD5SUM:=md5sum 282endif 283 284# ############################################################### 285# Set up final options. 286# ############################################################### 287 288HOST_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS) 289HOST_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS) 290 291HOST_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS) 292HOST_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS) 293 294TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS) 295TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS) 296 297TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS) 298TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS) 299 300HOST_GLOBAL_LD_DIRS += -L$(HOST_OUT_INTERMEDIATE_LIBRARIES) 301TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES) 302 303HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS) 304TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) 305 306# Many host compilers don't support these flags, so we have to make 307# sure to only specify them for the target compilers checked in to 308# the source tree. The simulator passes the target flags to the 309# host compiler, so only set them for the target when the target 310# is not the simulator. 311ifneq ($(TARGET_SIMULATOR),true) 312TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS) 313TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS) 314endif 315 316HOST_GLOBAL_CFLAGS += $(HOST_RELEASE_CFLAGS) 317HOST_GLOBAL_CPPFLAGS += $(HOST_RELEASE_CPPFLAGS) 318 319TARGET_GLOBAL_CFLAGS += $(TARGET_RELEASE_CFLAGS) 320TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS) 321 322PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true) 323 324# ############################################################### 325# Collect a list of the SDK versions that we could compile against 326# For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE) 327# ############################################################### 328 329HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilt/sdk 330HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilt/ndk 331 332# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N. 333# The 'current' version is whatever this source tree is. 334# 335# sgrax is the opposite of xargs. It takes the list of args and puts them 336# on each line for sort to process. 337# sort -g is a numeric sort, so 1 2 3 10 instead of 1 10 2 3. 338 339# Numerically sort a list of numbers 340# $(1): the list of numbers to be sorted 341define numerically_sort 342$(shell function sgrax() { \ 343 while [ -n "$$1" ] ; do echo $$1 ; shift ; done \ 344 } ; \ 345 ( sgrax $(1) | sort -g ) ) 346endef 347 348TARGET_AVAILABLE_SDK_VERSIONS := current $(call numerically_sort,\ 349 $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \ 350 $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar))) 351 352TARGET_AVAILABLE_NDK_VERSIONS := $(call numerically_sort,\ 353 $(patsubst $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r%,%, \ 354 $(wildcard $(HISTORICAL_NDK_VERSIONS_ROOT)/android-ndk-r*))) 355 356INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.xml 357