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