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.KATI_READONLY := \
98  TARGET_PRODUCT \
99  TARGET_BUILD_VARIANT \
100  TARGET_BUILD_APPS
101
102# ---------------------------------------------------------------
103# Set up configuration for host machine.  We don't do cross-
104# compiles except for arm/mips, so the HOST is whatever we are
105# running on
106
107# HOST_OS
108ifneq (,$(findstring Linux,$(UNAME)))
109  HOST_OS := linux
110endif
111ifneq (,$(findstring Darwin,$(UNAME)))
112  HOST_OS := darwin
113endif
114
115HOST_OS_EXTRA := $(shell uname -rsm)
116ifeq ($(HOST_OS),linux)
117  ifneq ($(wildcard /etc/os-release),)
118    HOST_OS_EXTRA += $(shell source /etc/os-release; echo $$PRETTY_NAME)
119  endif
120else ifeq ($(HOST_OS),darwin)
121  HOST_OS_EXTRA += $(shell sw_vers -productVersion)
122endif
123HOST_OS_EXTRA := $(subst $(space),-,$(HOST_OS_EXTRA))
124
125# BUILD_OS is the real host doing the build.
126BUILD_OS := $(HOST_OS)
127
128HOST_CROSS_OS :=
129# We can cross-build Windows binaries on Linux
130ifeq ($(HOST_OS),linux)
131ifeq ($(BUILD_HOST_static),)
132HOST_CROSS_OS := windows
133HOST_CROSS_ARCH := x86
134HOST_CROSS_2ND_ARCH := x86_64
1352ND_HOST_CROSS_IS_64_BIT := true
136endif
137endif
138
139ifeq ($(HOST_OS),)
140$(error Unable to determine HOST_OS from uname -sm: $(UNAME)!)
141endif
142
143# HOST_ARCH
144ifneq (,$(findstring x86_64,$(UNAME)))
145  HOST_ARCH := x86_64
146  HOST_2ND_ARCH := x86
147  HOST_IS_64_BIT := true
148else
149ifneq (,$(findstring i686,$(UNAME))$(findstring x86,$(UNAME)))
150$(error Building on a 32-bit x86 host is not supported: $(UNAME)!)
151endif
152endif
153
154ifeq ($(HOST_OS),darwin)
155  # Mac no longer supports 32-bit executables
156  HOST_2ND_ARCH :=
157endif
158
159HOST_2ND_ARCH_VAR_PREFIX := 2ND_
160HOST_2ND_ARCH_MODULE_SUFFIX := _32
161HOST_CROSS_2ND_ARCH_VAR_PREFIX := 2ND_
162HOST_CROSS_2ND_ARCH_MODULE_SUFFIX := _64
163TARGET_2ND_ARCH_VAR_PREFIX := 2ND_
164.KATI_READONLY := \
165  HOST_ARCH \
166  HOST_2ND_ARCH \
167  HOST_IS_64_BIT \
168  HOST_2ND_ARCH_VAR_PREFIX \
169  HOST_2ND_ARCH_MODULE_SUFFIX \
170  HOST_CROSS_2ND_ARCH_VAR_PREFIX \
171  HOST_CROSS_2ND_ARCH_MODULE_SUFFIX \
172  TARGET_2ND_ARCH_VAR_PREFIX \
173
174combo_target := HOST_
175combo_2nd_arch_prefix :=
176include $(BUILD_COMBOS)/select.mk
177
178ifdef HOST_2ND_ARCH
179  combo_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX)
180  include $(BUILD_SYSTEM)/combo/select.mk
181endif
182
183# Load the windows cross compiler under Linux
184ifdef HOST_CROSS_OS
185  combo_target := HOST_CROSS_
186  combo_2nd_arch_prefix :=
187  include $(BUILD_SYSTEM)/combo/select.mk
188
189  ifdef HOST_CROSS_2ND_ARCH
190    combo_2nd_arch_prefix := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)
191    include $(BUILD_SYSTEM)/combo/select.mk
192  endif
193endif
194
195# on windows, the tools have .exe at the end, and we depend on the
196# host config stuff being done first
197
198BUILD_ARCH := $(HOST_ARCH)
199BUILD_2ND_ARCH := $(HOST_2ND_ARCH)
200
201ifeq ($(HOST_ARCH),)
202$(error Unable to determine HOST_ARCH from uname -sm: $(UNAME)!)
203endif
204
205# the host build defaults to release, and it must be release or debug
206ifeq ($(HOST_BUILD_TYPE),)
207HOST_BUILD_TYPE := release
208endif
209
210ifneq ($(HOST_BUILD_TYPE),release)
211ifneq ($(HOST_BUILD_TYPE),debug)
212$(error HOST_BUILD_TYPE must be either release or debug, not '$(HOST_BUILD_TYPE)')
213endif
214endif
215
216# We don't want to move all the prebuilt host tools to a $(HOST_OS)-x86_64 dir.
217HOST_PREBUILT_ARCH := x86
218# This is the standard way to name a directory containing prebuilt host
219# objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc
220HOST_PREBUILT_TAG := $(BUILD_OS)-$(HOST_PREBUILT_ARCH)
221
222# TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT.
223# Define them here so they can be used in product config files.
224TARGET_COPY_OUT_SYSTEM := system
225TARGET_COPY_OUT_SYSTEM_OTHER := system_other
226TARGET_COPY_OUT_DATA := data
227TARGET_COPY_OUT_ASAN := $(TARGET_COPY_OUT_DATA)/asan
228TARGET_COPY_OUT_OEM := oem
229TARGET_COPY_OUT_RAMDISK := ramdisk
230TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk
231TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK := vendor_debug_ramdisk
232TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk
233TARGET_COPY_OUT_ROOT := root
234TARGET_COPY_OUT_RECOVERY := recovery
235# The directory used for optional partitions depend on the BoardConfig, so
236# they're defined to placeholder values here and swapped after reading the
237# BoardConfig, to be either the partition dir, or a subdir within 'system'.
238_vendor_path_placeholder := ||VENDOR-PATH-PH||
239_product_path_placeholder := ||PRODUCT-PATH-PH||
240_system_ext_path_placeholder := ||SYSTEM_EXT-PATH-PH||
241_odm_path_placeholder := ||ODM-PATH-PH||
242TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder)
243TARGET_COPY_OUT_VENDOR_RAMDISK := vendor-ramdisk
244TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder)
245# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will copy the target to
246# product
247TARGET_COPY_OUT_PRODUCT_SERVICES := $(_product_path_placeholder)
248TARGET_COPY_OUT_SYSTEM_EXT := $(_system_ext_path_placeholder)
249TARGET_COPY_OUT_ODM := $(_odm_path_placeholder)
250
251# Returns the non-sanitized version of the path provided in $1.
252define get_non_asan_path
253$(patsubst $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/%,$(PRODUCT_OUT)/%,$1)
254endef
255
256#################################################################
257# Set up minimal BOOTCLASSPATH list of jars to build/execute
258# java code with dalvikvm/art.
259# Jars present in the ART apex. These should match exactly the list of
260# Java libraries in the ART apex build rule.
261ART_APEX_JARS := core-oj core-libart core-icu4j okhttp bouncycastle apache-xml
262#################################################################
263
264# Read the product specs so we can get TARGET_DEVICE and other
265# variables that we need in order to locate the output files.
266include $(BUILD_SYSTEM)/product_config.mk
267
268build_variant := $(filter-out eng user userdebug,$(TARGET_BUILD_VARIANT))
269ifneq ($(build_variant)-$(words $(TARGET_BUILD_VARIANT)),-1)
270$(warning bad TARGET_BUILD_VARIANT: $(TARGET_BUILD_VARIANT))
271$(error must be empty or one of: eng user userdebug)
272endif
273
274SDK_HOST_ARCH := x86
275TARGET_OS := linux
276
277include $(BUILD_SYSTEM)/board_config.mk
278
279# the target build type defaults to release
280ifneq ($(TARGET_BUILD_TYPE),debug)
281TARGET_BUILD_TYPE := release
282endif
283
284# ---------------------------------------------------------------
285# figure out the output directories
286
287SOONG_OUT_DIR := $(OUT_DIR)/soong
288
289TARGET_OUT_ROOT := $(OUT_DIR)/target
290
291HOST_OUT_ROOT := $(OUT_DIR)/host
292
293.KATI_READONLY := SOONG_OUT_DIR TARGET_OUT_ROOT HOST_OUT_ROOT
294
295# We want to avoid two host bin directories in multilib build.
296HOST_OUT := $(HOST_OUT_ROOT)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
297SOONG_HOST_OUT := $(SOONG_OUT_DIR)/host/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
298
299HOST_CROSS_OUT := $(HOST_OUT_ROOT)/windows-$(HOST_PREBUILT_ARCH)
300
301.KATI_READONLY := HOST_OUT SOONG_HOST_OUT HOST_CROSS_OUT
302
303TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
304
305TARGET_COMMON_OUT_ROOT := $(TARGET_OUT_ROOT)/common
306HOST_COMMON_OUT_ROOT := $(HOST_OUT_ROOT)/common
307
308PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_DEVICE)
309
310.KATI_READONLY := TARGET_PRODUCT_OUT_ROOT TARGET_COMMON_OUT_ROOT HOST_COMMON_OUT_ROOT PRODUCT_OUT
311
312OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs
313OUT_NDK_DOCS := $(TARGET_COMMON_OUT_ROOT)/ndk-docs
314.KATI_READONLY := OUT_DOCS OUT_NDK_DOCS
315
316$(call KATI_obsolete,BUILD_OUT,Use HOST_OUT instead)
317
318BUILD_OUT_EXECUTABLES := $(HOST_OUT)/bin
319SOONG_HOST_OUT_EXECUTABLES := $(SOONG_HOST_OUT)/bin
320.KATI_READONLY := BUILD_OUT_EXECUTABLES SOONG_HOST_OUT_EXECUTABLES
321
322HOST_OUT_EXECUTABLES := $(HOST_OUT)/bin
323HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib64
324HOST_OUT_DYLIB_LIBRARIES := $(HOST_OUT)/lib64
325HOST_OUT_RENDERSCRIPT_BITCODE := $(HOST_OUT_SHARED_LIBRARIES)
326HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT)/framework
327HOST_OUT_SDK_ADDON := $(HOST_OUT)/sdk_addon
328HOST_OUT_NATIVE_TESTS := $(HOST_OUT)/nativetest64
329HOST_OUT_COVERAGE := $(HOST_OUT)/coverage
330HOST_OUT_TESTCASES := $(HOST_OUT)/testcases
331.KATI_READONLY := \
332  HOST_OUT_EXECUTABLES \
333  HOST_OUT_SHARED_LIBRARIES \
334  HOST_OUT_RENDERSCRIPT_BITCODE \
335  HOST_OUT_JAVA_LIBRARIES \
336  HOST_OUT_SDK_ADDON \
337  HOST_OUT_NATIVE_TESTS \
338  HOST_OUT_COVERAGE \
339  HOST_OUT_TESTCASES
340
341HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT)/bin
342HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib
343HOST_CROSS_OUT_NATIVE_TESTS := $(HOST_CROSS_OUT)/nativetest
344HOST_CROSS_OUT_COVERAGE := $(HOST_CROSS_OUT)/coverage
345HOST_CROSS_OUT_TESTCASES := $(HOST_CROSS_OUT)/testcases
346.KATI_READONLY := \
347  HOST_CROSS_OUT_EXECUTABLES \
348  HOST_CROSS_OUT_SHARED_LIBRARIES \
349  HOST_CROSS_OUT_NATIVE_TESTS \
350  HOST_CROSS_OUT_COVERAGE \
351  HOST_CROSS_OUT_TESTCASES
352
353HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
354HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
355HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
356HOST_OUT_FAKE := $(HOST_OUT)/fake_packages
357.KATI_READONLY := \
358  HOST_OUT_INTERMEDIATES \
359  HOST_OUT_NOTICE_FILES \
360  HOST_OUT_COMMON_INTERMEDIATES \
361  HOST_OUT_FAKE
362
363# Nano environment config
364include $(BUILD_SYSTEM)/aux_config.mk
365
366HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
367HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES
368.KATI_READONLY := \
369  HOST_CROSS_OUT_INTERMEDIATES \
370  HOST_CROSS_OUT_NOTICE_FILES
371
372HOST_OUT_GEN := $(HOST_OUT)/gen
373HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen
374.KATI_READONLY := \
375  HOST_OUT_GEN \
376  HOST_OUT_COMMON_GEN
377
378HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen
379.KATI_READONLY := HOST_CROSS_OUT_GEN
380
381HOST_OUT_TEST_CONFIG := $(HOST_OUT)/test_config
382.KATI_READONLY := HOST_OUT_TEST_CONFIG
383
384# Out for HOST_2ND_ARCH
385$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj32
386$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib
387$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES := $(HOST_OUT_EXECUTABLES)
388$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT_JAVA_LIBRARIES)
389$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_NATIVE_TESTS := $(HOST_OUT)/nativetest
390$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_TESTCASES := $(HOST_OUT_TESTCASES)
391.KATI_READONLY := \
392  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES \
393  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES \
394  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES \
395  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_JAVA_LIBRARIES \
396  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_NATIVE_TESTS \
397  $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_TESTCASES
398
399# The default host library path.
400# It always points to the path where we build libraries in the default bitness.
401HOST_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
402.KATI_READONLY := HOST_LIBRARY_PATH
403
404# Out for HOST_CROSS_2ND_ARCH
405$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj64
406$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib64
407$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT_EXECUTABLES)
408$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_NATIVE_TESTS := $(HOST_CROSS_OUT)/nativetest64
409.KATI_READONLY := \
410  $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATES \
411  $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_SHARED_LIBRARIES \
412  $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_EXECUTABLES \
413  $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_NATIVE_TESTS
414
415ifneq ($(filter address,$(SANITIZE_TARGET)),)
416  TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_asan
417else
418  TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
419endif
420TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include
421.KATI_READONLY := TARGET_OUT_INTERMEDIATES TARGET_OUT_HEADERS
422
423ifneq ($(filter address,$(SANITIZE_TARGET)),)
424  TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj_asan
425else
426  TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj
427endif
428.KATI_READONLY := TARGET_OUT_COMMON_INTERMEDIATES
429
430TARGET_OUT_GEN := $(PRODUCT_OUT)/gen
431TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen
432.KATI_READONLY := TARGET_OUT_GEN TARGET_OUT_COMMON_GEN
433
434TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
435.KATI_READONLY := TARGET_OUT
436ifneq ($(filter address,$(SANITIZE_TARGET)),)
437target_out_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
438ifeq ($(SANITIZE_LITE),true)
439# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
440# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
441target_out_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system
442else
443target_out_app_base := $(TARGET_OUT)
444endif
445else
446target_out_shared_libraries_base := $(TARGET_OUT)
447target_out_app_base := $(TARGET_OUT)
448endif
449
450TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin
451TARGET_OUT_OPTIONAL_EXECUTABLES := $(TARGET_OUT)/xbin
452ifeq ($(TARGET_IS_64_BIT),true)
453# /system/lib always contains 32-bit libraries,
454# and /system/lib64 (if present) always contains 64-bit libraries.
455TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib64
456else
457TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib
458endif
459TARGET_OUT_RENDERSCRIPT_BITCODE := $(TARGET_OUT_SHARED_LIBRARIES)
460TARGET_OUT_JAVA_LIBRARIES := $(TARGET_OUT)/framework
461TARGET_OUT_APPS := $(target_out_app_base)/app
462TARGET_OUT_APPS_PRIVILEGED := $(target_out_app_base)/priv-app
463TARGET_OUT_KEYLAYOUT := $(TARGET_OUT)/usr/keylayout
464TARGET_OUT_KEYCHARS := $(TARGET_OUT)/usr/keychars
465TARGET_OUT_ETC := $(TARGET_OUT)/etc
466TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
467TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
468TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases
469TARGET_OUT_TEST_CONFIG := $(PRODUCT_OUT)/test_config
470.KATI_READONLY := \
471  TARGET_OUT_EXECUTABLES \
472  TARGET_OUT_OPTIONAL_EXECUTABLES \
473  TARGET_OUT_SHARED_LIBRARIES \
474  TARGET_OUT_RENDERSCRIPT_BITCODE \
475  TARGET_OUT_JAVA_LIBRARIES \
476  TARGET_OUT_APPS \
477  TARGET_OUT_APPS_PRIVILEGED \
478  TARGET_OUT_KEYLAYOUT \
479  TARGET_OUT_KEYCHARS \
480  TARGET_OUT_ETC \
481  TARGET_OUT_NOTICE_FILES \
482  TARGET_OUT_FAKE \
483  TARGET_OUT_TESTCASES \
484  TARGET_OUT_TEST_CONFIG
485
486ifeq ($(SANITIZE_LITE),true)
487# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
488# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
489TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_OTHER)
490else
491TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_OTHER)
492endif
493.KATI_READONLY := TARGET_OUT_SYSTEM_OTHER
494
495# Out for TARGET_2ND_ARCH
496TARGET_2ND_ARCH_MODULE_SUFFIX := $(HOST_2ND_ARCH_MODULE_SUFFIX)
497.KATI_READONLY := TARGET_2ND_ARCH_MODULE_SUFFIX
498
499ifneq ($(filter address,$(SANITIZE_TARGET)),)
500  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)_asan
501else
502  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)
503endif
504$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib
505$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_RENDERSCRIPT_BITCODE := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES)
506$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
507$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS := $(TARGET_OUT_APPS)
508$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT_APPS_PRIVILEGED)
509$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_TESTCASES := $(TARGET_OUT_TESTCASES)
510.KATI_READONLY := \
511  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES \
512  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES \
513  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_RENDERSCRIPT_BITCODE \
514  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES \
515  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS \
516  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED \
517  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_TESTCASES
518
519MODULE_CLASS_APPS := app
520MODULE_CLASS_EXECUTABLES := bin
521MODULE_CLASS_JAVA_LIBRARIES := framework
522MODULE_CLASS_NATIVE_TESTS := nativetest
523MODULE_CLASS_METRIC_TESTS := benchmarktest
524TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
525TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
526TARGET_OUT_DATA_SHARED_LIBRARIES := $(TARGET_OUT_SHARED_LIBRARIES)
527TARGET_OUT_DATA_JAVA_LIBRARIES := $(TARGET_OUT_DATA)/framework
528TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA)/app
529TARGET_OUT_DATA_KEYLAYOUT := $(TARGET_OUT_KEYLAYOUT)
530TARGET_OUT_DATA_KEYCHARS := $(TARGET_OUT_KEYCHARS)
531TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC)
532ifeq ($(TARGET_IS_64_BIT),true)
533TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest64
534TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest64
535TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest64$(TARGET_VENDOR_TEST_SUFFIX)
536TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest64$(TARGET_VENDOR_TEST_SUFFIX)
537else
538TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
539TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest
540TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest$(TARGET_VENDOR_TEST_SUFFIX)
541TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest$(TARGET_VENDOR_TEST_SUFFIX)
542endif
543MODULE_CLASS_FAKE := fake_packages
544TARGET_OUT_DATA_FAKE := $(TARGET_OUT_DATA)/fake_packages
545.KATI_READONLY := \
546  TARGET_OUT_DATA \
547  TARGET_OUT_DATA_EXECUTABLES \
548  TARGET_OUT_DATA_SHARED_LIBRARIES \
549  TARGET_OUT_DATA_JAVA_LIBRARIES \
550  TARGET_OUT_DATA_APPS \
551  TARGET_OUT_DATA_KEYLAYOUT \
552  TARGET_OUT_DATA_KEYCHARS \
553  TARGET_OUT_DATA_ETC \
554  TARGET_OUT_DATA_NATIVE_TESTS \
555  TARGET_OUT_DATA_METRIC_TESTS \
556  TARGET_OUT_VENDOR_NATIVE_TESTS \
557  TARGET_OUT_VENDOR_METRIC_TESTS \
558  TARGET_OUT_DATA_FAKE \
559  MODULE_CLASS_APPS \
560  MODULE_CLASS_EXECUTABLES \
561  MODULE_CLASS_JAVA_LIBRARIES \
562  MODULE_CLASS_NATIVE_TESTS \
563  MODULE_CLASS_METRIC_TESTS \
564  MODULE_CLASS_FAKE
565
566$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_DATA_EXECUTABLES)
567$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES)
568$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA_APPS)
569$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
570$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest
571$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest$(TARGET_VENDOR_TEST_SUFFIX)
572$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest$(TARGET_VENDOR_TEST_SUFFIX)
573.KATI_READONLY := \
574  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES \
575  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES \
576  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_APPS \
577  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS \
578  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_METRIC_TESTS \
579  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_NATIVE_TESTS \
580  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_METRIC_TESTS \
581
582TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache
583.KATI_READONLY := TARGET_OUT_CACHE
584
585TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
586.KATI_READONLY := TARGET_OUT_VENDOR
587ifneq ($(filter address,$(SANITIZE_TARGET)),)
588target_out_vendor_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_VENDOR)
589ifeq ($(SANITIZE_LITE),true)
590# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
591# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
592target_out_vendor_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_VENDOR)
593else
594target_out_vendor_app_base := $(TARGET_OUT_VENDOR)
595endif
596else
597target_out_vendor_shared_libraries_base := $(TARGET_OUT_VENDOR)
598target_out_vendor_app_base := $(TARGET_OUT_VENDOR)
599endif
600
601TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR)/bin
602TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES := $(TARGET_OUT_VENDOR)/xbin
603ifeq ($(TARGET_IS_64_BIT),true)
604TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib64
605else
606TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib
607endif
608TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
609TARGET_OUT_VENDOR_JAVA_LIBRARIES := $(TARGET_OUT_VENDOR)/framework
610TARGET_OUT_VENDOR_APPS := $(target_out_vendor_app_base)/app
611TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(target_out_vendor_app_base)/priv-app
612TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc
613.KATI_READONLY := \
614  TARGET_OUT_VENDOR_EXECUTABLES \
615  TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES \
616  TARGET_OUT_VENDOR_SHARED_LIBRARIES \
617  TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE \
618  TARGET_OUT_VENDOR_JAVA_LIBRARIES \
619  TARGET_OUT_VENDOR_APPS \
620  TARGET_OUT_VENDOR_APPS_PRIVILEGED \
621  TARGET_OUT_VENDOR_ETC
622
623$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR_EXECUTABLES)
624$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib
625$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES)
626$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR_APPS)
627$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(TARGET_OUT_VENDOR_APPS_PRIVILEGED)
628.KATI_READONLY := \
629  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES \
630  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES \
631  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE \
632  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS \
633  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS_PRIVILEGED
634
635TARGET_OUT_OEM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_OEM)
636TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM)/bin
637ifeq ($(TARGET_IS_64_BIT),true)
638TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib64
639else
640TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib
641endif
642# We don't expect Java libraries in the oem.img.
643# TARGET_OUT_OEM_JAVA_LIBRARIES:= $(TARGET_OUT_OEM)/framework
644TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM)/app
645TARGET_OUT_OEM_ETC := $(TARGET_OUT_OEM)/etc
646.KATI_READONLY := \
647  TARGET_OUT_OEM \
648  TARGET_OUT_OEM_EXECUTABLES \
649  TARGET_OUT_OEM_SHARED_LIBRARIES \
650  TARGET_OUT_OEM_APPS \
651  TARGET_OUT_OEM_ETC
652
653$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM_EXECUTABLES)
654$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib
655$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM_APPS)
656.KATI_READONLY := \
657  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_EXECUTABLES \
658  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES \
659  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_APPS \
660
661TARGET_OUT_ODM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ODM)
662ifneq ($(filter address,$(SANITIZE_TARGET)),)
663target_out_odm_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_OEM)
664ifeq ($(SANITIZE_LITE),true)
665# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
666# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
667target_out_odm_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_OEM)
668else
669target_out_odm_app_base := $(TARGET_OUT_ODM)
670endif
671else
672target_out_odm_shared_libraries_base := $(TARGET_OUT_ODM)
673target_out_odm_app_base := $(TARGET_OUT_ODM)
674endif
675
676TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM)/bin
677TARGET_OUT_ODM_OPTIONAL_EXECUTABLES := $(TARGET_OUT_ODM)/xbin
678ifeq ($(TARGET_IS_64_BIT),true)
679TARGET_OUT_ODM_SHARED_LIBRARIES := $(target_out_odm_shared_libraries_base)/lib64
680else
681TARGET_OUT_ODM_SHARED_LIBRARIES := $(target_out_odm_shared_libraries_base)/lib
682endif
683TARGET_OUT_ODM_RENDERSCRIPT_BITCODE := $(TARGET_OUT_ODM_SHARED_LIBRARIES)
684TARGET_OUT_ODM_JAVA_LIBRARIES := $(TARGET_OUT_ODM)/framework
685TARGET_OUT_ODM_APPS := $(target_out_odm_app_base)/app
686TARGET_OUT_ODM_APPS_PRIVILEGED := $(target_out_odm_app_base)/priv-app
687TARGET_OUT_ODM_ETC := $(TARGET_OUT_ODM)/etc
688.KATI_READONLY := \
689  TARGET_OUT_ODM \
690  TARGET_OUT_ODM_EXECUTABLES \
691  TARGET_OUT_ODM_OPTIONAL_EXECUTABLES \
692  TARGET_OUT_ODM_SHARED_LIBRARIES \
693  TARGET_OUT_ODM_RENDERSCRIPT_BITCODE \
694  TARGET_OUT_ODM_JAVA_LIBRARIES \
695  TARGET_OUT_ODM_APPS \
696  TARGET_OUT_ODM_APPS_PRIVILEGED \
697  TARGET_OUT_ODM_ETC
698
699$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM_EXECUTABLES)
700$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES := $(target_out_odm_shared_libraries_base)/lib
701$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_RENDERSCRIPT_BITCODE := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES)
702$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM_APPS)
703$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS_PRIVILEGED := $(TARGET_OUT_ODM_APPS_PRIVILEGED)
704.KATI_READONLY := \
705  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_EXECUTABLES \
706  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES \
707  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_RENDERSCRIPT_BITCODE \
708  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS \
709  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS_PRIVILEGED
710
711TARGET_OUT_PRODUCT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT)
712TARGET_OUT_PRODUCT_EXECUTABLES := $(TARGET_OUT_PRODUCT)/bin
713.KATI_READONLY := TARGET_OUT_PRODUCT
714ifneq ($(filter address,$(SANITIZE_TARGET)),)
715target_out_product_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_PRODUCT)
716ifeq ($(SANITIZE_LITE),true)
717# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
718# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
719target_out_product_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_PRODUCT)
720else
721target_out_product_app_base := $(TARGET_OUT_PRODUCT)
722endif
723else
724target_out_product_shared_libraries_base := $(TARGET_OUT_PRODUCT)
725target_out_product_app_base := $(TARGET_OUT_PRODUCT)
726endif
727
728ifeq ($(TARGET_IS_64_BIT),true)
729TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib64
730else
731TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib
732endif
733TARGET_OUT_PRODUCT_JAVA_LIBRARIES := $(TARGET_OUT_PRODUCT)/framework
734TARGET_OUT_PRODUCT_APPS := $(target_out_product_app_base)/app
735TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(target_out_product_app_base)/priv-app
736TARGET_OUT_PRODUCT_ETC := $(TARGET_OUT_PRODUCT)/etc
737.KATI_READONLY := \
738  TARGET_OUT_PRODUCT_EXECUTABLES \
739  TARGET_OUT_PRODUCT_SHARED_LIBRARIES \
740  TARGET_OUT_PRODUCT_JAVA_LIBRARIES \
741  TARGET_OUT_PRODUCT_APPS \
742  TARGET_OUT_PRODUCT_APPS_PRIVILEGED \
743  TARGET_OUT_PRODUCT_ETC
744
745$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_EXECUTABLES := $(TARGET_OUT_PRODUCT_EXECUTABLES)
746$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib
747$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS := $(TARGET_OUT_PRODUCT_APPS)
748$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(TARGET_OUT_PRODUCT_APPS_PRIVILEGED)
749.KATI_READONLY := \
750  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_EXECUTABLES \
751  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES \
752  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS \
753  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED
754
755TARGET_OUT_SYSTEM_EXT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_EXT)
756ifneq ($(filter address,$(SANITIZE_TARGET)),)
757target_out_system_ext_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_EXT)
758ifeq ($(SANITIZE_LITE),true)
759# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
760# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
761target_out_system_ext_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_EXT)
762else
763target_out_system_ext_app_base := $(TARGET_OUT_SYSTEM_EXT)
764endif
765else
766target_out_system_ext_shared_libraries_base := $(TARGET_OUT_SYSTEM_EXT)
767target_out_system_ext_app_base := $(TARGET_OUT_SYSTEM_EXT)
768endif
769
770ifeq ($(TARGET_IS_64_BIT),true)
771TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib64
772else
773TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib
774endif
775TARGET_OUT_SYSTEM_EXT_JAVA_LIBRARIES:= $(TARGET_OUT_SYSTEM_EXT)/framework
776TARGET_OUT_SYSTEM_EXT_APPS := $(target_out_system_ext_app_base)/app
777TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED := $(target_out_system_ext_app_base)/priv-app
778TARGET_OUT_SYSTEM_EXT_ETC := $(TARGET_OUT_SYSTEM_EXT)/etc
779TARGET_OUT_SYSTEM_EXT_EXECUTABLES := $(TARGET_OUT_SYSTEM_EXT)/bin
780.KATI_READONLY := \
781  TARGET_OUT_SYSTEM_EXT_EXECUTABLES \
782  TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES \
783  TARGET_OUT_SYSTEM_EXT_JAVA_LIBRARIES \
784  TARGET_OUT_SYSTEM_EXT_APPS \
785  TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED \
786  TARGET_OUT_SYSTEM_EXT_ETC
787
788$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_EXECUTABLES := $(TARGET_OUT_SYSTEM_EXT_EXECUTABLES)
789$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib
790$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS := $(TARGET_OUT_SYSTEM_EXT_APPS)
791$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED := $(TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED)
792.KATI_READONLY := \
793  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_EXECUTABLES \
794  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES \
795  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS \
796  $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED
797
798TARGET_OUT_BREAKPAD := $(PRODUCT_OUT)/breakpad
799.KATI_READONLY := TARGET_OUT_BREAKPAD
800
801TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
802TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin
803TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/lib
804TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/$(TARGET_COPY_OUT_VENDOR)/lib
805TARGET_ROOT_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)
806TARGET_ROOT_OUT_BIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/bin
807TARGET_OUT_COVERAGE := $(PRODUCT_OUT)/coverage
808.KATI_READONLY := \
809  TARGET_OUT_UNSTRIPPED \
810  TARGET_OUT_EXECUTABLES_UNSTRIPPED \
811  TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED \
812  TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED \
813  TARGET_ROOT_OUT_UNSTRIPPED \
814  TARGET_ROOT_OUT_BIN_UNSTRIPPED \
815  TARGET_OUT_COVERAGE
816
817TARGET_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RAMDISK)
818TARGET_RAMDISK_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)
819TARGET_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DEBUG_RAMDISK)
820TARGET_VENDOR_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK)
821TARGET_TEST_HARNESS_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_TEST_HARNESS_RAMDISK)
822
823TARGET_VENDOR_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_RAMDISK)
824
825TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT)
826TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin
827TARGET_ROOT_OUT_ETC := $(TARGET_ROOT_OUT)/etc
828TARGET_ROOT_OUT_USR := $(TARGET_ROOT_OUT)/usr
829.KATI_READONLY := \
830  TARGET_ROOT_OUT \
831  TARGET_ROOT_OUT_BIN \
832  TARGET_ROOT_OUT_ETC \
833  TARGET_ROOT_OUT_USR
834
835TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RECOVERY)
836TARGET_RECOVERY_ROOT_OUT := $(TARGET_RECOVERY_OUT)/root
837.KATI_READONLY := \
838  TARGET_RECOVERY_OUT \
839  TARGET_RECOVERY_ROOT_OUT
840
841TARGET_SYSLOADER_OUT := $(PRODUCT_OUT)/sysloader
842TARGET_SYSLOADER_ROOT_OUT := $(TARGET_SYSLOADER_OUT)/root
843TARGET_SYSLOADER_SYSTEM_OUT := $(TARGET_SYSLOADER_OUT)/root/system
844.KATI_READONLY := \
845  TARGET_SYSLOADER_OUT \
846  TARGET_SYSLOADER_ROOT_OUT \
847  TARGET_SYSLOADER_SYSTEM_OUT
848
849TARGET_INSTALLER_OUT := $(PRODUCT_OUT)/installer
850TARGET_INSTALLER_DATA_OUT := $(TARGET_INSTALLER_OUT)/data
851TARGET_INSTALLER_ROOT_OUT := $(TARGET_INSTALLER_OUT)/root
852TARGET_INSTALLER_SYSTEM_OUT := $(TARGET_INSTALLER_OUT)/root/system
853.KATI_READONLY := \
854  TARGET_INSTALLER_OUT \
855  TARGET_INSTALLER_DATA_OUT \
856  TARGET_INSTALLER_ROOT_OUT \
857  TARGET_INSTALLER_SYSTEM_OUT
858
859COMMON_MODULE_CLASSES := TARGET_NOTICE_FILES HOST_NOTICE_FILES HOST_JAVA_LIBRARIES
860PER_ARCH_MODULE_CLASSES := SHARED_LIBRARIES STATIC_LIBRARIES EXECUTABLES GYP RENDERSCRIPT_BITCODE NATIVE_TESTS HEADER_LIBRARIES RLIB_LIBRARIES DYLIB_LIBRARIES
861.KATI_READONLY := COMMON_MODULE_CLASSES PER_ARCH_MODULE_CLASSES
862
863ifeq ($(CALLED_FROM_SETUP),true)
864PRINT_BUILD_CONFIG ?= true
865endif
866