config.mk revision 2ce495a0a7986fcd458954f1cae8cd1b030091d0
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 6ifdef ANDROID_BUILD_SHELL 7SHELL := $(ANDROID_BUILD_SHELL) 8else 9# Use bash, not whatever shell somebody has installed as /bin/sh 10# This is repeated from main.mk, since envsetup.sh runs this file 11# directly. 12SHELL := /bin/bash 13endif 14 15# Tell python not to spam the source tree with .pyc files. This 16# only has an effect on python 2.6 and above. 17export PYTHONDONTWRITEBYTECODE := 1 18 19# Standard source directories. 20SRC_DOCS:= $(TOPDIR)docs 21# TODO: Enforce some kind of layering; only add include paths 22# when a module links against a particular library. 23# TODO: See if we can remove most of these from the global list. 24SRC_HEADERS := \ 25 $(TOPDIR)system/core/include \ 26 $(TOPDIR)hardware/libhardware/include \ 27 $(TOPDIR)hardware/libhardware_legacy/include \ 28 $(TOPDIR)hardware/ril/include \ 29 $(TOPDIR)dalvik/libnativehelper/include \ 30 $(TOPDIR)frameworks/base/include \ 31 $(TOPDIR)frameworks/base/opengl/include \ 32 $(TOPDIR)external/skia/include 33SRC_HOST_HEADERS:=$(TOPDIR)tools/include 34SRC_LIBRARIES:= $(TOPDIR)libs 35SRC_SERVERS:= $(TOPDIR)servers 36SRC_TARGET_DIR := $(TOPDIR)build/target 37SRC_API_DIR := $(TOPDIR)frameworks/base/api 38 39# Some specific paths to tools 40SRC_DROIDDOC_DIR := $(TOPDIR)build/tools/droiddoc 41 42# Various mappings to avoid hard-coding paths all over the place 43include $(BUILD_SYSTEM)/pathmap.mk 44 45# ############################################################### 46# Build system internal files 47# ############################################################### 48 49BUILD_COMBOS:= $(BUILD_SYSTEM)/combo 50 51CLEAR_VARS:= $(BUILD_SYSTEM)/clear_vars.mk 52BUILD_HOST_STATIC_LIBRARY:= $(BUILD_SYSTEM)/host_static_library.mk 53BUILD_HOST_SHARED_LIBRARY:= $(BUILD_SYSTEM)/host_shared_library.mk 54BUILD_STATIC_LIBRARY:= $(BUILD_SYSTEM)/static_library.mk 55BUILD_RAW_STATIC_LIBRARY := $(BUILD_SYSTEM)/raw_static_library.mk 56BUILD_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mk 57BUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mk 58BUILD_RAW_EXECUTABLE:= $(BUILD_SYSTEM)/raw_executable.mk 59BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk 60BUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mk 61BUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mk 62BUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mk 63BUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mk 64BUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mk 65BUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mk 66BUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mk 67BUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mk 68BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk 69BUILD_KEY_CHAR_MAP := $(BUILD_SYSTEM)/key_char_map.mk 70 71# ############################################################### 72# Parse out any modifier targets. 73# ############################################################### 74 75# The 'showcommands' goal says to show the full command 76# lines being executed, instead of a short message about 77# the kind of operation being done. 78SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS)) 79 80 81# ############################################################### 82# Set common values 83# ############################################################### 84 85# These can be changed to modify both host and device modules. 86COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith 87COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG 88 89COMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promo 90COMMON_RELEASE_CPPFLAGS:= $(COMMON_RELEASE_CFLAGS) 91 92# Set the extensions used for various packages 93COMMON_PACKAGE_SUFFIX := .zip 94COMMON_JAVA_PACKAGE_SUFFIX := .jar 95COMMON_ANDROID_PACKAGE_SUFFIX := .apk 96 97# list of flags to turn specific warnings in to errors 98TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point 99 100# TODO: do symbol compression 101TARGET_COMPRESS_MODULE_SYMBOLS := false 102 103# Default is to prelink modules. 104TARGET_PRELINK_MODULE := true 105 106# ############################################################### 107# Include sub-configuration files 108# ############################################################### 109 110# --------------------------------------------------------------- 111# Try to include buildspec.mk, which will try to set stuff up. 112# If this file doesn't exist, the environemnt variables will 113# be used, and if that doesn't work, then the default is an 114# arm build 115-include $(TOPDIR)buildspec.mk 116 117# --------------------------------------------------------------- 118# Define most of the global variables. These are the ones that 119# are specific to the user's build configuration. 120include $(BUILD_SYSTEM)/envsetup.mk 121 122# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE) 123# or under vendor/*/$(TARGET_DEVICE). Search in both places, but 124# make sure only one exists. 125# Real boards should always be associated with an OEM vendor. 126board_config_mk := \ 127 $(strip $(wildcard \ 128 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \ 129 device/*/$(TARGET_DEVICE)/BoardConfig.mk \ 130 vendor/*/$(TARGET_DEVICE)/BoardConfig.mk \ 131 )) 132ifeq ($(board_config_mk),) 133 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE)) 134endif 135ifneq ($(words $(board_config_mk)),1) 136 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk)) 137endif 138include $(board_config_mk) 139TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk))) 140board_config_mk := 141 142# Clean up/verify variables defined by the board config file. 143TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME)) 144TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI)) 145ifeq ($(TARGET_CPU_ABI),) 146 $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk)) 147endif 148TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2)) 149 150# $(1): os/arch 151define select-android-config-h 152system/core/include/arch/$(1)/AndroidConfig.h 153endef 154 155combo_target := HOST_ 156include $(BUILD_SYSTEM)/combo/select.mk 157 158# on windows, the tools have .exe at the end, and we depend on the 159# host config stuff being done first 160 161combo_target := TARGET_ 162include $(BUILD_SYSTEM)/combo/select.mk 163 164# Pick a Java compiler. 165include $(BUILD_SYSTEM)/combo/javac.mk 166 167# --------------------------------------------------------------- 168# Check that the configuration is current. We check that 169# BUILD_ENV_SEQUENCE_NUMBER is current against this value. 170# Don't fail if we're called from envsetup, so they have a 171# chance to update their environment. 172 173ifeq (,$(strip $(CALLED_FROM_SETUP))) 174ifneq (,$(strip $(BUILD_ENV_SEQUENCE_NUMBER))) 175ifneq ($(BUILD_ENV_SEQUENCE_NUMBER),$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)) 176$(warning BUILD_ENV_SEQUENCE_NUMBER is set incorrectly.) 177$(info *** If you use envsetup/lunch/choosecombo:) 178$(info *** - Re-execute envsetup (". envsetup.sh")) 179$(info *** - Re-run lunch or choosecombo) 180$(info *** If you use buildspec.mk:) 181$(info *** - Look at buildspec.mk.default to see what has changed) 182$(info *** - Update BUILD_ENV_SEQUENCE_NUMBER to "$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)") 183$(error bailing..) 184endif 185endif 186endif 187 188 189# --------------------------------------------------------------- 190# Generic tools. 191 192LEX:= flex 193YACC:= bison -d 194DOXYGEN:= doxygen 195AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX) 196ACP := $(HOST_OUT_EXECUTABLES)/acp$(HOST_EXECUTABLE_SUFFIX) 197AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX) 198ICUDATA := $(HOST_OUT_EXECUTABLES)/icudata$(HOST_EXECUTABLE_SUFFIX) 199SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) 200MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX) 201MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX) 202MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX) 203MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/mkyaffs2image$(HOST_EXECUTABLE_SUFFIX) 204APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX) 205FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX) 206MKEXT2IMG := $(HOST_OUT_EXECUTABLES)/genext2fs$(HOST_EXECUTABLE_SUFFIX) 207MKEXT2BOOTIMG := external/genext2fs/mkbootimg_ext2.sh 208MKTARBALL := build/tools/mktarball.sh 209TUNE2FS := tune2fs 210E2FSCK := e2fsck 211JARJAR := java -jar $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar 212PROGUARD := external/proguard/bin/proguard.sh 213JAVATAGS := build/tools/java-event-log-tags.py 214 215# dx is java behind a shell script; no .exe necessary. 216DX := $(HOST_OUT_EXECUTABLES)/dx 217KCM := $(HOST_OUT_EXECUTABLES)/kcm$(HOST_EXECUTABLE_SUFFIX) 218ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX) 219FINDBUGS := prebuilt/common/findbugs/bin/findbugs 220LOCALIZE := $(HOST_OUT_EXECUTABLES)/localize$(HOST_EXECUTABLE_SUFFIX) 221EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX) 222 223# Binary prelinker/compressor tools 224APRIORI := $(HOST_OUT_EXECUTABLES)/apriori$(HOST_EXECUTABLE_SUFFIX) 225LSD := $(HOST_OUT_EXECUTABLES)/lsd$(HOST_EXECUTABLE_SUFFIX) 226SOSLIM := $(HOST_OUT_EXECUTABLES)/soslim$(HOST_EXECUTABLE_SUFFIX) 227 228# Deal with archaic version of bison on Mac OS X. 229ifeq ($(filter 1.28,$(shell $(YACC) -V)),) 230YACC_HEADER_SUFFIX:= .hpp 231else 232YACC_HEADER_SUFFIX:= .cpp.h 233endif 234 235# Don't use column under Windows, cygwin or not 236ifeq ($(HOST_OS),windows) 237COLUMN:= cat 238else 239COLUMN:= column 240endif 241 242dir := $(shell uname) 243ifeq ($(HOST_OS),windows) 244dir := $(HOST_OS) 245endif 246ifeq ($(HOST_OS),darwin) 247dir := $(HOST_OS)-$(HOST_ARCH) 248endif 249OLD_FLEX := prebuilt/$(HOST_PREBUILT_TAG)/flex/flex-2.5.4a$(HOST_EXECUTABLE_SUFFIX) 250 251ifeq ($(HOST_OS),darwin) 252# Mac OS' screwy version of java uses a non-standard directory layout 253# and doesn't even seem to have tools.jar. On the other hand, javac seems 254# to be able to magically find the classes in there, wherever they are, so 255# leave this blank 256HOST_JDK_TOOLS_JAR := 257else 258HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh) 259endif 260 261# It's called md5 on Mac OS and md5sum on Linux 262ifeq ($(HOST_OS),darwin) 263MD5SUM:=md5 -q 264else 265MD5SUM:=md5sum 266endif 267 268# ############################################################### 269# Set up final options. 270# ############################################################### 271 272HOST_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS) 273HOST_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS) 274 275HOST_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS) 276HOST_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS) 277 278TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS) 279TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS) 280 281TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS) 282TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS) 283 284HOST_GLOBAL_LD_DIRS += -L$(HOST_OUT_INTERMEDIATE_LIBRARIES) 285TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES) 286 287HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS) 288TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) 289 290# Many host compilers don't support these flags, so we have to make 291# sure to only specify them for the target compilers checked in to 292# the source tree. The simulator passes the target flags to the 293# host compiler, so only set them for the target when the target 294# is not the simulator. 295ifneq ($(TARGET_SIMULATOR),true) 296TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS) 297TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS) 298endif 299 300HOST_GLOBAL_CFLAGS += $(HOST_RELEASE_CFLAGS) 301HOST_GLOBAL_CPPFLAGS += $(HOST_RELEASE_CPPFLAGS) 302 303TARGET_GLOBAL_CFLAGS += $(TARGET_RELEASE_CFLAGS) 304TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS) 305 306PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true) 307 308# ############################################################### 309# Collect a list of the SDK versions that we could compile against 310# For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE) 311# ############################################################### 312 313# The files that we can convert into android.jars are are in config/api/*.xml 314# The 'current' version is whatever this source tree is. Once the apicheck 315# tool can generate the stubs from the xml files, we'll use that to be 316# able to build back-versions. In the meantime, 'current' is the only 317# one supported. 318# 319# sgrax is the opposite of xargs. It takes the list of args and puts them 320# on each line for sort to process. 321# sort -g is a numeric sort, so 1 2 3 10 instead of 1 10 2 3. 322TARGET_AVAILABLE_SDK_VERSIONS := current \ 323 $(shell function sgrax() { \ 324 while [ -n "$$1" ] ; do echo $$1 ; shift ; done \ 325 } ; \ 326 ( sgrax $(patsubst $(SRC_API_DIR)/%.xml,%, \ 327 $(filter-out $(SRC_API_DIR)/current.xml, \ 328 $(shell find $(SRC_API_DIR) -name "*.xml"))) | sort -g ) ) 329 330 331INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.xml 332