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