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