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