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