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