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