main.mk revision c1f17ffc7d4fa6225274b9f8007d6f7fae03ab08
1# Only use ANDROID_BUILD_SHELL to wrap around bash.
2# DO NOT use other shells such as zsh.
3ifdef ANDROID_BUILD_SHELL
4SHELL := $(ANDROID_BUILD_SHELL)
5else
6# Use bash, not whatever shell somebody has installed as /bin/sh
7# This is repeated in config.mk, since envsetup.sh runs that file
8# directly.
9SHELL := /bin/bash
10endif
11
12# this turns off the suffix rules built into make
13.SUFFIXES:
14
15# this turns off the RCS / SCCS implicit rules of GNU Make
16% : RCS/%,v
17% : RCS/%
18% : %,v
19% : s.%
20% : SCCS/s.%
21
22# If a rule fails, delete $@.
23.DELETE_ON_ERROR:
24
25# Figure out where we are.
26#TOP := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
27#TOP := $(patsubst %/,%,$(TOP))
28
29# TOPDIR is the normal variable you should use, because
30# if we are executing relative to the current directory
31# it can be "", whereas TOP must be "." which causes
32# pattern matching problems when make strips off the
33# trailing "./" from paths in various places.
34#ifeq ($(TOP),.)
35#TOPDIR :=
36#else
37#TOPDIR := $(TOP)/
38#endif
39
40# Check for broken versions of make.
41ifneq (1,$(strip $(shell expr $(MAKE_VERSION) \>= 3.81)))
42$(warning ********************************************************************************)
43$(warning *  You are using version $(MAKE_VERSION) of make.)
44$(warning *  Android can only be built by versions 3.81 and higher.)
45$(warning *  see https://source.android.com/source/download.html)
46$(warning ********************************************************************************)
47$(error stopping)
48endif
49
50# Absolute path of the present working direcotry.
51# This overrides the shell variable $PWD, which does not necessarily points to
52# the top of the source tree, for example when "make -C" is used in m/mm/mmm.
53PWD := $(shell pwd)
54
55TOP := .
56TOPDIR :=
57
58BUILD_SYSTEM := $(TOPDIR)build/core
59
60# This is the default target.  It must be the first declared target.
61.PHONY: droid
62DEFAULT_GOAL := droid
63$(DEFAULT_GOAL): droid_targets
64
65.PHONY: droid_targets
66droid_targets:
67
68# Used to force goals to build.  Only use for conditionally defined goals.
69.PHONY: FORCE
70FORCE:
71
72# These goals don't need to collect and include Android.mks/CleanSpec.mks
73# in the source tree.
74dont_bother_goals := clean clobber dataclean installclean \
75    help out \
76    snod systemimage-nodeps \
77    stnod systemtarball-nodeps \
78    userdataimage-nodeps userdatatarball-nodeps \
79    cacheimage-nodeps \
80    bptimage-nodeps \
81    vendorimage-nodeps \
82    ramdisk-nodeps \
83    bootimage-nodeps \
84    recoveryimage-nodeps \
85    vbmetaimage-nodeps \
86    product-graph dump-products
87
88ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),)
89dont_bother := true
90endif
91
92ORIGINAL_MAKECMDGOALS := $(MAKECMDGOALS)
93
94# Targets that provide quick help on the build system.
95include $(BUILD_SYSTEM)/help.mk
96
97# Set up various standard variables based on configuration
98# and host information.
99include $(BUILD_SYSTEM)/config.mk
100
101ifndef KATI
102ifdef USE_NINJA
103$(warning USE_NINJA is ignored. Ninja is always used.)
104endif
105
106# Mark this is a ninja build.
107$(shell mkdir -p $(OUT_DIR) && touch $(OUT_DIR)/ninja_build)
108include build/core/ninja.mk
109else # KATI
110
111include $(SOONG_MAKEVARS_MK)
112
113# Write the build number to a file so it can be read back in
114# without changing the command line every time.  Avoids rebuilds
115# when using ninja.
116$(shell mkdir -p $(OUT_DIR) && \
117    echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt && \
118    echo -n $(BUILD_DATETIME) > $(OUT_DIR)/build_date.txt)
119BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
120BUILD_DATETIME_FROM_FILE := $$(cat $(OUT_DIR)/build_date.txt)
121ifeq ($(HOST_OS),darwin)
122DATE_FROM_FILE := date -r $(BUILD_DATETIME_FROM_FILE)
123else
124DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE)
125endif
126
127# CTS-specific config.
128-include cts/build/config.mk
129# VTS-specific config.
130-include test/vts/tools/vts-tradefed/build/config.mk
131
132# This allows us to force a clean build - included after the config.mk
133# environment setup is done, but before we generate any dependencies.  This
134# file does the rm -rf inline so the deps which are all done below will
135# be generated correctly
136include $(BUILD_SYSTEM)/cleanbuild.mk
137
138# Include the google-specific config
139-include vendor/google/build/config.mk
140
141VERSION_CHECK_SEQUENCE_NUMBER := 6
142JAVA_NOT_REQUIRED_CHECKED :=
143-include $(OUT_DIR)/versions_checked.mk
144ifneq ($(VERSION_CHECK_SEQUENCE_NUMBER)$(JAVA_NOT_REQUIRED),$(VERSIONS_CHECKED)$(JAVA_NOT_REQUIRED_CHECKED))
145
146$(info Checking build tools versions...)
147
148# check for a case sensitive file system
149ifneq (a,$(shell mkdir -p $(OUT_DIR) ; \
150                echo a > $(OUT_DIR)/casecheck.txt; \
151                    echo B > $(OUT_DIR)/CaseCheck.txt; \
152                cat $(OUT_DIR)/casecheck.txt))
153$(warning ************************************************************)
154$(warning You are building on a case-insensitive filesystem.)
155$(warning Please move your source tree to a case-sensitive filesystem.)
156$(warning ************************************************************)
157$(error Case-insensitive filesystems not supported)
158endif
159
160# Make sure that there are no spaces in the absolute path; the
161# build system can't deal with them.
162ifneq ($(words $(shell pwd)),1)
163$(warning ************************************************************)
164$(warning You are building in a directory whose absolute path contains)
165$(warning a space character:)
166$(warning $(space))
167$(warning "$(shell pwd)")
168$(warning $(space))
169$(warning Please move your source tree to a path that does not contain)
170$(warning any spaces.)
171$(warning ************************************************************)
172$(error Directory names containing spaces not supported)
173endif
174
175ifneq ($(JAVA_NOT_REQUIRED),true)
176java_version_str := $(shell unset _JAVA_OPTIONS && java -version 2>&1)
177javac_version_str := $(shell unset _JAVA_OPTIONS && javac -version 2>&1)
178
179# Check for the correct version of java, should be 1.8 by
180# default and only 1.7 if LEGACY_USE_JAVA7 is set.
181ifeq ($(LEGACY_USE_JAVA7),) # if LEGACY_USE_JAVA7 == ''
182required_version := "1.8.x"
183required_javac_version := "1.8"
184java_version := $(shell echo '$(java_version_str)' | grep '[ "]1\.8[\. "$$]')
185javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.8[\. "$$]')
186else
187required_version := "1.7.x"
188required_javac_version := "1.7"
189java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.7[\. "$$]')
190javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.7[\. "$$]')
191endif # if LEGACY_USE_JAVA7 == ''
192
193ifeq ($(strip $(java_version)),)
194$(info ************************************************************)
195$(info You are attempting to build with the incorrect version)
196$(info of java.)
197$(info $(space))
198$(info Your version is: $(java_version_str).)
199$(info The required version is: $(required_version))
200$(info $(space))
201$(info Please follow the machine setup instructions at)
202$(info $(space)$(space)$(space)$(space)https://source.android.com/source/initializing.html)
203$(info ************************************************************)
204$(error stop)
205endif
206
207# Check for the current JDK.
208#
209# For Java 1.7/1.8, we require OpenJDK on linux and Oracle JDK on Mac OS.
210requires_openjdk := false
211ifeq ($(BUILD_OS),linux)
212requires_openjdk := true
213endif
214
215
216# Check for the current jdk
217ifeq ($(requires_openjdk), true)
218# The user asked for openjdk, so check that the host
219# java version is really openjdk and not some other JDK.
220ifeq ($(shell echo '$(java_version_str)' | grep -i openjdk),)
221$(info ************************************************************)
222$(info You asked for an OpenJDK based build but your version is)
223$(info $(java_version_str).)
224$(info ************************************************************)
225$(error stop)
226endif # java version is not OpenJdk
227else # if requires_openjdk
228ifneq ($(shell echo '$(java_version_str)' | grep -i openjdk),)
229$(info ************************************************************)
230$(info You are attempting to build with an unsupported JDK.)
231$(info $(space))
232$(info You use OpenJDK but only Sun/Oracle JDK is supported.)
233$(info Please follow the machine setup instructions at)
234$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
235$(info ************************************************************)
236$(error stop)
237endif # java version is not Sun Oracle JDK
238endif # if requires_openjdk
239
240KNOWN_INCOMPATIBLE_JAVAC_VERSIONS := google
241incompat_javac := $(foreach v,$(KNOWN_INCOMPATIBLE_JAVAC_VERSIONS),$(findstring $(v),$(javac_version_str)))
242ifneq ($(incompat_javac),)
243javac_version :=
244endif
245
246# Check for the correct version of javac
247ifeq ($(strip $(javac_version)),)
248$(info ************************************************************)
249$(info You are attempting to build with the incorrect version)
250$(info of javac.)
251$(info $(space))
252$(info Your version is: $(javac_version_str).)
253ifneq ($(incompat_javac),)
254$(info This '$(incompat_javac)' version is not supported for Android platform builds.)
255$(info Use a publicly available JDK and make sure you have run envsetup.sh / lunch.)
256else
257$(info The required version is: $(required_javac_version))
258endif
259$(info $(space))
260$(info Please follow the machine setup instructions at)
261$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
262$(info ************************************************************)
263$(error stop)
264endif
265
266endif # if JAVA_NOT_REQUIRED
267
268ifndef BUILD_EMULATOR
269  # Emulator binaries are now provided under prebuilts/android-emulator/
270  BUILD_EMULATOR := false
271endif
272
273$(shell echo 'VERSIONS_CHECKED := $(VERSION_CHECK_SEQUENCE_NUMBER)' \
274        > $(OUT_DIR)/versions_checked.mk)
275$(shell echo 'BUILD_EMULATOR ?= $(BUILD_EMULATOR)' \
276        >> $(OUT_DIR)/versions_checked.mk)
277$(shell echo 'JAVA_NOT_REQUIRED_CHECKED := $(JAVA_NOT_REQUIRED)' \
278        >> $(OUT_DIR)/versions_checked.mk)
279endif
280
281# These are the modifier targets that don't do anything themselves, but
282# change the behavior of the build.
283# (must be defined before including definitions.make)
284INTERNAL_MODIFIER_TARGETS := showcommands all
285
286# EMMA_INSTRUMENT_STATIC merges the static emma library to each emma-enabled module.
287ifeq (true,$(EMMA_INSTRUMENT_STATIC))
288EMMA_INSTRUMENT := true
289endif
290
291# Bring in standard build system definitions.
292include $(BUILD_SYSTEM)/definitions.mk
293
294# Bring in dex_preopt.mk
295include $(BUILD_SYSTEM)/dex_preopt.mk
296
297ifneq ($(filter user userdebug eng,$(MAKECMDGOALS)),)
298$(info ***************************************************************)
299$(info ***************************************************************)
300$(info Do not pass '$(filter user userdebug eng,$(MAKECMDGOALS))' on \
301       the make command line.)
302$(info Set TARGET_BUILD_VARIANT in buildspec.mk, or use lunch or)
303$(info choosecombo.)
304$(info ***************************************************************)
305$(info ***************************************************************)
306$(error stopping)
307endif
308
309ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),)
310$(info ***************************************************************)
311$(info ***************************************************************)
312$(info Invalid variant: $(TARGET_BUILD_VARIANT))
313$(info Valid values are: $(INTERNAL_VALID_VARIANTS))
314$(info ***************************************************************)
315$(info ***************************************************************)
316$(error stopping)
317endif
318
319# -----------------------------------------------------------------
320# Variable to check java support level inside PDK build.
321# Not necessary if the components is not in PDK.
322# not defined : not supported
323# "sdk" : sdk API only
324# "platform" : platform API supproted
325TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
326
327# -----------------------------------------------------------------
328# The pdk (Platform Development Kit) build
329include build/core/pdk_config.mk
330
331#
332# -----------------------------------------------------------------
333# Jack version configuration
334-include $(TOPDIR)prebuilts/sdk/tools/jack_versions.mk
335-include $(TOPDIR)prebuilts/sdk/tools/jack_for_module.mk
336
337#
338# -----------------------------------------------------------------
339# Install and start Jack server
340-include $(TOPDIR)prebuilts/sdk/tools/jack_server_setup.mk
341
342#
343# -----------------------------------------------------------------
344# Jacoco package name for Jack
345-include $(TOPDIR)external/jacoco/config.mk
346
347#
348# -----------------------------------------------------------------
349# Enable dynamic linker developer warnings for all builds except
350# final release.
351ifneq ($(PLATFORM_VERSION_CODENAME),REL)
352  ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1
353endif
354
355# -----------------------------------------------------------------
356###
357### In this section we set up the things that are different
358### between the build variants
359###
360
361is_sdk_build :=
362
363ifneq ($(filter sdk win_sdk sdk_addon,$(MAKECMDGOALS)),)
364is_sdk_build := true
365endif
366
367# Add build properties for ART. These define system properties used by installd
368# to pass flags to dex2oat.
369ADDITIONAL_BUILD_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so
370ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT)
371ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
372  ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
373endif
374
375ifdef TARGET_2ND_ARCH
376  ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT)
377  ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
378    ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
379  endif
380endif
381
382## user/userdebug ##
383
384user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))
385enable_target_debugging := true
386tags_to_install :=
387ifneq (,$(user_variant))
388  # Target is secure in user builds.
389  ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
390  ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1
391
392  ifeq ($(user_variant),user)
393    ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1
394  endif
395
396  ifeq ($(user_variant),userdebug)
397    # Pick up some extra useful tools
398    tags_to_install += debug
399  else
400    # Disable debugging in plain user builds.
401    enable_target_debugging :=
402  endif
403
404  # Disallow mock locations by default for user builds
405  ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=0
406
407else # !user_variant
408  # Turn on checkjni for non-user builds.
409  ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
410  # Set device insecure for non-user builds.
411  ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
412  # Allow mock locations by default for non user builds
413  ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1
414endif # !user_variant
415
416ifeq (true,$(strip $(enable_target_debugging)))
417  # Target is more debuggable and adbd is on by default
418  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
419  # Enable Dalvik lock contention logging.
420  ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500
421  # Include the debugging/testing OTA keys in this build.
422  INCLUDE_TEST_OTA_KEYS := true
423else # !enable_target_debugging
424  # Target is less debuggable and adbd is off by default
425  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
426endif # !enable_target_debugging
427
428## eng ##
429
430ifeq ($(TARGET_BUILD_VARIANT),eng)
431tags_to_install := debug eng
432ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))),)
433  # Don't require the setup wizard on eng builds
434  ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
435          $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))) \
436          ro.setupwizard.mode=OPTIONAL
437endif
438ifndef is_sdk_build
439  # To speedup startup of non-preopted builds, don't verify or compile the boot image.
440  ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter=verify-at-runtime
441endif
442endif
443
444## sdk ##
445
446ifdef is_sdk_build
447
448# Detect if we want to build a repository for the SDK
449sdk_repo_goal := $(strip $(filter sdk_repo,$(MAKECMDGOALS)))
450MAKECMDGOALS := $(strip $(filter-out sdk_repo,$(MAKECMDGOALS)))
451
452ifneq ($(words $(sort $(filter-out $(INTERNAL_MODIFIER_TARGETS) checkbuild emulator_tests target-files-package,$(MAKECMDGOALS)))),1)
453$(error The 'sdk' target may not be specified with any other targets)
454endif
455
456# AUX dependencies are already added by now; remove triggers from the MAKECMDGOALS
457MAKECMDGOALS := $(strip $(filter-out AUX-%,$(MAKECMDGOALS)))
458
459# TODO: this should be eng I think.  Since the sdk is built from the eng
460# variant.
461tags_to_install := debug eng
462ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
463ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
464else # !sdk
465endif
466
467BUILD_WITHOUT_PV := true
468
469ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
470
471# enable vm tracing in files for now to help track
472# the cause of ANRs in the content process
473ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt
474
475# ------------------------------------------------------------
476# Define a function that, given a list of module tags, returns
477# non-empty if that module should be installed in /system.
478
479# For most goals, anything not tagged with the "tests" tag should
480# be installed in /system.
481define should-install-to-system
482$(if $(filter tests,$(1)),,true)
483endef
484
485ifdef is_sdk_build
486# For the sdk goal, anything with the "samples" tag should be
487# installed in /data even if that module also has "eng"/"debug"/"user".
488define should-install-to-system
489$(if $(filter samples tests,$(1)),,true)
490endef
491endif
492
493
494# If they only used the modifier goals (showcommands, etc), we'll actually
495# build the default target.
496ifeq ($(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS)),)
497.PHONY: $(INTERNAL_MODIFIER_TARGETS)
498$(INTERNAL_MODIFIER_TARGETS): $(DEFAULT_GOAL)
499endif
500
501#
502# Typical build; include any Android.mk files we can find.
503#
504
505FULL_BUILD := true
506
507# Before we go and include all of the module makefiles, mark the PRODUCT_*
508# values readonly so that they won't be modified.
509$(call readonly-product-vars)
510
511ifneq ($(ONE_SHOT_MAKEFILE),)
512# We've probably been invoked by the "mm" shell function
513# with a subdirectory's makefile.
514include $(SOONG_ANDROID_MK) $(wildcard $(ONE_SHOT_MAKEFILE))
515# Change CUSTOM_MODULES to include only modules that were
516# defined by this makefile; this will install all of those
517# modules as a side-effect.  Do this after including ONE_SHOT_MAKEFILE
518# so that the modules will be installed in the same place they
519# would have been with a normal make.
520CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS)))
521FULL_BUILD :=
522# Stub out the notice targets, which probably aren't defined
523# when using ONE_SHOT_MAKEFILE.
524NOTICE-HOST-%: ;
525NOTICE-TARGET-%: ;
526
527# A helper goal printing out install paths
528define register_module_install_path
529.PHONY: GET-MODULE-INSTALL-PATH-$(1)
530GET-MODULE-INSTALL-PATH-$(1):
531	echo 'INSTALL-PATH: $(1) $(ALL_MODULES.$(1).INSTALLED)'
532endef
533
534SORTED_ALL_MODULES := $(sort $(ALL_MODULES))
535UNIQUE_ALL_MODULES :=
536$(foreach m,$(SORTED_ALL_MODULES),\
537    $(if $(call streq,$(m),$(lastword $(UNIQUE_ALL_MODULES))),,\
538        $(eval UNIQUE_ALL_MODULES += $(m))))
539SORTED_ALL_MODULES :=
540
541$(foreach mod,$(UNIQUE_ALL_MODULES),$(if $(ALL_MODULES.$(mod).INSTALLED),\
542    $(eval $(call register_module_install_path,$(mod)))\
543    $(foreach path,$(ALL_MODULES.$(mod).PATH),\
544        $(eval my_path_prefix := GET-INSTALL-PATH-IN)\
545        $(foreach component,$(subst /,$(space),$(path)),\
546            $(eval my_path_prefix := $$(my_path_prefix)-$$(component))\
547            $(eval .PHONY: $$(my_path_prefix))\
548            $(eval $$(my_path_prefix): GET-MODULE-INSTALL-PATH-$(mod))))))
549UNIQUE_ALL_MODULES :=
550
551else # ONE_SHOT_MAKEFILE
552
553ifneq ($(dont_bother),true)
554#
555# Include all of the makefiles in the system
556#
557
558subdir_makefiles := $(SOONG_ANDROID_MK) $(call first-makefiles-under,$(TOP))
559
560$(foreach mk,$(subdir_makefiles),$(info including $(mk) ...)$(eval include $(mk)))
561
562ifdef PDK_FUSION_PLATFORM_ZIP
563# Bring in the PDK platform.zip modules.
564include $(BUILD_SYSTEM)/pdk_fusion_modules.mk
565endif # PDK_FUSION_PLATFORM_ZIP
566
567endif # dont_bother
568
569endif # ONE_SHOT_MAKEFILE
570
571# Now with all Android.mks loaded we can do post cleaning steps.
572include $(BUILD_SYSTEM)/post_clean.mk
573
574# -------------------------------------------------------------------
575# All module makefiles have been included at this point.
576# -------------------------------------------------------------------
577
578
579# -------------------------------------------------------------------
580# Fix up CUSTOM_MODULES to refer to installed files rather than
581# just bare module names.  Leave unknown modules alone in case
582# they're actually full paths to a particular file.
583known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES))
584unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES))
585CUSTOM_MODULES := \
586	$(call module-installed-files,$(known_custom_modules)) \
587	$(unknown_custom_modules)
588
589# -------------------------------------------------------------------
590# Define dependencies for modules that require other modules.
591# This can only happen now, after we've read in all module makefiles.
592#
593# TODO: deal with the fact that a bare module name isn't
594# unambiguous enough.  Maybe declare short targets like
595# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
596# BUG: the system image won't know to depend on modules that are
597# brought in as requirements of other modules.
598#
599# Resolve the required module name to 32-bit or 64-bit variant.
600# Get a list of corresponding 32-bit module names, if one exists.
601ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
602define get-32-bit-modules
603$(sort $(foreach m,$(1),\
604  $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),\
605    $(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX))\
606  $(if $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),\
607    $(m)$(HOST_2ND_ARCH_MODULE_SUFFIX))\
608    ))
609endef
610# Get a list of corresponding 32-bit module names, if one exists;
611# otherwise return the original module name
612define get-32-bit-modules-if-we-can
613$(sort $(foreach m,$(1),\
614  $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS)$(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),\
615    $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX)) \
616    $(if $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX)),\
617  $(m))))
618endef
619else  # TARGET_TRANSLATE_2ND_ARCH
620# For binary translation config, by default only install the first arch.
621define get-32-bit-modules
622endef
623
624define get-32-bit-modules-if-we-can
625$(strip $(1))
626endef
627endif  # TARGET_TRANSLATE_2ND_ARCH
628
629# If a module is for a cross host os, the required modules must be for
630# that OS too.
631# If a module is built for 32-bit, the required modules must be 32-bit too;
632# Otherwise if the module is an exectuable or shared library,
633#   the required modules must be 64-bit;
634#   otherwise we require both 64-bit and 32-bit variant, if one exists.
635$(foreach m,$(ALL_MODULES),\
636  $(eval r := $(ALL_MODULES.$(m).REQUIRED))\
637  $(if $(r),\
638    $(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),\
639      $(eval r := $(addprefix host_cross_,$(r))))\
640    $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
641      $(eval r_r := $(call get-32-bit-modules-if-we-can,$(r))),\
642      $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\
643        $(eval r_r := $(r)),\
644        $(eval r_r := $(r) $(call get-32-bit-modules,$(r)))\
645       )\
646     )\
647     $(eval ALL_MODULES.$(m).REQUIRED := $(strip $(r_r)))\
648  )\
649)
650r_r :=
651
652define add-required-deps
653$(1): | $(2)
654endef
655
656# Use a normal dependency instead of an order-only dependency when installing
657# host dynamic binaries so that the timestamp of the final binary always
658# changes, even if the toc optimization has skipped relinking the binary
659# and its dependant shared libraries.
660define add-required-host-so-deps
661$(1): $(2)
662endef
663
664$(foreach m,$(ALL_MODULES), \
665  $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
666  $(if $(r), \
667    $(eval r := $(call module-installed-files,$(r))) \
668    $(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
669    $(eval h_m := $(filter $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
670    $(eval hc_m := $(filter $(HOST_CROSS_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
671    $(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \
672    $(eval h_r := $(filter $(HOST_OUT)/%, $(r))) \
673    $(eval hc_r := $(filter $(HOST_CROSS_OUT)/%, $(r))) \
674    $(eval t_m := $(filter-out $(t_r), $(t_m))) \
675    $(eval h_m := $(filter-out $(h_r), $(h_m))) \
676    $(eval hc_m := $(filter-out $(hc_r), $(hc_m))) \
677    $(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \
678    $(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \
679    $(if $(hc_m), $(eval $(call add-required-deps, $(hc_m),$(hc_r)))) \
680   ) \
681 )
682
683t_m :=
684h_m :=
685hc_m :=
686t_r :=
687h_r :=
688hc_r :=
689
690# Establish the dependecies on the shared libraries.
691# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED,
692# so they can be expanded to product_MODULES later.
693# $(1): TARGET_ or HOST_ or HOST_CROSS_.
694# $(2): non-empty for 2nd arch.
695# $(3): non-empty for host cross compile.
696define resolve-shared-libs-depes
697$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\
698  $(eval p := $(subst :,$(space),$(m)))\
699  $(eval mod := $(firstword $(p)))\
700  $(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\
701  $(eval root := $(1)OUT$(if $(call streq,$(1),TARGET_),_ROOT))\
702  $(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\
703  $(if $(3),$(eval deps := $(addprefix host_cross_,$(deps))))\
704  $(eval r := $(filter $($(root))/%,$(call module-installed-files,\
705    $(deps))))\
706  $(if $(filter $(1),HOST_),\
707    $(eval $(call add-required-host-so-deps,$(word 2,$(p)),$(r))),\
708    $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))\
709  $(eval ALL_MODULES.$(mod).REQUIRED += $(deps)))
710endef
711
712$(call resolve-shared-libs-depes,TARGET_)
713ifdef TARGET_2ND_ARCH
714$(call resolve-shared-libs-depes,TARGET_,true)
715endif
716$(call resolve-shared-libs-depes,HOST_)
717ifdef HOST_2ND_ARCH
718$(call resolve-shared-libs-depes,HOST_,true)
719endif
720ifdef HOST_CROSS_OS
721$(call resolve-shared-libs-depes,HOST_CROSS_,,true)
722endif
723
724m :=
725r :=
726p :=
727deps :=
728add-required-deps :=
729
730# -------------------------------------------------------------------
731# Figure out our module sets.
732#
733# Of the modules defined by the component makefiles,
734# determine what we actually want to build.
735
736###########################################################
737## Expand a module name list with REQUIRED modules
738###########################################################
739# $(1): The variable name that holds the initial module name list.
740#       the variable will be modified to hold the expanded results.
741# $(2): The initial module name list.
742# Returns empty string (maybe with some whitespaces).
743define expand-required-modules
744$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
745  $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
746$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
747  $(call expand-required-modules,$(1),$(_erm_new_modules)))
748endef
749
750ifdef FULL_BUILD
751  # The base list of modules to build for this product is specified
752  # by the appropriate product definition file, which was included
753  # by product_config.mk.
754  product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
755  # Filter out the overridden packages before doing expansion
756  product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
757      $(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
758
759  # Resolve the :32 :64 module name
760  modules_32 := $(patsubst %:32,%,$(filter %:32, $(product_MODULES)))
761  modules_64 := $(patsubst %:64,%,$(filter %:64, $(product_MODULES)))
762  modules_rest := $(filter-out %:32 %:64,$(product_MODULES))
763  # Note for 32-bit product, $(modules_32) and $(modules_64) will be
764  # added as their original module names.
765  product_MODULES := $(call get-32-bit-modules-if-we-can, $(modules_32))
766  product_MODULES += $(modules_64)
767  # For the rest we add both
768  product_MODULES += $(call get-32-bit-modules, $(modules_rest))
769  product_MODULES += $(modules_rest)
770
771  $(call expand-required-modules,product_MODULES,$(product_MODULES))
772
773  product_FILES := $(call module-installed-files, $(product_MODULES))
774  ifeq (0,1)
775    $(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
776    $(foreach p,$(product_FILES),$(info :   $(p)))
777    $(error done)
778  endif
779else
780  # We're not doing a full build, and are probably only including
781  # a subset of the module makefiles.  Don't try to build any modules
782  # requested by the product, because we probably won't have rules
783  # to build them.
784  product_FILES :=
785endif
786
787eng_MODULES := $(sort \
788        $(call get-tagged-modules,eng) \
789        $(call module-installed-files, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_ENG)) \
790    )
791debug_MODULES := $(sort \
792        $(call get-tagged-modules,debug) \
793        $(call module-installed-files, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_DEBUG)) \
794    )
795tests_MODULES := $(sort \
796        $(call get-tagged-modules,tests) \
797        $(call module-installed-files, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_TESTS)) \
798    )
799
800# TODO: Remove the 3 places in the tree that use ALL_DEFAULT_INSTALLED_MODULES
801# and get rid of it from this list.
802modules_to_install := $(sort \
803    $(ALL_DEFAULT_INSTALLED_MODULES) \
804    $(product_FILES) \
805    $(foreach tag,$(tags_to_install),$($(tag)_MODULES)) \
806    $(CUSTOM_MODULES) \
807  )
808
809# Some packages may override others using LOCAL_OVERRIDES_PACKAGES.
810# Filter out (do not install) any overridden packages.
811overridden_packages := $(call get-package-overrides,$(modules_to_install))
812ifdef overridden_packages
813#  old_modules_to_install := $(modules_to_install)
814  modules_to_install := \
815      $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk %/$(p).odex), \
816          $(modules_to_install))
817endif
818#$(error filtered out
819#           $(filter-out $(modules_to_install),$(old_modules_to_install)))
820
821# Don't include any GNU General Public License shared objects or static
822# libraries in SDK images.  GPL executables (not static/dynamic libraries)
823# are okay if they don't link against any closed source libraries (directly
824# or indirectly)
825
826# It's ok (and necessary) to build the host tools, but nothing that's
827# going to be installed on the target (including static libraries).
828
829ifdef is_sdk_build
830  target_gnu_MODULES := \
831              $(filter \
832                      $(TARGET_OUT_INTERMEDIATES)/% \
833                      $(TARGET_OUT)/% \
834                      $(TARGET_OUT_DATA)/%, \
835                              $(sort $(call get-tagged-modules,gnu)))
836  target_gnu_MODULES := $(filter-out $(TARGET_OUT_EXECUTABLES)/%,$(target_gnu_MODULES))
837  $(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d)))
838  modules_to_install := \
839              $(filter-out $(target_gnu_MODULES),$(modules_to_install))
840
841  # Ensure every module listed in PRODUCT_PACKAGES* gets something installed
842  # TODO: Should we do this for all builds and not just the sdk?
843  dangling_modules :=
844  $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES), \
845    $(if $(strip $(ALL_MODULES.$(m).INSTALLED) $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).INSTALLED)),,\
846      $(eval dangling_modules += $(m))))
847  ifneq ($(dangling_modules),)
848    $(warning: Modules '$(dangling_modules)' in PRODUCT_PACKAGES have nothing to install!)
849  endif
850  $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_DEBUG), \
851    $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\
852      $(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_DEBUG has nothing to install!)))
853  $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_ENG), \
854    $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\
855      $(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_ENG has nothing to install!)))
856  $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_TESTS), \
857    $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\
858      $(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_TESTS has nothing to install!)))
859endif
860
861# build/core/Makefile contains extra stuff that we don't want to pollute this
862# top-level makefile with.  It expects that ALL_DEFAULT_INSTALLED_MODULES
863# contains everything that's built during the current make, but it also further
864# extends ALL_DEFAULT_INSTALLED_MODULES.
865ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_install)
866include $(BUILD_SYSTEM)/Makefile
867modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES))
868ALL_DEFAULT_INSTALLED_MODULES :=
869
870
871# These are additional goals that we build, in order to make sure that there
872# is as little code as possible in the tree that doesn't build.
873modules_to_check := $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).CHECKED))
874
875# If you would like to build all goals, and not skip any intermediate
876# steps, you can pass the "all" modifier goal on the commandline.
877ifneq ($(filter all,$(MAKECMDGOALS)),)
878modules_to_check += $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).BUILT))
879endif
880
881# for easier debugging
882modules_to_check := $(sort $(modules_to_check))
883#$(error modules_to_check $(modules_to_check))
884
885# -------------------------------------------------------------------
886# This is used to to get the ordering right, you can also use these,
887# but they're considered undocumented, so don't complain if their
888# behavior changes.
889# An internal target that depends on all copied headers
890# (see copy_headers.make).  Other targets that need the
891# headers to be copied first can depend on this target.
892.PHONY: all_copied_headers
893all_copied_headers: ;
894
895$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers
896
897# All the droid stuff, in directories
898.PHONY: files
899files: $(modules_to_install) \
900       $(INSTALLED_ANDROID_INFO_TXT_TARGET)
901
902# -------------------------------------------------------------------
903
904.PHONY: checkbuild
905checkbuild: $(modules_to_check) droid_targets
906checkbuild: checkbuild-soong
907
908ifeq (true,$(ANDROID_BUILD_EVERYTHING_BY_DEFAULT))
909droid: checkbuild
910endif
911
912.PHONY: ramdisk
913ramdisk: $(INSTALLED_RAMDISK_TARGET)
914
915.PHONY: systemtarball
916systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
917
918.PHONY: boottarball
919boottarball: $(INSTALLED_BOOTTARBALL_TARGET)
920
921.PHONY: userdataimage
922userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
923
924ifneq (,$(filter userdataimage, $(MAKECMDGOALS)))
925$(call dist-for-goals, userdataimage, $(BUILT_USERDATAIMAGE_TARGET))
926endif
927
928.PHONY: userdatatarball
929userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
930
931.PHONY: cacheimage
932cacheimage: $(INSTALLED_CACHEIMAGE_TARGET)
933
934.PHONY: bptimage
935bptimage: $(INSTALLED_BPTIMAGE_TARGET)
936
937.PHONY: vendorimage
938vendorimage: $(INSTALLED_VENDORIMAGE_TARGET)
939
940.PHONY: bootimage
941bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
942
943.PHONY: vbmetaimage
944vbmetaimage: $(INSTALLED_VBMETAIMAGE_TARGET)
945
946.PHONY: auxiliary
947auxiliary: $(INSTALLED_AUX_TARGETS)
948
949# Build files and then package it into the rom formats
950.PHONY: droidcore
951droidcore: files \
952	systemimage \
953	$(INSTALLED_BOOTIMAGE_TARGET) \
954	$(INSTALLED_RECOVERYIMAGE_TARGET) \
955	$(INSTALLED_VBMETAIMAGE_TARGET) \
956	$(INSTALLED_USERDATAIMAGE_TARGET) \
957	$(INSTALLED_CACHEIMAGE_TARGET) \
958	$(INSTALLED_BPTIMAGE_TARGET) \
959	$(INSTALLED_VENDORIMAGE_TARGET) \
960	$(INSTALLED_FILES_FILE) \
961	$(INSTALLED_FILES_FILE_VENDOR)
962
963# dist_files only for putting your library into the dist directory with a full build.
964.PHONY: dist_files
965
966ifneq ($(TARGET_BUILD_APPS),)
967  # If this build is just for apps, only build apps and not the full system by default.
968
969  unbundled_build_modules :=
970  ifneq ($(filter all,$(TARGET_BUILD_APPS)),)
971    # If they used the magic goal "all" then build all apps in the source tree.
972    unbundled_build_modules := $(foreach m,$(sort $(ALL_MODULES)),$(if $(filter APPS,$(ALL_MODULES.$(m).CLASS)),$(m)))
973  else
974    unbundled_build_modules := $(TARGET_BUILD_APPS)
975  endif
976
977  # Dist the installed files if they exist.
978  apps_only_installed_files := $(foreach m,$(unbundled_build_modules),$(ALL_MODULES.$(m).INSTALLED))
979  $(call dist-for-goals,apps_only, $(apps_only_installed_files))
980  # For uninstallable modules such as static Java library, we have to dist the built file,
981  # as <module_name>.<suffix>
982  apps_only_dist_built_files := $(foreach m,$(unbundled_build_modules),$(if $(ALL_MODULES.$(m).INSTALLED),,\
983      $(if $(ALL_MODULES.$(m).BUILT),$(ALL_MODULES.$(m).BUILT):$(m)$(suffix $(ALL_MODULES.$(m).BUILT)))\
984      $(if $(ALL_MODULES.$(m).AAR),$(ALL_MODULES.$(m).AAR):$(m).aar)\
985      ))
986  $(call dist-for-goals,apps_only, $(apps_only_dist_built_files))
987
988  ifeq ($(EMMA_INSTRUMENT),true)
989    $(EMMA_META_ZIP) : $(apps_only_installed_files)
990
991    $(call dist-for-goals,apps_only, $(EMMA_META_ZIP))
992  endif
993
994  $(PROGUARD_DICT_ZIP) : $(apps_only_installed_files)
995  $(call dist-for-goals,apps_only, $(PROGUARD_DICT_ZIP))
996
997  $(SYMBOLS_ZIP) : $(apps_only_installed_files)
998  $(call dist-for-goals,apps_only, $(SYMBOLS_ZIP))
999
1000  $(COVERAGE_ZIP) : $(apps_only_installed_files)
1001  $(call dist-for-goals,apps_only, $(COVERAGE_ZIP))
1002
1003.PHONY: apps_only
1004apps_only: $(unbundled_build_modules)
1005
1006droid_targets: apps_only
1007
1008# Combine the NOTICE files for a apps_only build
1009$(eval $(call combine-notice-files, \
1010    $(target_notice_file_txt), \
1011    $(target_notice_file_html), \
1012    "Notices for files for apps:", \
1013    $(TARGET_OUT_NOTICE_FILES), \
1014    $(apps_only_installed_files)))
1015
1016
1017else # TARGET_BUILD_APPS
1018  $(call dist-for-goals, droidcore, \
1019    $(INTERNAL_UPDATE_PACKAGE_TARGET) \
1020    $(INTERNAL_OTA_PACKAGE_TARGET) \
1021    $(BUILT_OTATOOLS_PACKAGE) \
1022    $(SYMBOLS_ZIP) \
1023    $(COVERAGE_ZIP) \
1024    $(INSTALLED_FILES_FILE) \
1025    $(INSTALLED_FILES_FILE_VENDOR) \
1026    $(INSTALLED_BUILD_PROP_TARGET) \
1027    $(BUILT_TARGET_FILES_PACKAGE) \
1028    $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
1029    $(INSTALLED_RAMDISK_TARGET) \
1030   )
1031
1032  # Put a copy of the radio/bootloader files in the dist dir.
1033  $(foreach f,$(INSTALLED_RADIOIMAGE_TARGET), \
1034    $(call dist-for-goals, droidcore, $(f)))
1035
1036  ifneq ($(ANDROID_BUILD_EMBEDDED),true)
1037  ifneq ($(TARGET_BUILD_PDK),true)
1038    $(call dist-for-goals, droidcore, \
1039      $(APPS_ZIP) \
1040      $(INTERNAL_EMULATOR_PACKAGE_TARGET) \
1041      $(PACKAGE_STATS_FILE) \
1042    )
1043  endif
1044  endif
1045
1046  ifeq ($(EMMA_INSTRUMENT),true)
1047    $(EMMA_META_ZIP) : $(INSTALLED_SYSTEMIMAGE)
1048
1049    $(call dist-for-goals, dist_files, $(EMMA_META_ZIP))
1050  endif
1051
1052# Building a full system-- the default is to build droidcore
1053droid_targets: droidcore dist_files
1054
1055endif # TARGET_BUILD_APPS
1056
1057.PHONY: docs
1058docs: $(ALL_DOCS)
1059
1060.PHONY: sdk
1061ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
1062sdk: $(ALL_SDK_TARGETS)
1063$(call dist-for-goals,sdk win_sdk, \
1064    $(ALL_SDK_TARGETS) \
1065    $(SYMBOLS_ZIP) \
1066    $(COVERAGE_ZIP) \
1067    $(INSTALLED_BUILD_PROP_TARGET) \
1068)
1069
1070# umbrella targets to assit engineers in verifying builds
1071.PHONY: java native target host java-host java-target native-host native-target \
1072        java-host-tests java-target-tests native-host-tests native-target-tests \
1073        java-tests native-tests host-tests target-tests tests
1074# some synonyms
1075.PHONY: host-java target-java host-native target-native \
1076        target-java-tests target-native-tests
1077host-java : java-host
1078target-java : java-target
1079host-native : native-host
1080target-native : native-target
1081target-java-tests : java-target-tests
1082target-native-tests : native-target-tests
1083tests : host-tests target-tests
1084
1085# Phony target to run all java compilations that use javac instead of jack.
1086.PHONY: javac-check
1087
1088# To catch more build breakage, check build tests modules in eng and userdebug builds.
1089ifneq ($(ANDROID_NO_TEST_CHECK),true)
1090ifneq ($(TARGET_BUILD_PDK),true)
1091ifneq ($(filter eng userdebug,$(TARGET_BUILD_VARIANT)),)
1092droidcore : target-tests host-tests
1093endif
1094endif
1095endif
1096
1097ifneq (,$(filter samplecode, $(MAKECMDGOALS)))
1098.PHONY: samplecode
1099sample_MODULES := $(sort $(call get-tagged-modules,samples))
1100sample_APKS_DEST_PATH := $(TARGET_COMMON_OUT_ROOT)/samples
1101sample_APKS_COLLECTION := \
1102        $(foreach module,$(sample_MODULES),$(sample_APKS_DEST_PATH)/$(notdir $(module)))
1103$(foreach module,$(sample_MODULES),$(eval $(call \
1104        copy-one-file,$(module),$(sample_APKS_DEST_PATH)/$(notdir $(module)))))
1105sample_ADDITIONAL_INSTALLED := \
1106        $(filter-out $(modules_to_install) $(modules_to_check),$(sample_MODULES))
1107samplecode: $(sample_APKS_COLLECTION)
1108	@echo "Collect sample code apks: $^"
1109	# remove apks that are not intended to be installed.
1110	rm -f $(sample_ADDITIONAL_INSTALLED)
1111endif  # samplecode in $(MAKECMDGOALS)
1112
1113.PHONY: findbugs
1114findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
1115
1116.PHONY: clean
1117clean:
1118	@rm -rf $(OUT_DIR)/*
1119	@echo "Entire build directory removed."
1120
1121.PHONY: clobber
1122clobber: clean
1123
1124# The rules for dataclean and installclean are defined in cleanbuild.mk.
1125
1126#xxx scrape this from ALL_MODULE_NAME_TAGS
1127.PHONY: modules
1128modules:
1129	@echo "Available sub-modules:"
1130	@echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \
1131	      tr -s ' ' '\n' | sort -u | $(COLUMN)
1132
1133.PHONY: showcommands
1134showcommands:
1135	@echo >/dev/null
1136
1137.PHONY: nothing
1138nothing:
1139	@echo Successfully read the makefiles.
1140
1141.PHONY: tidy_only
1142tidy_only:
1143	@echo Successfully make tidy_only.
1144
1145ndk: $(SOONG_OUT_DIR)/ndk.timestamp
1146.PHONY: ndk
1147
1148.PHONY: all_link_types
1149all_link_types:
1150
1151endif # KATI
1152