Android.mk revision 4d77b6a511659f26fdc711e23825ffa6e7feed7a
1#
2# Copyright (C) 2011 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19include art/build/Android.common_build.mk
20
21LIBART_COMMON_SRC_FILES := \
22  art_field.cc \
23  art_method.cc \
24  atomic.cc.arm \
25  barrier.cc \
26  base/allocator.cc \
27  base/arena_allocator.cc \
28  base/arena_bit_vector.cc \
29  base/bit_vector.cc \
30  base/file_magic.cc \
31  base/hex_dump.cc \
32  base/logging.cc \
33  base/mutex.cc \
34  base/scoped_arena_allocator.cc \
35  base/scoped_flock.cc \
36  base/stringpiece.cc \
37  base/stringprintf.cc \
38  base/time_utils.cc \
39  base/timing_logger.cc \
40  base/unix_file/fd_file.cc \
41  base/unix_file/random_access_file_utils.cc \
42  check_jni.cc \
43  class_linker.cc \
44  class_table.cc \
45  code_simulator_container.cc \
46  common_throws.cc \
47  debugger.cc \
48  dex_file.cc \
49  dex_file_verifier.cc \
50  dex_instruction.cc \
51  elf_file.cc \
52  fault_handler.cc \
53  gc/allocation_record.cc \
54  gc/allocator/dlmalloc.cc \
55  gc/allocator/rosalloc.cc \
56  gc/accounting/bitmap.cc \
57  gc/accounting/card_table.cc \
58  gc/accounting/heap_bitmap.cc \
59  gc/accounting/mod_union_table.cc \
60  gc/accounting/remembered_set.cc \
61  gc/accounting/space_bitmap.cc \
62  gc/collector/concurrent_copying.cc \
63  gc/collector/garbage_collector.cc \
64  gc/collector/immune_region.cc \
65  gc/collector/immune_spaces.cc \
66  gc/collector/mark_compact.cc \
67  gc/collector/mark_sweep.cc \
68  gc/collector/partial_mark_sweep.cc \
69  gc/collector/semi_space.cc \
70  gc/collector/sticky_mark_sweep.cc \
71  gc/gc_cause.cc \
72  gc/heap.cc \
73  gc/reference_processor.cc \
74  gc/reference_queue.cc \
75  gc/scoped_gc_critical_section.cc \
76  gc/space/bump_pointer_space.cc \
77  gc/space/dlmalloc_space.cc \
78  gc/space/image_space.cc \
79  gc/space/large_object_space.cc \
80  gc/space/malloc_space.cc \
81  gc/space/region_space.cc \
82  gc/space/rosalloc_space.cc \
83  gc/space/space.cc \
84  gc/space/zygote_space.cc \
85  gc/task_processor.cc \
86  hprof/hprof.cc \
87  image.cc \
88  indirect_reference_table.cc \
89  instrumentation.cc \
90  intern_table.cc \
91  interpreter/interpreter.cc \
92  interpreter/interpreter_common.cc \
93  interpreter/interpreter_goto_table_impl.cc \
94  interpreter/interpreter_switch_impl.cc \
95  interpreter/unstarted_runtime.cc \
96  java_vm_ext.cc \
97  jdwp/jdwp_event.cc \
98  jdwp/jdwp_expand_buf.cc \
99  jdwp/jdwp_handler.cc \
100  jdwp/jdwp_main.cc \
101  jdwp/jdwp_request.cc \
102  jdwp/jdwp_socket.cc \
103  jdwp/object_registry.cc \
104  jni_env_ext.cc \
105  jit/jit.cc \
106  jit/jit_code_cache.cc \
107  jit/jit_instrumentation.cc \
108  jit/offline_profiling_info.cc \
109  jit/profiling_info.cc \
110  jit/profile_saver.cc  \
111  lambda/art_lambda_method.cc \
112  lambda/box_table.cc \
113  lambda/closure.cc \
114  lambda/closure_builder.cc \
115  lambda/leaking_allocator.cc \
116  jni_internal.cc \
117  jobject_comparator.cc \
118  linear_alloc.cc \
119  mem_map.cc \
120  memory_region.cc \
121  mirror/abstract_method.cc \
122  mirror/array.cc \
123  mirror/class.cc \
124  mirror/dex_cache.cc \
125  mirror/field.cc \
126  mirror/method.cc \
127  mirror/object.cc \
128  mirror/reference.cc \
129  mirror/stack_trace_element.cc \
130  mirror/string.cc \
131  mirror/throwable.cc \
132  monitor.cc \
133  native_bridge_art_interface.cc \
134  native/dalvik_system_DexFile.cc \
135  native/dalvik_system_VMDebug.cc \
136  native/dalvik_system_VMRuntime.cc \
137  native/dalvik_system_VMStack.cc \
138  native/dalvik_system_ZygoteHooks.cc \
139  native/java_lang_Class.cc \
140  native/java_lang_DexCache.cc \
141  native/java_lang_Object.cc \
142  native/java_lang_Runtime.cc \
143  native/java_lang_String.cc \
144  native/java_lang_StringFactory.cc \
145  native/java_lang_System.cc \
146  native/java_lang_Thread.cc \
147  native/java_lang_Throwable.cc \
148  native/java_lang_VMClassLoader.cc \
149  native/java_lang_ref_FinalizerReference.cc \
150  native/java_lang_ref_Reference.cc \
151  native/java_lang_reflect_Array.cc \
152  native/java_lang_reflect_Constructor.cc \
153  native/java_lang_reflect_Field.cc \
154  native/java_lang_reflect_Method.cc \
155  native/java_lang_reflect_Proxy.cc \
156  native/java_util_concurrent_atomic_AtomicLong.cc \
157  native/libcore_util_CharsetUtils.cc \
158  native/org_apache_harmony_dalvik_ddmc_DdmServer.cc \
159  native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc \
160  native/sun_misc_Unsafe.cc \
161  oat.cc \
162  oat_file.cc \
163  oat_file_assistant.cc \
164  oat_file_manager.cc \
165  oat_quick_method_header.cc \
166  object_lock.cc \
167  offsets.cc \
168  os_linux.cc \
169  parsed_options.cc \
170  primitive.cc \
171  profiler.cc \
172  quick_exception_handler.cc \
173  quick/inline_method_analyser.cc \
174  reference_table.cc \
175  reflection.cc \
176  runtime.cc \
177  runtime_options.cc \
178  signal_catcher.cc \
179  stack.cc \
180  stack_map.cc \
181  thread.cc \
182  thread_list.cc \
183  thread_pool.cc \
184  trace.cc \
185  transaction.cc \
186  type_lookup_table.cc \
187  utf.cc \
188  utils.cc \
189  verifier/dex_gc_map.cc \
190  verifier/instruction_flags.cc \
191  verifier/method_verifier.cc \
192  verifier/reg_type.cc \
193  verifier/reg_type_cache.cc \
194  verifier/register_line.cc \
195  well_known_classes.cc \
196  zip_archive.cc
197
198LIBART_COMMON_SRC_FILES += \
199  arch/context.cc \
200  arch/instruction_set.cc \
201  arch/instruction_set_features.cc \
202  arch/memcmp16.cc \
203  arch/arm/instruction_set_features_arm.cc \
204  arch/arm/registers_arm.cc \
205  arch/arm64/instruction_set_features_arm64.cc \
206  arch/arm64/registers_arm64.cc \
207  arch/mips/instruction_set_features_mips.cc \
208  arch/mips/registers_mips.cc \
209  arch/mips64/instruction_set_features_mips64.cc \
210  arch/mips64/registers_mips64.cc \
211  arch/x86/instruction_set_features_x86.cc \
212  arch/x86/registers_x86.cc \
213  arch/x86_64/registers_x86_64.cc \
214  entrypoints/entrypoint_utils.cc \
215  entrypoints/jni/jni_entrypoints.cc \
216  entrypoints/math_entrypoints.cc \
217  entrypoints/quick/quick_alloc_entrypoints.cc \
218  entrypoints/quick/quick_cast_entrypoints.cc \
219  entrypoints/quick/quick_deoptimization_entrypoints.cc \
220  entrypoints/quick/quick_dexcache_entrypoints.cc \
221  entrypoints/quick/quick_field_entrypoints.cc \
222  entrypoints/quick/quick_fillarray_entrypoints.cc \
223  entrypoints/quick/quick_instrumentation_entrypoints.cc \
224  entrypoints/quick/quick_jni_entrypoints.cc \
225  entrypoints/quick/quick_lock_entrypoints.cc \
226  entrypoints/quick/quick_math_entrypoints.cc \
227  entrypoints/quick/quick_thread_entrypoints.cc \
228  entrypoints/quick/quick_throw_entrypoints.cc \
229  entrypoints/quick/quick_trampoline_entrypoints.cc
230
231LIBART_TARGET_LDFLAGS :=
232LIBART_HOST_LDFLAGS :=
233
234# Keep the __jit_debug_register_code symbol as a unique symbol during ICF for architectures where
235# we use gold as the linker (arm, x86, x86_64). The symbol is used by the debuggers to detect when
236# new jit code is generated. We don't want it to be called when a different function with the same
237# (empty) body is called.
238JIT_DEBUG_REGISTER_CODE_LDFLAGS := -Wl,--keep-unique,__jit_debug_register_code
239LIBART_TARGET_LDFLAGS_arm    := $(JIT_DEBUG_REGISTER_CODE_LDFLAGS)
240LIBART_TARGET_LDFLAGS_x86    := $(JIT_DEBUG_REGISTER_CODE_LDFLAGS)
241LIBART_TARGET_LDFLAGS_x86_64 := $(JIT_DEBUG_REGISTER_CODE_LDFLAGS)
242JIT_DEBUG_REGISTER_CODE_LDFLAGS :=
243
244LIBART_TARGET_SRC_FILES := \
245  $(LIBART_COMMON_SRC_FILES) \
246  jdwp/jdwp_adb.cc \
247  monitor_android.cc \
248  runtime_android.cc \
249  thread_android.cc
250
251LIBART_TARGET_SRC_FILES_arm := \
252  arch/arm/context_arm.cc.arm \
253  arch/arm/entrypoints_init_arm.cc \
254  arch/arm/instruction_set_features_assembly_tests.S \
255  arch/arm/jni_entrypoints_arm.S \
256  arch/arm/memcmp16_arm.S \
257  arch/arm/quick_entrypoints_arm.S \
258  arch/arm/quick_entrypoints_cc_arm.cc \
259  arch/arm/thread_arm.cc \
260  arch/arm/fault_handler_arm.cc
261
262LIBART_TARGET_SRC_FILES_arm64 := \
263  arch/arm64/context_arm64.cc \
264  arch/arm64/entrypoints_init_arm64.cc \
265  arch/arm64/jni_entrypoints_arm64.S \
266  arch/arm64/memcmp16_arm64.S \
267  arch/arm64/quick_entrypoints_arm64.S \
268  arch/arm64/thread_arm64.cc \
269  monitor_pool.cc \
270  arch/arm64/fault_handler_arm64.cc
271
272LIBART_SRC_FILES_x86 := \
273  arch/x86/context_x86.cc \
274  arch/x86/entrypoints_init_x86.cc \
275  arch/x86/jni_entrypoints_x86.S \
276  arch/x86/memcmp16_x86.S \
277  arch/x86/quick_entrypoints_x86.S \
278  arch/x86/thread_x86.cc \
279  arch/x86/fault_handler_x86.cc
280
281LIBART_TARGET_SRC_FILES_x86 := \
282  $(LIBART_SRC_FILES_x86)
283
284# Note that the fault_handler_x86.cc is not a mistake.  This file is
285# shared between the x86 and x86_64 architectures.
286LIBART_SRC_FILES_x86_64 := \
287  arch/x86_64/context_x86_64.cc \
288  arch/x86_64/entrypoints_init_x86_64.cc \
289  arch/x86_64/jni_entrypoints_x86_64.S \
290  arch/x86_64/memcmp16_x86_64.S \
291  arch/x86_64/quick_entrypoints_x86_64.S \
292  arch/x86_64/thread_x86_64.cc \
293  monitor_pool.cc \
294  arch/x86/fault_handler_x86.cc
295
296LIBART_TARGET_SRC_FILES_x86_64 := \
297  $(LIBART_SRC_FILES_x86_64) \
298
299LIBART_TARGET_SRC_FILES_mips := \
300  arch/mips/context_mips.cc \
301  arch/mips/entrypoints_init_mips.cc \
302  arch/mips/jni_entrypoints_mips.S \
303  arch/mips/memcmp16_mips.S \
304  arch/mips/quick_entrypoints_mips.S \
305  arch/mips/thread_mips.cc \
306  arch/mips/fault_handler_mips.cc
307
308LIBART_TARGET_SRC_FILES_mips64 := \
309  arch/mips64/context_mips64.cc \
310  arch/mips64/entrypoints_init_mips64.cc \
311  arch/mips64/jni_entrypoints_mips64.S \
312  arch/mips64/memcmp16_mips64.S \
313  arch/mips64/quick_entrypoints_mips64.S \
314  arch/mips64/thread_mips64.cc \
315  monitor_pool.cc \
316  arch/mips64/fault_handler_mips64.cc
317
318LIBART_HOST_SRC_FILES := \
319  $(LIBART_COMMON_SRC_FILES) \
320  monitor_linux.cc \
321  runtime_linux.cc \
322  thread_linux.cc
323
324LIBART_HOST_SRC_FILES_32 := \
325  $(LIBART_SRC_FILES_x86)
326
327LIBART_HOST_SRC_FILES_64 := \
328  $(LIBART_SRC_FILES_x86_64)
329
330LIBART_ENUM_OPERATOR_OUT_HEADER_FILES := \
331  arch/instruction_set.h \
332  base/allocator.h \
333  base/mutex.h \
334  debugger.h \
335  base/unix_file/fd_file.h \
336  dex_file.h \
337  dex_instruction.h \
338  dex_instruction_utils.h \
339  gc_root.h \
340  gc/allocator_type.h \
341  gc/allocator/rosalloc.h \
342  gc/collector_type.h \
343  gc/collector/gc_type.h \
344  gc/heap.h \
345  gc/space/region_space.h \
346  gc/space/space.h \
347  gc/weak_root_state.h \
348  image.h \
349  instrumentation.h \
350  indirect_reference_table.h \
351  invoke_type.h \
352  jdwp/jdwp.h \
353  jdwp/jdwp_constants.h \
354  lock_word.h \
355  mirror/class.h \
356  oat.h \
357  object_callbacks.h \
358  profiler_options.h \
359  quick/inline_method_analyser.h \
360  runtime.h \
361  stack.h \
362  thread.h \
363  thread_state.h \
364  verifier/method_verifier.h
365
366LIBART_CFLAGS := -DBUILDING_LIBART=1
367
368LIBART_TARGET_CFLAGS :=
369LIBART_HOST_CFLAGS :=
370
371ifeq ($(MALLOC_IMPL),dlmalloc)
372  LIBART_TARGET_CFLAGS += -DUSE_DLMALLOC
373else
374  LIBART_TARGET_CFLAGS += -DUSE_JEMALLOC
375endif
376
377# Default dex2oat instruction set features.
378LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES := default
379LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
3802ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
381ifeq ($(DEX2OAT_TARGET_ARCH),arm)
382  ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
383    LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
384  else
385    ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
386      LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
387    endif
388  endif
389endif
390ifeq ($(2ND_DEX2OAT_TARGET_ARCH),arm)
391  ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
392    2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
393  else
394    ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
395      2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
396    endif
397  endif
398endif
399
400# $(1): target or host
401# $(2): ndebug or debug
402# $(3): static or shared (empty means shared, applies only for host)
403define build-libart
404  ifneq ($(1),target)
405    ifneq ($(1),host)
406      $$(error expected target or host for argument 1, received $(1))
407    endif
408  endif
409  ifneq ($(2),ndebug)
410    ifneq ($(2),debug)
411      $$(error expected ndebug or debug for argument 2, received $(2))
412    endif
413  endif
414
415  art_target_or_host := $(1)
416  art_ndebug_or_debug := $(2)
417  art_static_or_shared := $(3)
418
419  include $$(CLEAR_VARS)
420  LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION)
421  ifeq ($$(art_ndebug_or_debug),ndebug)
422    LOCAL_MODULE := libart
423    ifeq ($$(art_target_or_host),target)
424      LOCAL_FDO_SUPPORT := true
425    endif
426  else # debug
427    LOCAL_MODULE := libartd
428  endif
429
430  LOCAL_MODULE_TAGS := optional
431
432  ifeq ($$(art_static_or_shared),static)
433    LOCAL_MODULE_CLASS := STATIC_LIBRARIES
434  else
435    LOCAL_MODULE_CLASS := SHARED_LIBRARIES
436  endif
437
438  ifeq ($$(art_target_or_host),target)
439    LOCAL_SRC_FILES := $$(LIBART_TARGET_SRC_FILES)
440    $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
441      $$(eval LOCAL_SRC_FILES_$$(arch) := $$$$(LIBART_TARGET_SRC_FILES_$$(arch))))
442  else # host
443    LOCAL_SRC_FILES := $$(LIBART_HOST_SRC_FILES)
444    LOCAL_SRC_FILES_32 := $$(LIBART_HOST_SRC_FILES_32)
445    LOCAL_SRC_FILES_64 := $$(LIBART_HOST_SRC_FILES_64)
446    LOCAL_IS_HOST_MODULE := true
447  endif
448
449  GENERATED_SRC_DIR := $$(call local-generated-sources-dir)
450  ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES))
451  ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES))
452
453$$(ENUM_OPERATOR_OUT_GEN): art/tools/generate-operator-out.py
454$$(ENUM_OPERATOR_OUT_GEN): PRIVATE_CUSTOM_TOOL = art/tools/generate-operator-out.py $(LOCAL_PATH) $$< > $$@
455$$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PATH)/%.h
456	$$(transform-generated-source)
457
458  LOCAL_GENERATED_SOURCES += $$(ENUM_OPERATOR_OUT_GEN)
459
460  LOCAL_CFLAGS := $$(LIBART_CFLAGS)
461  LOCAL_LDFLAGS := $$(LIBART_LDFLAGS)
462  ifeq ($$(art_target_or_host),target)
463    LOCAL_CFLAGS += $$(LIBART_TARGET_CFLAGS)
464    LOCAL_LDFLAGS += $$(LIBART_TARGET_LDFLAGS)
465    $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
466      $$(eval LOCAL_LDFLAGS_$$(arch) := $$(LIBART_TARGET_LDFLAGS_$$(arch))))
467  else #host
468    LOCAL_CFLAGS += $$(LIBART_HOST_CFLAGS)
469    LOCAL_LDFLAGS += $$(LIBART_HOST_LDFLAGS)
470    ifeq ($$(art_static_or_shared),static)
471      LOCAL_LDFLAGS += -static
472    endif
473  endif
474
475  # Clang usage
476  ifeq ($$(art_target_or_host),target)
477    $$(eval $$(call set-target-local-clang-vars))
478    $$(eval $$(call set-target-local-cflags-vars,$(2)))
479    LOCAL_CFLAGS_$(DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
480    LOCAL_CFLAGS_$(2ND_DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
481  else # host
482    LOCAL_CLANG := $$(ART_HOST_CLANG)
483    LOCAL_LDLIBS := $$(ART_HOST_LDLIBS)
484    LOCAL_LDLIBS += -ldl -lpthread
485    ifeq ($$(HOST_OS),linux)
486      LOCAL_LDLIBS += -lrt
487    endif
488    LOCAL_CFLAGS += $$(ART_HOST_CFLAGS)
489    LOCAL_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES)"
490    LOCAL_ASFLAGS += $$(ART_HOST_ASFLAGS)
491
492    ifeq ($$(art_ndebug_or_debug),debug)
493      LOCAL_CFLAGS += $$(ART_HOST_DEBUG_CFLAGS)
494    else
495      LOCAL_CFLAGS += $$(ART_HOST_NON_DEBUG_CFLAGS)
496    endif
497    LOCAL_MULTILIB := both
498  endif
499
500  LOCAL_C_INCLUDES += $$(ART_C_INCLUDES)
501  LOCAL_C_INCLUDES += art/cmdline
502  LOCAL_C_INCLUDES += art/sigchainlib
503  LOCAL_C_INCLUDES += art
504
505  ifeq ($$(art_static_or_shared),static)
506    LOCAL_STATIC_LIBRARIES := libnativehelper
507    LOCAL_STATIC_LIBRARIES += libnativebridge
508    LOCAL_STATIC_LIBRARIES += libnativeloader
509    LOCAL_STATIC_LIBRARIES += libsigchain_dummy
510    LOCAL_STATIC_LIBRARIES += libbacktrace
511    LOCAL_STATIC_LIBRARIES += liblz4
512  else
513    LOCAL_SHARED_LIBRARIES := libnativehelper
514    LOCAL_SHARED_LIBRARIES += libnativebridge
515    LOCAL_SHARED_LIBRARIES += libnativeloader
516    LOCAL_SHARED_LIBRARIES += libsigchain
517    LOCAL_SHARED_LIBRARIES += libbacktrace
518    LOCAL_SHARED_LIBRARIES += liblz4
519  endif
520
521  ifeq ($$(art_target_or_host),target)
522    LOCAL_SHARED_LIBRARIES += libdl
523    # ZipArchive support, the order matters here to get all symbols.
524    LOCAL_STATIC_LIBRARIES := libziparchive libz libbase
525    # For android::FileMap used by libziparchive.
526    LOCAL_SHARED_LIBRARIES += libutils
527    # For liblog, atrace, properties, ashmem, set_sched_policy and socket_peer_is_trusted.
528    LOCAL_SHARED_LIBRARIES += libcutils
529  else # host
530    ifeq ($$(art_static_or_shared),static)
531      LOCAL_STATIC_LIBRARIES += libziparchive-host libz
532      # For ashmem_create_region.
533      LOCAL_STATIC_LIBRARIES += libcutils
534    else
535      LOCAL_SHARED_LIBRARIES += libziparchive-host libz-host
536      # For ashmem_create_region.
537      LOCAL_SHARED_LIBRARIES += libcutils
538    endif
539  endif
540  LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
541  LOCAL_ADDITIONAL_DEPENDENCIES += $$(LOCAL_PATH)/Android.mk
542
543  ifeq ($$(art_target_or_host),target)
544    LOCAL_MODULE_TARGET_ARCH := $$(ART_TARGET_SUPPORTED_ARCH)
545  endif
546
547  LOCAL_NATIVE_COVERAGE := $(ART_COVERAGE)
548
549  ifeq ($$(art_target_or_host),target)
550    ifneq ($$(art_ndebug_or_debug),debug)
551      # Leave the symbols in the shared library so that stack unwinders can
552      # produce meaningful name resolution.
553      LOCAL_STRIP_MODULE := keep_symbols
554    endif
555    include $$(BUILD_SHARED_LIBRARY)
556  else # host
557    ifeq ($$(art_static_or_shared),static)
558      include $$(BUILD_HOST_STATIC_LIBRARY)
559    else
560      include $$(BUILD_HOST_SHARED_LIBRARY)
561    endif
562  endif
563
564  # Clear locally defined variables.
565  GENERATED_SRC_DIR :=
566  ENUM_OPERATOR_OUT_CC_FILES :=
567  ENUM_OPERATOR_OUT_GEN :=
568  art_target_or_host :=
569  art_ndebug_or_debug :=
570  art_static_or_shared :=
571endef
572
573# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since
574# they are used to cross compile for the target.
575ifeq ($(ART_BUILD_HOST_NDEBUG),true)
576  $(eval $(call build-libart,host,ndebug))
577  ifeq ($(ART_BUILD_HOST_STATIC),true)
578    $(eval $(call build-libart,host,ndebug,static))
579  endif
580endif
581ifeq ($(ART_BUILD_HOST_DEBUG),true)
582  $(eval $(call build-libart,host,debug))
583  ifeq ($(ART_BUILD_HOST_STATIC),true)
584    $(eval $(call build-libart,host,debug,static))
585  endif
586endif
587
588ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
589#  $(error $(call build-libart,target,ndebug))
590  $(eval $(call build-libart,target,ndebug))
591endif
592ifeq ($(ART_BUILD_TARGET_DEBUG),true)
593  $(eval $(call build-libart,target,debug))
594endif
595
596# Clear locally defined variables.
597LOCAL_PATH :=
598LIBART_COMMON_SRC_FILES :=
599LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES :=
600LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
6012ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
602LIBART_HOST_LDFLAGS :=
603LIBART_TARGET_LDFLAGS :=
604LIBART_TARGET_LDFLAGS_arm :=
605LIBART_TARGET_LDFLAGS_arm64 :=
606LIBART_TARGET_LDFLAGS_x86 :=
607LIBART_TARGET_LDFLAGS_x86_64 :=
608LIBART_TARGET_LDFLAGS_mips :=
609LIBART_TARGET_LDFLAGS_mips64 :=
610LIBART_TARGET_SRC_FILES :=
611LIBART_TARGET_SRC_FILES_arm :=
612LIBART_TARGET_SRC_FILES_arm64 :=
613LIBART_TARGET_SRC_FILES_x86 :=
614LIBART_TARGET_SRC_FILES_x86_64 :=
615LIBART_TARGET_SRC_FILES_mips :=
616LIBART_TARGET_SRC_FILES_mips64 :=
617LIBART_HOST_SRC_FILES :=
618LIBART_HOST_SRC_FILES_32 :=
619LIBART_HOST_SRC_FILES_64 :=
620LIBART_ENUM_OPERATOR_OUT_HEADER_FILES :=
621LIBART_CFLAGS :=
622LIBART_TARGET_CFLAGS :=
623LIBART_HOST_CFLAGS :=
624build-libart :=
625