1# Variables we check:
2#     HOST_BUILD_TYPE = { release debug }
3#     TARGET_BUILD_TYPE = { release debug }
4# and we output a bunch of variables, see the case statement at
5# the bottom for the full list
6#     OUT_DIR is also set to "out" if it's not already set.
7#         this allows you to set it to somewhere else if you like
8#     SCAN_EXCLUDE_DIRS is an optional, whitespace separated list of
9#         directories that will also be excluded from full checkout tree
10#         searches for source or make files, in addition to OUT_DIR.
11#         This can be useful if you set OUT_DIR to be a different directory
12#         than other outputs of your build system.
13
14# Returns all words in $1 up to and including $2
15define find_and_earlier
16  $(strip $(if $(1),
17    $(firstword $(1))
18    $(if $(filter $(firstword $(1)),$(2)),,
19      $(call find_and_earlier,$(wordlist 2,$(words $(1)),$(1)),$(2)))))
20endef
21
22#$(warning $(call find_and_earlier,A B C,A))
23#$(warning $(call find_and_earlier,A B C,B))
24#$(warning $(call find_and_earlier,A B C,C))
25#$(warning $(call find_and_earlier,A B C,D))
26
27define version-list
28$(1)P1A $(1)P1B $(1)P2A $(1)P2B $(1)D1A $(1)D1B $(1)D2A $(1)D2B $(1)Q1A $(1)Q1B $(1)Q2A $(1)Q2B $(1)Q3A $(1)Q3B
29endef
30
31PREV_VERSIONS := OPR1 OPD1 OPD2 OPM1 OPM2 PPR1 PPD1 PPD2 PPM1 PPM2 QPR1
32ALL_VERSIONS := Q R S T U V W X Y Z
33ALL_VERSIONS := $(PREV_VERSIONS) $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v)))
34PREV_VERSIONS :=
35
36# Filters ALL_VERSIONS down to the range [$1, $2], and errors if $1 > $2 or $3 is
37# not in [$1, $2]
38# $(1): min platform version
39# $(2): max platform version
40# $(3): default platform version
41define allowed-platform-versions
42$(strip \
43  $(if $(filter $(ALL_VERSIONS),$(1)),,
44    $(error Invalid MIN_PLATFORM_VERSION '$(1)'))
45  $(if $(filter $(ALL_VERSIONS),$(2)),,
46    $(error Invalid MAX_PLATFORM_VERSION '$(2)'))
47  $(if $(filter $(ALL_VERSIONS),$(3)),,
48    $(error Invalid DEFAULT_PLATFORM_VERSION '$(3)'))
49
50  $(eval allowed_versions_ := $(call find_and_earlier,$(ALL_VERSIONS),$(2)))
51
52  $(if $(filter $(allowed_versions_),$(1)),,
53    $(error MIN_PLATFORM_VERSION '$(1)' must be before MAX_PLATFORM_VERSION '$(2)'))
54
55  $(eval allowed_versions_ := $(1) \
56    $(filter-out $(call find_and_earlier,$(allowed_versions_),$(1)),$(allowed_versions_)))
57
58  $(if $(filter $(allowed_versions_),$(3)),,
59    $(error DEFAULT_PLATFORM_VERSION '$(3)' must be between MIN_PLATFORM_VERSION '$(1)' and MAX_PLATFORM_VERSION '$(2)'))
60
61  $(allowed_versions_))
62endef
63
64#$(warning $(call allowed-platform-versions,OPR1,PPR1,OPR1))
65#$(warning $(call allowed-platform-versions,OPM1,PPR1,OPR1))
66
67# Set up version information.
68include $(BUILD_SYSTEM)/version_defaults.mk
69
70ENABLED_VERSIONS := $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION))
71
72$(foreach v,$(ENABLED_VERSIONS), \
73  $(eval IS_AT_LEAST_$(v) := true))
74
75# ---------------------------------------------------------------
76# If you update the build system such that the environment setup
77# or buildspec.mk need to be updated, increment this number, and
78# people who haven't re-run those will have to do so before they
79# can build.  Make sure to also update the corresponding value in
80# buildspec.mk.default and envsetup.sh.
81CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 13
82
83# ---------------------------------------------------------------
84# The product defaults to generic on hardware
85ifeq ($(TARGET_PRODUCT),)
86TARGET_PRODUCT := aosp_arm
87endif
88
89
90# the variant -- the set of files that are included for a build
91ifeq ($(strip $(TARGET_BUILD_VARIANT)),)
92TARGET_BUILD_VARIANT := eng
93endif
94
95TARGET_BUILD_APPS ?=
96
97# Set to true for an unbundled build, i.e. a build without
98# support for platform targets like the system image. This also
99# disables consistency checks that only apply to full platform
100# builds.
101TARGET_BUILD_UNBUNDLED ?=
102
103# TARGET_BUILD_APPS implies unbundled build, otherwise we default
104# to bundled (i.e. platform targets such as the system image are
105# included).
106ifneq ($(TARGET_BUILD_APPS),)
107  TARGET_BUILD_UNBUNDLED := true
108endif
109
110.KATI_READONLY := \
111  TARGET_PRODUCT \
112  TARGET_BUILD_VARIANT \
113  TARGET_BUILD_APPS \
114  TARGET_BUILD_UNBUNDLED \
115
116# ---------------------------------------------------------------
117# Set up configuration for host machine.  We don't do cross-
118# compiles except for arm, so the HOST is whatever we are
119# running on
120
121# HOST_OS
122ifneq (,$(findstring Linux,$(UNAME)))
123  HOST_OS := linux
124endif
125ifneq (,$(findstring Darwin,$(UNAME)))
126  HOST_OS := darwin
127endif
128
129HOST_OS_EXTRA := $(shell uname -rsm)
130ifeq ($(HOST_OS),linux)
131  ifneq ($(wildcard /etc/os-release),)
132    HOST_OS_EXTRA += $(shell source /etc/os-release; echo $$PRETTY_NAME)
133  endif
134else ifeq ($(HOST_OS),darwin)
135  HOST_OS_EXTRA += $(shell sw_vers -productVersion)
136endif
137HOST_OS_EXTRA := $(subst $(space),-,$(HOST_OS_EXTRA))
138
139# BUILD_OS is the real host doing the build.
140BUILD_OS := $(HOST_OS)
141
142HOST_CROSS_OS :=
143# We can cross-build Windows binaries on Linux
144ifeq ($(HOST_OS),linux)
145ifeq ($(BUILD_HOST_static),)
146HOST_CROSS_OS := windows
147HOST_CROSS_ARCH := x86
148HOST_CROSS_2ND_ARCH := x86_64
1492ND_HOST_CROSS_IS_64_BIT := true
150endif
151endif
152
153ifeq ($(HOST_OS),)
154$(error Unable to determine HOST_OS from uname -sm: $(UNAME)!)
155endif
156
157# HOST_ARCH
158ifneq (,$(findstring x86_64,$(UNAME)))
159  HOST_ARCH := x86_64
160  HOST_2ND_ARCH := x86
161  HOST_IS_64_BIT := true
162else
163ifneq (,$(findstring i686,$(UNAME))$(findstring x86,$(UNAME)))
164$(error Building on a 32-bit x86 host is not supported: $(UNAME)!)
165endif
166endif
167
168ifeq ($(HOST_OS),darwin)
169  # Mac no longer supports 32-bit executables
170  HOST_2ND_ARCH :=
171endif
172
173HOST_2ND_ARCH_VAR_PREFIX := 2ND_
174HOST_2ND_ARCH_MODULE_SUFFIX := _32
175HOST_CROSS_2ND_ARCH_VAR_PREFIX := 2ND_
176HOST_CROSS_2ND_ARCH_MODULE_SUFFIX := _64
177TARGET_2ND_ARCH_VAR_PREFIX := 2ND_
178.KATI_READONLY := \
179  HOST_ARCH \
180  HOST_2ND_ARCH \
181  HOST_IS_64_BIT \
182  HOST_2ND_ARCH_VAR_PREFIX \
183  HOST_2ND_ARCH_MODULE_SUFFIX \
184  HOST_CROSS_2ND_ARCH_VAR_PREFIX \
185  HOST_CROSS_2ND_ARCH_MODULE_SUFFIX \
186  TARGET_2ND_ARCH_VAR_PREFIX \
187
188combo_target := HOST_
189combo_2nd_arch_prefix :=
190include $(BUILD_COMBOS)/select.mk
191
192ifdef HOST_2ND_ARCH
193  combo_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX)
194  include $(BUILD_SYSTEM)/combo/select.mk
195endif
196
197# Load the windows cross compiler under Linux
198ifdef HOST_CROSS_OS
199  combo_target := HOST_CROSS_
200  combo_2nd_arch_prefix :=
201  include $(BUILD_SYSTEM)/combo/select.mk
202
203  ifdef HOST_CROSS_2ND_ARCH
204    combo_2nd_arch_prefix := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)
205    include $(BUILD_SYSTEM)/combo/select.mk
206  endif
207endif
208
209# on windows, the tools have .exe at the end, and we depend on the
210# host config stuff being done first
211
212BUILD_ARCH := $(HOST_ARCH)
213BUILD_2ND_ARCH := $(HOST_2ND_ARCH)
214
215ifeq ($(HOST_ARCH),)
216$(error Unable to determine HOST_ARCH from uname -sm: $(UNAME)!)
217endif
218
219# the host build defaults to release, and it must be release or debug
220ifeq ($(HOST_BUILD_TYPE),)
221HOST_BUILD_TYPE := release
222endif
223
224ifneq ($(HOST_BUILD_TYPE),release)
225ifneq ($(HOST_BUILD_TYPE),debug)
226$(error HOST_BUILD_TYPE must be either release or debug, not '$(HOST_BUILD_TYPE)')
227endif
228endif
229
230# We don't want to move all the prebuilt host tools to a $(HOST_OS)-x86_64 dir.
231HOST_PREBUILT_ARCH := x86
232# This is the standard way to name a directory containing prebuilt host
233# objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc
234HOST_PREBUILT_TAG := $(BUILD_OS)-$(HOST_PREBUILT_ARCH)
235
236# TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT.
237# Define them here so they can be used in product config files.
238TARGET_COPY_OUT_SYSTEM := system
239TARGET_COPY_OUT_SYSTEM_OTHER := system_other
240TARGET_COPY_OUT_DATA := data
241TARGET_COPY_OUT_ASAN := $(TARGET_COPY_OUT_DATA)/asan
242TARGET_COPY_OUT_OEM := oem
243TARGET_COPY_OUT_RAMDISK := ramdisk
244TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk
245TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK := vendor_debug_ramdisk
246TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk
247TARGET_COPY_OUT_ROOT := root
248TARGET_COPY_OUT_RECOVERY := recovery
249# The directory used for optional partitions depend on the BoardConfig, so
250# they're defined to placeholder values here and swapped after reading the
251# BoardConfig, to be either the partition dir, or a subdir within 'system'.
252_vendor_path_placeholder := ||VENDOR-PATH-PH||
253_product_path_placeholder := ||PRODUCT-PATH-PH||
254_system_ext_path_placeholder := ||SYSTEM_EXT-PATH-PH||
255_odm_path_placeholder := ||ODM-PATH-PH||
256_vendor_dlkm_path_placeholder := ||VENDOR_DLKM-PATH-PH||
257_odm_dlkm_path_placeholder := ||ODM_DLKM-PATH-PH||
258TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder)
259TARGET_COPY_OUT_VENDOR_RAMDISK := vendor-ramdisk
260TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder)
261# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will copy the target to
262# product
263TARGET_COPY_OUT_PRODUCT_SERVICES := $(_product_path_placeholder)
264TARGET_COPY_OUT_SYSTEM_EXT := $(_system_ext_path_placeholder)
265TARGET_COPY_OUT_ODM := $(_odm_path_placeholder)
266TARGET_COPY_OUT_VENDOR_DLKM := $(_vendor_dlkm_path_placeholder)
267TARGET_COPY_OUT_ODM_DLKM := $(_odm_dlkm_path_placeholder)
268
269# Returns the non-sanitized version of the path provided in $1.
270define get_non_asan_path
271$(patsubst $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/%,$(PRODUCT_OUT)/%,$1)
272endef
273
274#################################################################
275# Set up minimal BOOTCLASSPATH list of jars to build/execute
276# java code with dalvikvm/art.
277# Jars present in the ART apex. These should match exactly the list of
278# Java libraries in the ART apex build rule.
279ART_APEX_JARS := \
280    com.android.art:core-oj \
281    com.android.art:core-libart \
282    com.android.art:okhttp \
283    com.android.art:bouncycastle \
284    com.android.art:apache-xml
285#################################################################
286
287# Read the product specs so we can get TARGET_DEVICE and other
288# variables that we need in order to locate the output files.
289include $(BUILD_SYSTEM)/product_config.mk
290
291build_variant := $(filter-out eng user userdebug,$(TARGET_BUILD_VARIANT))
292ifneq ($(build_variant)-$(words $(TARGET_BUILD_VARIANT)),-1)
293$(warning bad TARGET_BUILD_VARIANT: $(TARGET_BUILD_VARIANT))
294$(error must be empty or one of: eng user userdebug)
295endif
296
297SDK_HOST_ARCH := x86
298TARGET_OS := linux
299
300include $(BUILD_SYSTEM)/board_config.mk
301
302# the target build type defaults to release
303ifneq ($(TARGET_BUILD_TYPE),debug)
304TARGET_BUILD_TYPE := release
305endif
306
307# ---------------------------------------------------------------
308# figure out the output directories
309
310SOONG_OUT_DIR := $(OUT_DIR)/soong
311
312TARGET_OUT_ROOT := $(OUT_DIR)/target
313
314HOST_OUT_ROOT := $(OUT_DIR)/host
315
316.KATI_READONLY := SOONG_OUT_DIR TARGET_OUT_ROOT HOST_OUT_ROOT
317
318# We want to avoid two host bin directories in multilib build.
319HOST_OUT := $(HOST_OUT_ROOT)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
320SOONG_HOST_OUT := $(SOONG_OUT_DIR)/host/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
321
322HOST_CROSS_OUT := $(HOST_OUT_ROOT)/windows-$(HOST_PREBUILT_ARCH)
323
324.KATI_READONLY := HOST_OUT SOONG_HOST_OUT HOST_CROSS_OUT
325
326TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
327
328TARGET_COMMON_OUT_ROOT := $(TARGET_OUT_ROOT)/common
329HOST_COMMON_OUT_ROOT := $(HOST_OUT_ROOT)/common
330
331PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_DEVICE)
332
333.KATI_READONLY := TARGET_PRODUCT_OUT_ROOT TARGET_COMMON_OUT_ROOT HOST_COMMON_OUT_ROOT PRODUCT_OUT
334
335OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs
336OUT_NDK_DOCS := $(TARGET_COMMON_OUT_ROOT)/ndk-docs
337.KATI_READONLY := OUT_DOCS OUT_NDK_DOCS
338
339$(call KATI_obsolete,BUILD_OUT,Use HOST_OUT instead)
340
341BUILD_OUT_EXECUTABLES := $(HOST_OUT)/bin
342SOONG_HOST_OUT_EXECUTABLES := $(SOONG_HOST_OUT)/bin
343.KATI_READONLY := BUILD_OUT_EXECUTABLES SOONG_HOST_OUT_EXECUTABLES
344
345HOST_OUT_EXECUTABLES := $(HOST_OUT)/bin
346HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib64
347HOST_OUT_DYLIB_LIBRARIES := $(HOST_OUT)/lib64
348HOST_OUT_RENDERSCRIPT_BITCODE := $(HOST_OUT_SHARED_LIBRARIES)
349HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT)/framework
350HOST_OUT_SDK_ADDON := $(HOST_OUT)/sdk_addon
351HOST_OUT_NATIVE_TESTS := $(HOST_OUT)/nativetest64
352HOST_OUT_COVERAGE := $(HOST_OUT)/coverage
353HOST_OUT_TESTCASES := $(HOST_OUT)/testcases
354.KATI_READONLY := \
355  HOST_OUT_EXECUTABLES \
356  HOST_OUT_SHARED_LIBRARIES \
357  HOST_OUT_RENDERSCRIPT_BITCODE \
358  HOST_OUT_JAVA_LIBRARIES \
359  HOST_OUT_SDK_ADDON \
360  HOST_OUT_NATIVE_TESTS \
361  HOST_OUT_COVERAGE \
362  HOST_OUT_TESTCASES
363
364HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT)/bin
365HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib
366HOST_CROSS_OUT_NATIVE_TESTS := $(HOST_CROSS_OUT)/nativetest
367HOST_CROSS_OUT_COVERAGE := $(HOST_CROSS_OUT)/coverage
368HOST_CROSS_OUT_TESTCASES := $(HOST_CROSS_OUT)/testcases
369.KATI_READONLY := \
370  HOST_CROSS_OUT_EXECUTABLES \
371  HOST_CROSS_OUT_SHARED_LIBRARIES \
372  HOST_CROSS_OUT_NATIVE_TESTS \
373  HOST_CROSS_OUT_COVERAGE \
374  HOST_CROSS_OUT_TESTCASES
375
376HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
377HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
378HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
379HOST_OUT_FAKE := $(HOST_OUT)/fake_packages
380.KATI_READONLY := \
381  HOST_OUT_INTERMEDIATES \
382  HOST_OUT_NOTICE_FILES \
383  HOST_OUT_COMMON_INTERMEDIATES \
384  HOST_OUT_FAKE
385
386HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
387HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES
388.KATI_READONLY := \
389  HOST_CROSS_OUT_INTERMEDIATES \
390  HOST_CROSS_OUT_NOTICE_FILES
391
392HOST_OUT_GEN := $(HOST_OUT)/gen
393HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen
394.KATI_READONLY := \
395  HOST_OUT_GEN \
396  HOST_OUT_COMMON_GEN
397
398HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen
399.KATI_READONLY := HOST_CROSS_OUT_GEN
400
401# Out for HOST_2ND_ARCH
402$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj32
403$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib
404$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES := $(HOST_OUT_EXECUTABLES)
405$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT_JAVA_LIBRARIES)
406$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_NATIVE_TESTS := $(HOST_OUT)/nativetest
407$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_TESTCASES := $(HOST_OUT_TESTCASES)
408.KATI_READONLY := \
409  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES \
410  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES \
411  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES \
412  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_JAVA_LIBRARIES \
413  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_NATIVE_TESTS \
414  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_TESTCASES
415
416# The default host library path.
417# It always points to the path where we build libraries in the default bitness.
418HOST_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
419.KATI_READONLY := HOST_LIBRARY_PATH
420
421# Out for HOST_CROSS_2ND_ARCH
422$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj64
423$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib64
424$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT_EXECUTABLES)
425$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_NATIVE_TESTS := $(HOST_CROSS_OUT)/nativetest64
426.KATI_READONLY := \
427  $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATES \
428  $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_SHARED_LIBRARIES \
429  $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_EXECUTABLES \
430  $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_NATIVE_TESTS
431
432ifneq ($(filter address,$(SANITIZE_TARGET)),)
433  TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_asan
434else
435  TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
436endif
437TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include
438.KATI_READONLY := TARGET_OUT_INTERMEDIATES TARGET_OUT_HEADERS
439
440ifneq ($(filter address,$(SANITIZE_TARGET)),)
441  TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj_asan
442else
443  TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj
444endif
445.KATI_READONLY := TARGET_OUT_COMMON_INTERMEDIATES
446
447TARGET_OUT_GEN := $(PRODUCT_OUT)/gen
448TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen
449.KATI_READONLY := TARGET_OUT_GEN TARGET_OUT_COMMON_GEN
450
451TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
452.KATI_READONLY := TARGET_OUT
453ifneq ($(filter address,$(SANITIZE_TARGET)),)
454target_out_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
455ifeq ($(SANITIZE_LITE),true)
456# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
457# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
458target_out_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
459else
460target_out_app_base := $(TARGET_OUT)
461endif
462else
463target_out_shared_libraries_base := $(TARGET_OUT)
464target_out_app_base := $(TARGET_OUT)
465endif
466
467TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin
468TARGET_OUT_OPTIONAL_EXECUTABLES := $(TARGET_OUT)/xbin
469ifeq ($(TARGET_IS_64_BIT),true)
470# /system/lib always contains 32-bit libraries,
471# and /system/lib64 (if present) always contains 64-bit libraries.
472TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib64
473else
474TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib
475endif
476TARGET_OUT_RENDERSCRIPT_BITCODE := $(TARGET_OUT_SHARED_LIBRARIES)
477TARGET_OUT_JAVA_LIBRARIES := $(TARGET_OUT)/framework
478TARGET_OUT_APPS := $(target_out_app_base)/app
479TARGET_OUT_APPS_PRIVILEGED := $(target_out_app_base)/priv-app
480TARGET_OUT_KEYLAYOUT := $(TARGET_OUT)/usr/keylayout
481TARGET_OUT_KEYCHARS := $(TARGET_OUT)/usr/keychars
482TARGET_OUT_ETC := $(TARGET_OUT)/etc
483TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
484TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
485TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases
486.KATI_READONLY := \
487  TARGET_OUT_EXECUTABLES \
488  TARGET_OUT_OPTIONAL_EXECUTABLES \
489  TARGET_OUT_SHARED_LIBRARIES \
490  TARGET_OUT_RENDERSCRIPT_BITCODE \
491  TARGET_OUT_JAVA_LIBRARIES \
492  TARGET_OUT_APPS \
493  TARGET_OUT_APPS_PRIVILEGED \
494  TARGET_OUT_KEYLAYOUT \
495  TARGET_OUT_KEYCHARS \
496  TARGET_OUT_ETC \
497  TARGET_OUT_NOTICE_FILES \
498  TARGET_OUT_FAKE \
499  TARGET_OUT_TESTCASES
500
501ifeq ($(SANITIZE_LITE),true)
502# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
503# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
504TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_OTHER)
505else
506TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_OTHER)
507endif
508.KATI_READONLY := TARGET_OUT_SYSTEM_OTHER
509
510# Out for TARGET_2ND_ARCH
511TARGET_2ND_ARCH_MODULE_SUFFIX := $(HOST_2ND_ARCH_MODULE_SUFFIX)
512.KATI_READONLY := TARGET_2ND_ARCH_MODULE_SUFFIX
513
514ifneq ($(filter address,$(SANITIZE_TARGET)),)
515  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)_asan
516else
517  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)
518endif
519$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib
520$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_RENDERSCRIPT_BITCODE := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES)
521$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
522$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS := $(TARGET_OUT_APPS)
523$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT_APPS_PRIVILEGED)
524$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_TESTCASES := $(TARGET_OUT_TESTCASES)
525.KATI_READONLY := \
526  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES \
527  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES \
528  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_RENDERSCRIPT_BITCODE \
529  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES \
530  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS \
531  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED \
532  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_TESTCASES
533
534MODULE_CLASS_APPS := app
535MODULE_CLASS_EXECUTABLES := bin
536MODULE_CLASS_JAVA_LIBRARIES := framework
537MODULE_CLASS_NATIVE_TESTS := nativetest
538MODULE_CLASS_METRIC_TESTS := benchmarktest
539TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
540TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
541TARGET_OUT_DATA_SHARED_LIBRARIES := $(TARGET_OUT_SHARED_LIBRARIES)
542TARGET_OUT_DATA_JAVA_LIBRARIES := $(TARGET_OUT_DATA)/framework
543TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA)/app
544TARGET_OUT_DATA_KEYLAYOUT := $(TARGET_OUT_KEYLAYOUT)
545TARGET_OUT_DATA_KEYCHARS := $(TARGET_OUT_KEYCHARS)
546TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC)
547ifeq ($(TARGET_IS_64_BIT),true)
548TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest64
549TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest64
550TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest64$(TARGET_VENDOR_TEST_SUFFIX)
551TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest64$(TARGET_VENDOR_TEST_SUFFIX)
552else
553TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
554TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest
555TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest$(TARGET_VENDOR_TEST_SUFFIX)
556TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest$(TARGET_VENDOR_TEST_SUFFIX)
557endif
558MODULE_CLASS_FAKE := fake_packages
559TARGET_OUT_DATA_FAKE := $(TARGET_OUT_DATA)/fake_packages
560.KATI_READONLY := \
561  TARGET_OUT_DATA \
562  TARGET_OUT_DATA_EXECUTABLES \
563  TARGET_OUT_DATA_SHARED_LIBRARIES \
564  TARGET_OUT_DATA_JAVA_LIBRARIES \
565  TARGET_OUT_DATA_APPS \
566  TARGET_OUT_DATA_KEYLAYOUT \
567  TARGET_OUT_DATA_KEYCHARS \
568  TARGET_OUT_DATA_ETC \
569  TARGET_OUT_DATA_NATIVE_TESTS \
570  TARGET_OUT_DATA_METRIC_TESTS \
571  TARGET_OUT_VENDOR_NATIVE_TESTS \
572  TARGET_OUT_VENDOR_METRIC_TESTS \
573  TARGET_OUT_DATA_FAKE \
574  MODULE_CLASS_APPS \
575  MODULE_CLASS_EXECUTABLES \
576  MODULE_CLASS_JAVA_LIBRARIES \
577  MODULE_CLASS_NATIVE_TESTS \
578  MODULE_CLASS_METRIC_TESTS \
579  MODULE_CLASS_FAKE
580
581$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_DATA_EXECUTABLES)
582$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES)
583$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA_APPS)
584$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
585$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest
586$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest$(TARGET_VENDOR_TEST_SUFFIX)
587$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest$(TARGET_VENDOR_TEST_SUFFIX)
588.KATI_READONLY := \
589  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES \
590  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES \
591  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_APPS \
592  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS \
593  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_METRIC_TESTS \
594  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_NATIVE_TESTS \
595  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_METRIC_TESTS \
596
597TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache
598.KATI_READONLY := TARGET_OUT_CACHE
599
600TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
601.KATI_READONLY := TARGET_OUT_VENDOR
602ifneq ($(filter address,$(SANITIZE_TARGET)),)
603target_out_vendor_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_VENDOR)
604ifeq ($(SANITIZE_LITE),true)
605# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
606# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
607target_out_vendor_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_VENDOR)
608else
609target_out_vendor_app_base := $(TARGET_OUT_VENDOR)
610endif
611else
612target_out_vendor_shared_libraries_base := $(TARGET_OUT_VENDOR)
613target_out_vendor_app_base := $(TARGET_OUT_VENDOR)
614endif
615
616TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR)/bin
617TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES := $(TARGET_OUT_VENDOR)/xbin
618ifeq ($(TARGET_IS_64_BIT),true)
619TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib64
620else
621TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib
622endif
623TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
624TARGET_OUT_VENDOR_JAVA_LIBRARIES := $(TARGET_OUT_VENDOR)/framework
625TARGET_OUT_VENDOR_APPS := $(target_out_vendor_app_base)/app
626TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(target_out_vendor_app_base)/priv-app
627TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc
628.KATI_READONLY := \
629  TARGET_OUT_VENDOR_EXECUTABLES \
630  TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES \
631  TARGET_OUT_VENDOR_SHARED_LIBRARIES \
632  TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE \
633  TARGET_OUT_VENDOR_JAVA_LIBRARIES \
634  TARGET_OUT_VENDOR_APPS \
635  TARGET_OUT_VENDOR_APPS_PRIVILEGED \
636  TARGET_OUT_VENDOR_ETC
637
638$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR_EXECUTABLES)
639$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib
640$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES)
641$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR_APPS)
642$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(TARGET_OUT_VENDOR_APPS_PRIVILEGED)
643.KATI_READONLY := \
644  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES \
645  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES \
646  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE \
647  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS \
648  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS_PRIVILEGED
649
650TARGET_OUT_OEM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_OEM)
651TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM)/bin
652ifeq ($(TARGET_IS_64_BIT),true)
653TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib64
654else
655TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib
656endif
657# We don't expect Java libraries in the oem.img.
658# TARGET_OUT_OEM_JAVA_LIBRARIES:= $(TARGET_OUT_OEM)/framework
659TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM)/app
660TARGET_OUT_OEM_ETC := $(TARGET_OUT_OEM)/etc
661.KATI_READONLY := \
662  TARGET_OUT_OEM \
663  TARGET_OUT_OEM_EXECUTABLES \
664  TARGET_OUT_OEM_SHARED_LIBRARIES \
665  TARGET_OUT_OEM_APPS \
666  TARGET_OUT_OEM_ETC
667
668$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM_EXECUTABLES)
669$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib
670$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM_APPS)
671.KATI_READONLY := \
672  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_EXECUTABLES \
673  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES \
674  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_APPS \
675
676TARGET_OUT_ODM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ODM)
677ifneq ($(filter address,$(SANITIZE_TARGET)),)
678target_out_odm_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_OEM)
679ifeq ($(SANITIZE_LITE),true)
680# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
681# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
682target_out_odm_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_OEM)
683else
684target_out_odm_app_base := $(TARGET_OUT_ODM)
685endif
686else
687target_out_odm_shared_libraries_base := $(TARGET_OUT_ODM)
688target_out_odm_app_base := $(TARGET_OUT_ODM)
689endif
690
691TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM)/bin
692TARGET_OUT_ODM_OPTIONAL_EXECUTABLES := $(TARGET_OUT_ODM)/xbin
693ifeq ($(TARGET_IS_64_BIT),true)
694TARGET_OUT_ODM_SHARED_LIBRARIES := $(target_out_odm_shared_libraries_base)/lib64
695else
696TARGET_OUT_ODM_SHARED_LIBRARIES := $(target_out_odm_shared_libraries_base)/lib
697endif
698TARGET_OUT_ODM_RENDERSCRIPT_BITCODE := $(TARGET_OUT_ODM_SHARED_LIBRARIES)
699TARGET_OUT_ODM_JAVA_LIBRARIES := $(TARGET_OUT_ODM)/framework
700TARGET_OUT_ODM_APPS := $(target_out_odm_app_base)/app
701TARGET_OUT_ODM_APPS_PRIVILEGED := $(target_out_odm_app_base)/priv-app
702TARGET_OUT_ODM_ETC := $(TARGET_OUT_ODM)/etc
703.KATI_READONLY := \
704  TARGET_OUT_ODM \
705  TARGET_OUT_ODM_EXECUTABLES \
706  TARGET_OUT_ODM_OPTIONAL_EXECUTABLES \
707  TARGET_OUT_ODM_SHARED_LIBRARIES \
708  TARGET_OUT_ODM_RENDERSCRIPT_BITCODE \
709  TARGET_OUT_ODM_JAVA_LIBRARIES \
710  TARGET_OUT_ODM_APPS \
711  TARGET_OUT_ODM_APPS_PRIVILEGED \
712  TARGET_OUT_ODM_ETC
713
714$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM_EXECUTABLES)
715$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES := $(target_out_odm_shared_libraries_base)/lib
716$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_RENDERSCRIPT_BITCODE := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES)
717$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM_APPS)
718$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS_PRIVILEGED := $(TARGET_OUT_ODM_APPS_PRIVILEGED)
719.KATI_READONLY := \
720  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_EXECUTABLES \
721  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES \
722  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_RENDERSCRIPT_BITCODE \
723  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS \
724  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS_PRIVILEGED
725
726TARGET_OUT_VENDOR_DLKM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_DLKM)
727
728TARGET_OUT_VENDOR_DLKM_ETC := $(TARGET_OUT_VENDOR_DLKM)/etc
729.KATI_READONLY := \
730  TARGET_OUT_VENDOR_DLKM_ETC
731
732# Unlike other partitions, vendor_dlkm should only contain kernel modules.
733TARGET_OUT_VENDOR_DLKM_EXECUTABLES :=
734TARGET_OUT_VENDOR_DLKM_OPTIONAL_EXECUTABLES :=
735TARGET_OUT_VENDOR_DLKM_SHARED_LIBRARIES :=
736TARGET_OUT_VENDOR_DLKM_RENDERSCRIPT_BITCODE :=
737TARGET_OUT_VENDOR_DLKM_JAVA_LIBRARIES :=
738TARGET_OUT_VENDOR_DLKM_APPS :=
739TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED :=
740$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_EXECUTABLES :=
741$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_SHARED_LIBRARIES :=
742$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_RENDERSCRIPT_BITCODE :=
743$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS :=
744$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED :=
745$(KATI_obsolete_var \
746    TARGET_OUT_VENDOR_DLKM_EXECUTABLES \
747    TARGET_OUT_VENDOR_DLKM_OPTIONAL_EXECUTABLES \
748    TARGET_OUT_VENDOR_DLKM_SHARED_LIBRARIES \
749    TARGET_OUT_VENDOR_DLKM_RENDERSCRIPT_BITCODE \
750    TARGET_OUT_VENDOR_DLKM_JAVA_LIBRARIES \
751    TARGET_OUT_VENDOR_DLKM_APPS \
752    TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED \
753    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_EXECUTABLES \
754    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_SHARED_LIBRARIES \
755    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_RENDERSCRIPT_BITCODE \
756    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS \
757    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED \
758    , vendor_dlkm should not contain any executables, libraries, or apps)
759
760TARGET_OUT_ODM_DLKM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ODM_DLKM)
761
762TARGET_OUT_ODM_DLKM_ETC := $(TARGET_OUT_ODM_DLKM)/etc
763.KATI_READONLY := \
764  TARGET_OUT_ODM_DLKM_ETC
765
766# Unlike other partitions, odm_dlkm should only contain kernel modules.
767TARGET_OUT_ODM_DLKM_EXECUTABLES :=
768TARGET_OUT_ODM_DLKM_OPTIONAL_EXECUTABLES :=
769TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES :=
770TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE :=
771TARGET_OUT_ODM_DLKM_JAVA_LIBRARIES :=
772TARGET_OUT_ODM_DLKM_APPS :=
773TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED :=
774$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_EXECUTABLES :=
775$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES :=
776$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE :=
777$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS :=
778$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED :=
779$(KATI_obsolete_var \
780    TARGET_OUT_ODM_DLKM_EXECUTABLES \
781    TARGET_OUT_ODM_DLKM_OPTIONAL_EXECUTABLES \
782    TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES \
783    TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE \
784    TARGET_OUT_ODM_DLKM_JAVA_LIBRARIES \
785    TARGET_OUT_ODM_DLKM_APPS \
786    TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED \
787    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_EXECUTABLES \
788    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES \
789    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE \
790    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS \
791    $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED \
792    , odm_dlkm should not contain any executables, libraries, or apps)
793
794TARGET_OUT_PRODUCT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT)
795TARGET_OUT_PRODUCT_EXECUTABLES := $(TARGET_OUT_PRODUCT)/bin
796.KATI_READONLY := TARGET_OUT_PRODUCT
797ifneq ($(filter address,$(SANITIZE_TARGET)),)
798target_out_product_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_PRODUCT)
799ifeq ($(SANITIZE_LITE),true)
800# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
801# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
802target_out_product_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_PRODUCT)
803else
804target_out_product_app_base := $(TARGET_OUT_PRODUCT)
805endif
806else
807target_out_product_shared_libraries_base := $(TARGET_OUT_PRODUCT)
808target_out_product_app_base := $(TARGET_OUT_PRODUCT)
809endif
810
811ifeq ($(TARGET_IS_64_BIT),true)
812TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib64
813else
814TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib
815endif
816TARGET_OUT_PRODUCT_JAVA_LIBRARIES := $(TARGET_OUT_PRODUCT)/framework
817TARGET_OUT_PRODUCT_APPS := $(target_out_product_app_base)/app
818TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(target_out_product_app_base)/priv-app
819TARGET_OUT_PRODUCT_ETC := $(TARGET_OUT_PRODUCT)/etc
820.KATI_READONLY := \
821  TARGET_OUT_PRODUCT_EXECUTABLES \
822  TARGET_OUT_PRODUCT_SHARED_LIBRARIES \
823  TARGET_OUT_PRODUCT_JAVA_LIBRARIES \
824  TARGET_OUT_PRODUCT_APPS \
825  TARGET_OUT_PRODUCT_APPS_PRIVILEGED \
826  TARGET_OUT_PRODUCT_ETC
827
828$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_EXECUTABLES := $(TARGET_OUT_PRODUCT_EXECUTABLES)
829$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib
830$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS := $(TARGET_OUT_PRODUCT_APPS)
831$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(TARGET_OUT_PRODUCT_APPS_PRIVILEGED)
832.KATI_READONLY := \
833  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_EXECUTABLES \
834  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES \
835  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS \
836  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED
837
838TARGET_OUT_SYSTEM_EXT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_EXT)
839ifneq ($(filter address,$(SANITIZE_TARGET)),)
840target_out_system_ext_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_EXT)
841ifeq ($(SANITIZE_LITE),true)
842# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
843# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
844target_out_system_ext_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_EXT)
845else
846target_out_system_ext_app_base := $(TARGET_OUT_SYSTEM_EXT)
847endif
848else
849target_out_system_ext_shared_libraries_base := $(TARGET_OUT_SYSTEM_EXT)
850target_out_system_ext_app_base := $(TARGET_OUT_SYSTEM_EXT)
851endif
852
853ifeq ($(TARGET_IS_64_BIT),true)
854TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib64
855else
856TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib
857endif
858TARGET_OUT_SYSTEM_EXT_JAVA_LIBRARIES:= $(TARGET_OUT_SYSTEM_EXT)/framework
859TARGET_OUT_SYSTEM_EXT_APPS := $(target_out_system_ext_app_base)/app
860TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED := $(target_out_system_ext_app_base)/priv-app
861TARGET_OUT_SYSTEM_EXT_ETC := $(TARGET_OUT_SYSTEM_EXT)/etc
862TARGET_OUT_SYSTEM_EXT_EXECUTABLES := $(TARGET_OUT_SYSTEM_EXT)/bin
863.KATI_READONLY := \
864  TARGET_OUT_SYSTEM_EXT_EXECUTABLES \
865  TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES \
866  TARGET_OUT_SYSTEM_EXT_JAVA_LIBRARIES \
867  TARGET_OUT_SYSTEM_EXT_APPS \
868  TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED \
869  TARGET_OUT_SYSTEM_EXT_ETC
870
871$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_EXECUTABLES := $(TARGET_OUT_SYSTEM_EXT_EXECUTABLES)
872$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib
873$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS := $(TARGET_OUT_SYSTEM_EXT_APPS)
874$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED := $(TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED)
875.KATI_READONLY := \
876  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_EXECUTABLES \
877  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES \
878  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS \
879  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED
880
881TARGET_OUT_BREAKPAD := $(PRODUCT_OUT)/breakpad
882.KATI_READONLY := TARGET_OUT_BREAKPAD
883
884TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
885TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin
886TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/lib
887TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/$(TARGET_COPY_OUT_VENDOR)/lib
888TARGET_ROOT_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)
889TARGET_ROOT_OUT_BIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/bin
890TARGET_OUT_COVERAGE := $(PRODUCT_OUT)/coverage
891.KATI_READONLY := \
892  TARGET_OUT_UNSTRIPPED \
893  TARGET_OUT_EXECUTABLES_UNSTRIPPED \
894  TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED \
895  TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED \
896  TARGET_ROOT_OUT_UNSTRIPPED \
897  TARGET_ROOT_OUT_BIN_UNSTRIPPED \
898  TARGET_OUT_COVERAGE
899
900TARGET_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RAMDISK)
901TARGET_RAMDISK_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)
902TARGET_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DEBUG_RAMDISK)
903TARGET_VENDOR_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK)
904TARGET_TEST_HARNESS_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_TEST_HARNESS_RAMDISK)
905
906TARGET_VENDOR_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_RAMDISK)
907
908TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT)
909TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin
910TARGET_ROOT_OUT_ETC := $(TARGET_ROOT_OUT)/etc
911TARGET_ROOT_OUT_USR := $(TARGET_ROOT_OUT)/usr
912.KATI_READONLY := \
913  TARGET_ROOT_OUT \
914  TARGET_ROOT_OUT_BIN \
915  TARGET_ROOT_OUT_ETC \
916  TARGET_ROOT_OUT_USR
917
918TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RECOVERY)
919TARGET_RECOVERY_ROOT_OUT := $(TARGET_RECOVERY_OUT)/root
920.KATI_READONLY := \
921  TARGET_RECOVERY_OUT \
922  TARGET_RECOVERY_ROOT_OUT
923
924TARGET_SYSLOADER_OUT := $(PRODUCT_OUT)/sysloader
925TARGET_SYSLOADER_ROOT_OUT := $(TARGET_SYSLOADER_OUT)/root
926TARGET_SYSLOADER_SYSTEM_OUT := $(TARGET_SYSLOADER_OUT)/root/system
927.KATI_READONLY := \
928  TARGET_SYSLOADER_OUT \
929  TARGET_SYSLOADER_ROOT_OUT \
930  TARGET_SYSLOADER_SYSTEM_OUT
931
932TARGET_INSTALLER_OUT := $(PRODUCT_OUT)/installer
933TARGET_INSTALLER_DATA_OUT := $(TARGET_INSTALLER_OUT)/data
934TARGET_INSTALLER_ROOT_OUT := $(TARGET_INSTALLER_OUT)/root
935TARGET_INSTALLER_SYSTEM_OUT := $(TARGET_INSTALLER_OUT)/root/system
936.KATI_READONLY := \
937  TARGET_INSTALLER_OUT \
938  TARGET_INSTALLER_DATA_OUT \
939  TARGET_INSTALLER_ROOT_OUT \
940  TARGET_INSTALLER_SYSTEM_OUT
941
942COMMON_MODULE_CLASSES := TARGET_NOTICE_FILES HOST_NOTICE_FILES HOST_JAVA_LIBRARIES
943PER_ARCH_MODULE_CLASSES := SHARED_LIBRARIES STATIC_LIBRARIES EXECUTABLES GYP RENDERSCRIPT_BITCODE NATIVE_TESTS HEADER_LIBRARIES RLIB_LIBRARIES DYLIB_LIBRARIES
944.KATI_READONLY := COMMON_MODULE_CLASSES PER_ARCH_MODULE_CLASSES
945
946ifeq ($(CALLED_FROM_SETUP),true)
947PRINT_BUILD_CONFIG ?= true
948endif
949