Android.mk revision e0c269e0a5f50b1a551ddba1205f6e5b4b5e6c98
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/debugger_interface.cc \
106  jit/jit.cc \
107  jit/jit_code_cache.cc \
108  jit/jit_instrumentation.cc \
109  jit/offline_profiling_info.cc \
110  jit/profiling_info.cc \
111  jit/profile_saver.cc  \
112  lambda/art_lambda_method.cc \
113  lambda/box_table.cc \
114  lambda/closure.cc \
115  lambda/closure_builder.cc \
116  lambda/leaking_allocator.cc \
117  jni_internal.cc \
118  jobject_comparator.cc \
119  linear_alloc.cc \
120  mem_map.cc \
121  memory_region.cc \
122  mirror/abstract_method.cc \
123  mirror/array.cc \
124  mirror/class.cc \
125  mirror/dex_cache.cc \
126  mirror/field.cc \
127  mirror/method.cc \
128  mirror/object.cc \
129  mirror/reference.cc \
130  mirror/stack_trace_element.cc \
131  mirror/string.cc \
132  mirror/throwable.cc \
133  monitor.cc \
134  native_bridge_art_interface.cc \
135  native/dalvik_system_DexFile.cc \
136  native/dalvik_system_VMDebug.cc \
137  native/dalvik_system_VMRuntime.cc \
138  native/dalvik_system_VMStack.cc \
139  native/dalvik_system_ZygoteHooks.cc \
140  native/java_lang_Class.cc \
141  native/java_lang_DexCache.cc \
142  native/java_lang_Object.cc \
143  native/java_lang_Runtime.cc \
144  native/java_lang_String.cc \
145  native/java_lang_StringFactory.cc \
146  native/java_lang_System.cc \
147  native/java_lang_Thread.cc \
148  native/java_lang_Throwable.cc \
149  native/java_lang_VMClassLoader.cc \
150  native/java_lang_ref_FinalizerReference.cc \
151  native/java_lang_ref_Reference.cc \
152  native/java_lang_reflect_Array.cc \
153  native/java_lang_reflect_Constructor.cc \
154  native/java_lang_reflect_Field.cc \
155  native/java_lang_reflect_Method.cc \
156  native/java_lang_reflect_Proxy.cc \
157  native/java_util_concurrent_atomic_AtomicLong.cc \
158  native/libcore_util_CharsetUtils.cc \
159  native/org_apache_harmony_dalvik_ddmc_DdmServer.cc \
160  native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc \
161  native/sun_misc_Unsafe.cc \
162  oat.cc \
163  oat_file.cc \
164  oat_file_assistant.cc \
165  oat_file_manager.cc \
166  oat_quick_method_header.cc \
167  object_lock.cc \
168  offsets.cc \
169  os_linux.cc \
170  parsed_options.cc \
171  primitive.cc \
172  profiler.cc \
173  quick_exception_handler.cc \
174  quick/inline_method_analyser.cc \
175  reference_table.cc \
176  reflection.cc \
177  runtime.cc \
178  runtime_options.cc \
179  signal_catcher.cc \
180  stack.cc \
181  stack_map.cc \
182  thread.cc \
183  thread_list.cc \
184  thread_pool.cc \
185  trace.cc \
186  transaction.cc \
187  type_lookup_table.cc \
188  utf.cc \
189  utils.cc \
190  verifier/dex_gc_map.cc \
191  verifier/instruction_flags.cc \
192  verifier/method_verifier.cc \
193  verifier/reg_type.cc \
194  verifier/reg_type_cache.cc \
195  verifier/register_line.cc \
196  well_known_classes.cc \
197  zip_archive.cc
198
199LIBART_COMMON_SRC_FILES += \
200  arch/context.cc \
201  arch/instruction_set.cc \
202  arch/instruction_set_features.cc \
203  arch/memcmp16.cc \
204  arch/arm/instruction_set_features_arm.cc \
205  arch/arm/registers_arm.cc \
206  arch/arm64/instruction_set_features_arm64.cc \
207  arch/arm64/registers_arm64.cc \
208  arch/mips/instruction_set_features_mips.cc \
209  arch/mips/registers_mips.cc \
210  arch/mips64/instruction_set_features_mips64.cc \
211  arch/mips64/registers_mips64.cc \
212  arch/x86/instruction_set_features_x86.cc \
213  arch/x86/registers_x86.cc \
214  arch/x86_64/registers_x86_64.cc \
215  entrypoints/entrypoint_utils.cc \
216  entrypoints/jni/jni_entrypoints.cc \
217  entrypoints/math_entrypoints.cc \
218  entrypoints/quick/quick_alloc_entrypoints.cc \
219  entrypoints/quick/quick_cast_entrypoints.cc \
220  entrypoints/quick/quick_deoptimization_entrypoints.cc \
221  entrypoints/quick/quick_dexcache_entrypoints.cc \
222  entrypoints/quick/quick_field_entrypoints.cc \
223  entrypoints/quick/quick_fillarray_entrypoints.cc \
224  entrypoints/quick/quick_instrumentation_entrypoints.cc \
225  entrypoints/quick/quick_jni_entrypoints.cc \
226  entrypoints/quick/quick_lock_entrypoints.cc \
227  entrypoints/quick/quick_math_entrypoints.cc \
228  entrypoints/quick/quick_thread_entrypoints.cc \
229  entrypoints/quick/quick_throw_entrypoints.cc \
230  entrypoints/quick/quick_trampoline_entrypoints.cc
231
232LIBART_TARGET_LDFLAGS :=
233LIBART_HOST_LDFLAGS :=
234
235# Keep the __jit_debug_register_code symbol as a unique symbol during ICF for architectures where
236# we use gold as the linker (arm, x86, x86_64). The symbol is used by the debuggers to detect when
237# new jit code is generated. We don't want it to be called when a different function with the same
238# (empty) body is called.
239JIT_DEBUG_REGISTER_CODE_LDFLAGS := -Wl,--keep-unique,__jit_debug_register_code
240LIBART_TARGET_LDFLAGS_arm    := $(JIT_DEBUG_REGISTER_CODE_LDFLAGS)
241LIBART_TARGET_LDFLAGS_x86    := $(JIT_DEBUG_REGISTER_CODE_LDFLAGS)
242LIBART_TARGET_LDFLAGS_x86_64 := $(JIT_DEBUG_REGISTER_CODE_LDFLAGS)
243JIT_DEBUG_REGISTER_CODE_LDFLAGS :=
244
245LIBART_TARGET_SRC_FILES := \
246  $(LIBART_COMMON_SRC_FILES) \
247  jdwp/jdwp_adb.cc \
248  monitor_android.cc \
249  runtime_android.cc \
250  thread_android.cc
251
252LIBART_TARGET_SRC_FILES_arm := \
253  interpreter/mterp/mterp.cc \
254  interpreter/mterp/out/mterp_arm.S \
255  arch/arm/context_arm.cc.arm \
256  arch/arm/entrypoints_init_arm.cc \
257  arch/arm/instruction_set_features_assembly_tests.S \
258  arch/arm/jni_entrypoints_arm.S \
259  arch/arm/memcmp16_arm.S \
260  arch/arm/quick_entrypoints_arm.S \
261  arch/arm/quick_entrypoints_cc_arm.cc \
262  arch/arm/thread_arm.cc \
263  arch/arm/fault_handler_arm.cc
264
265LIBART_TARGET_SRC_FILES_arm64 := \
266  interpreter/mterp/mterp.cc \
267  interpreter/mterp/out/mterp_arm64.S \
268  arch/arm64/context_arm64.cc \
269  arch/arm64/entrypoints_init_arm64.cc \
270  arch/arm64/jni_entrypoints_arm64.S \
271  arch/arm64/memcmp16_arm64.S \
272  arch/arm64/quick_entrypoints_arm64.S \
273  arch/arm64/thread_arm64.cc \
274  monitor_pool.cc \
275  arch/arm64/fault_handler_arm64.cc
276
277LIBART_SRC_FILES_x86 := \
278  arch/x86/context_x86.cc \
279  arch/x86/entrypoints_init_x86.cc \
280  arch/x86/jni_entrypoints_x86.S \
281  arch/x86/memcmp16_x86.S \
282  arch/x86/quick_entrypoints_x86.S \
283  arch/x86/thread_x86.cc \
284  arch/x86/fault_handler_x86.cc
285
286LIBART_TARGET_SRC_FILES_x86 := \
287  $(LIBART_SRC_FILES_x86)
288
289# Darwin uses non-standard x86 assembly syntax.  Don't build x86 Darwin host mterp there.
290ifeq ($(HOST_OS),darwin)
291  LIBART_SRC_FILES_x86 += \
292    interpreter/mterp/mterp_stub.cc
293else
294  LIBART_SRC_FILES_x86 += \
295    interpreter/mterp/mterp.cc \
296    interpreter/mterp/out/mterp_x86.S
297endif
298# But do support x86 mterp for target build regardless of host platform.
299LIBART_TARGET_SRC_FILES_x86 += \
300  interpreter/mterp/mterp.cc \
301  interpreter/mterp/out/mterp_x86.S
302
303# Note that the fault_handler_x86.cc is not a mistake.  This file is
304# shared between the x86 and x86_64 architectures.
305LIBART_SRC_FILES_x86_64 := \
306  interpreter/mterp/mterp_stub.cc \
307  arch/x86_64/context_x86_64.cc \
308  arch/x86_64/entrypoints_init_x86_64.cc \
309  arch/x86_64/jni_entrypoints_x86_64.S \
310  arch/x86_64/memcmp16_x86_64.S \
311  arch/x86_64/quick_entrypoints_x86_64.S \
312  arch/x86_64/thread_x86_64.cc \
313  monitor_pool.cc \
314  arch/x86/fault_handler_x86.cc
315
316LIBART_TARGET_SRC_FILES_x86_64 := \
317  $(LIBART_SRC_FILES_x86_64) \
318
319LIBART_TARGET_SRC_FILES_mips := \
320  interpreter/mterp/mterp_stub.cc \
321  arch/mips/context_mips.cc \
322  arch/mips/entrypoints_init_mips.cc \
323  arch/mips/jni_entrypoints_mips.S \
324  arch/mips/memcmp16_mips.S \
325  arch/mips/quick_entrypoints_mips.S \
326  arch/mips/thread_mips.cc \
327  arch/mips/fault_handler_mips.cc
328
329LIBART_TARGET_SRC_FILES_mips64 := \
330  interpreter/mterp/mterp_stub.cc \
331  arch/mips64/context_mips64.cc \
332  arch/mips64/entrypoints_init_mips64.cc \
333  arch/mips64/jni_entrypoints_mips64.S \
334  arch/mips64/memcmp16_mips64.S \
335  arch/mips64/quick_entrypoints_mips64.S \
336  arch/mips64/thread_mips64.cc \
337  monitor_pool.cc \
338  arch/mips64/fault_handler_mips64.cc
339
340LIBART_HOST_SRC_FILES := \
341  $(LIBART_COMMON_SRC_FILES) \
342  monitor_linux.cc \
343  runtime_linux.cc \
344  thread_linux.cc
345
346LIBART_HOST_SRC_FILES_32 := \
347  $(LIBART_SRC_FILES_x86)
348
349LIBART_HOST_SRC_FILES_64 := \
350  $(LIBART_SRC_FILES_x86_64)
351
352LIBART_ENUM_OPERATOR_OUT_HEADER_FILES := \
353  arch/instruction_set.h \
354  base/allocator.h \
355  base/mutex.h \
356  debugger.h \
357  base/unix_file/fd_file.h \
358  dex_file.h \
359  dex_instruction.h \
360  dex_instruction_utils.h \
361  gc_root.h \
362  gc/allocator_type.h \
363  gc/allocator/rosalloc.h \
364  gc/collector_type.h \
365  gc/collector/gc_type.h \
366  gc/heap.h \
367  gc/space/region_space.h \
368  gc/space/space.h \
369  gc/weak_root_state.h \
370  image.h \
371  instrumentation.h \
372  indirect_reference_table.h \
373  invoke_type.h \
374  jdwp/jdwp.h \
375  jdwp/jdwp_constants.h \
376  lock_word.h \
377  mirror/class.h \
378  oat.h \
379  object_callbacks.h \
380  profiler_options.h \
381  quick/inline_method_analyser.h \
382  runtime.h \
383  stack.h \
384  thread.h \
385  thread_state.h \
386  verifier/method_verifier.h
387
388LIBOPENJDKJVM_SRC_FILES := openjdkjvm/OpenjdkJvm.cc
389
390LIBART_CFLAGS := -DBUILDING_LIBART=1
391
392LIBART_TARGET_CFLAGS :=
393LIBART_HOST_CFLAGS :=
394
395# Default dex2oat instruction set features.
396LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES := default
397LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
3982ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
399ifeq ($(DEX2OAT_TARGET_ARCH),arm)
400  ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
401    LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
402  else
403    ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
404      LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
405    endif
406  endif
407endif
408ifeq ($(2ND_DEX2OAT_TARGET_ARCH),arm)
409  ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
410    2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
411  else
412    ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
413      2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
414    endif
415  endif
416endif
417
418# $(1): target or host
419# $(2): ndebug or debug
420# $(3): static or shared (note that static only applies for host)
421# $(4): module name : either libart or libopenjdkjvm
422define build-runtime-library
423  ifneq ($(1),target)
424    ifneq ($(1),host)
425      $$(error expected target or host for argument 1, received $(1))
426    endif
427  endif
428  ifneq ($(2),ndebug)
429    ifneq ($(2),debug)
430      $$(error expected ndebug or debug for argument 2, received $(2))
431    endif
432  endif
433  ifneq ($(4),libart)
434    ifneq ($(4),libopenjdkjvm)
435      $$(error expected libart of libopenjdkjvm for argument 4, received $(4))
436    endif
437  endif
438
439  art_target_or_host := $(1)
440  art_ndebug_or_debug := $(2)
441  art_static_or_shared := $(3)
442
443  include $$(CLEAR_VARS)
444  LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION)
445  ifeq ($$(art_ndebug_or_debug),ndebug)
446    LOCAL_MODULE := $(4)
447    ifeq ($$(art_target_or_host),target)
448      LOCAL_FDO_SUPPORT := true
449    endif
450  else # debug
451    LOCAL_MODULE := $(4)d
452  endif
453
454  LOCAL_MODULE_TAGS := optional
455
456  ifeq ($$(art_static_or_shared),static)
457    LOCAL_MODULE_CLASS := STATIC_LIBRARIES
458  else
459    LOCAL_MODULE_CLASS := SHARED_LIBRARIES
460  endif
461
462  ifeq ($(4),libart)
463    ifeq ($$(art_target_or_host),target)
464      LOCAL_SRC_FILES := $$(LIBART_TARGET_SRC_FILES)
465      $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
466        $$(eval LOCAL_SRC_FILES_$$(arch) := $$$$(LIBART_TARGET_SRC_FILES_$$(arch))))
467    else # host
468      LOCAL_SRC_FILES := $$(LIBART_HOST_SRC_FILES)
469      LOCAL_SRC_FILES_32 := $$(LIBART_HOST_SRC_FILES_32)
470      LOCAL_SRC_FILES_64 := $$(LIBART_HOST_SRC_FILES_64)
471      LOCAL_IS_HOST_MODULE := true
472    endif
473  else # libopenjdkjvm
474    LOCAL_SRC_FILES := $$(LIBOPENJDKJVM_SRC_FILES)
475    ifeq ($$(art_target_or_host),host)
476      LOCAL_IS_HOST_MODULE := true
477    endif
478  endif
479
480ifeq ($(4),libart)
481  GENERATED_SRC_DIR := $$(call local-generated-sources-dir)
482  ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES))
483  ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES))
484
485$$(ENUM_OPERATOR_OUT_GEN): art/tools/generate-operator-out.py
486$$(ENUM_OPERATOR_OUT_GEN): PRIVATE_CUSTOM_TOOL = art/tools/generate-operator-out.py $(LOCAL_PATH) $$< > $$@
487$$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PATH)/%.h
488	$$(transform-generated-source)
489
490  LOCAL_GENERATED_SOURCES += $$(ENUM_OPERATOR_OUT_GEN)
491endif
492
493  LOCAL_CFLAGS := $$(LIBART_CFLAGS)
494  LOCAL_LDFLAGS := $$(LIBART_LDFLAGS)
495  ifeq ($$(art_target_or_host),target)
496    LOCAL_CFLAGS += $$(LIBART_TARGET_CFLAGS)
497    LOCAL_LDFLAGS += $$(LIBART_TARGET_LDFLAGS)
498    $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
499      $$(eval LOCAL_LDFLAGS_$$(arch) := $$(LIBART_TARGET_LDFLAGS_$$(arch))))
500  else #host
501    LOCAL_CFLAGS += $$(LIBART_HOST_CFLAGS)
502    LOCAL_LDFLAGS += $$(LIBART_HOST_LDFLAGS)
503    ifeq ($$(art_static_or_shared),static)
504      LOCAL_LDFLAGS += -static
505    endif
506  endif
507
508  # Clang usage
509  ifeq ($$(art_target_or_host),target)
510    $$(eval $$(call set-target-local-clang-vars))
511    $$(eval $$(call set-target-local-cflags-vars,$(2)))
512    LOCAL_CFLAGS_$(DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
513    LOCAL_CFLAGS_$(2ND_DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
514  else # host
515    LOCAL_CLANG := $$(ART_HOST_CLANG)
516    LOCAL_LDLIBS := $$(ART_HOST_LDLIBS)
517    LOCAL_LDLIBS += -ldl -lpthread
518    ifeq ($$(HOST_OS),linux)
519      LOCAL_LDLIBS += -lrt
520    endif
521    LOCAL_CFLAGS += $$(ART_HOST_CFLAGS)
522    LOCAL_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES)"
523    LOCAL_ASFLAGS += $$(ART_HOST_ASFLAGS)
524
525    ifeq ($$(art_ndebug_or_debug),debug)
526      LOCAL_CFLAGS += $$(ART_HOST_DEBUG_CFLAGS)
527    else
528      LOCAL_CFLAGS += $$(ART_HOST_NON_DEBUG_CFLAGS)
529    endif
530    LOCAL_MULTILIB := both
531  endif
532
533  LOCAL_C_INCLUDES += $$(ART_C_INCLUDES)
534  LOCAL_C_INCLUDES += art/cmdline
535  LOCAL_C_INCLUDES += art/sigchainlib
536  LOCAL_C_INCLUDES += art
537
538  ifeq ($$(art_static_or_shared),static)
539    LOCAL_STATIC_LIBRARIES := libnativehelper
540    LOCAL_STATIC_LIBRARIES += libnativebridge
541    LOCAL_STATIC_LIBRARIES += libnativeloader
542    LOCAL_STATIC_LIBRARIES += libsigchain_dummy
543    LOCAL_STATIC_LIBRARIES += libbacktrace
544    LOCAL_STATIC_LIBRARIES += liblz4
545  else
546    LOCAL_SHARED_LIBRARIES := libnativehelper
547    LOCAL_SHARED_LIBRARIES += libnativebridge
548    LOCAL_SHARED_LIBRARIES += libnativeloader
549    LOCAL_SHARED_LIBRARIES += libsigchain
550    LOCAL_SHARED_LIBRARIES += libbacktrace
551    LOCAL_SHARED_LIBRARIES += liblz4
552  endif
553
554  ifeq ($$(art_target_or_host),target)
555    LOCAL_SHARED_LIBRARIES += libdl
556    # ZipArchive support, the order matters here to get all symbols.
557    LOCAL_STATIC_LIBRARIES := libziparchive libz libbase
558    # For android::FileMap used by libziparchive.
559    LOCAL_SHARED_LIBRARIES += libutils
560    # For liblog, atrace, properties, ashmem, set_sched_policy and socket_peer_is_trusted.
561    LOCAL_SHARED_LIBRARIES += libcutils
562  else # host
563    ifeq ($$(art_static_or_shared),static)
564      LOCAL_STATIC_LIBRARIES += libziparchive-host libz
565      # For ashmem_create_region.
566      LOCAL_STATIC_LIBRARIES += libcutils
567    else
568      LOCAL_SHARED_LIBRARIES += libziparchive-host libz-host
569      # For ashmem_create_region.
570      LOCAL_SHARED_LIBRARIES += libcutils
571    endif
572  endif
573
574  ifeq ($(4),libopenjdkjvm)
575    ifeq ($$(art_ndebug_or_debug),ndebug)
576      LOCAL_SHARED_LIBRARIES += libart
577    else
578      LOCAL_SHARED_LIBRARIES += libartd
579    endif
580    LOCAL_NOTICE_FILE := $(LOCAL_PATH)/openjdkjvm/NOTICE
581  endif
582  LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
583  LOCAL_ADDITIONAL_DEPENDENCIES += $$(LOCAL_PATH)/Android.mk
584
585  ifeq ($$(art_target_or_host),target)
586    LOCAL_MODULE_TARGET_ARCH := $$(ART_TARGET_SUPPORTED_ARCH)
587  endif
588
589  LOCAL_NATIVE_COVERAGE := $(ART_COVERAGE)
590
591  ifeq ($$(art_target_or_host),target)
592    ifneq ($$(art_ndebug_or_debug),debug)
593      # Leave the symbols in the shared library so that stack unwinders can
594      # produce meaningful name resolution.
595      LOCAL_STRIP_MODULE := keep_symbols
596    endif
597    include $$(BUILD_SHARED_LIBRARY)
598  else # host
599    ifeq ($$(art_static_or_shared),static)
600      include $$(BUILD_HOST_STATIC_LIBRARY)
601    else
602      include $$(BUILD_HOST_SHARED_LIBRARY)
603    endif
604  endif
605
606  # Clear locally defined variables.
607  GENERATED_SRC_DIR :=
608  ENUM_OPERATOR_OUT_CC_FILES :=
609  ENUM_OPERATOR_OUT_GEN :=
610  art_target_or_host :=
611  art_ndebug_or_debug :=
612  art_static_or_shared :=
613endef
614
615# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since
616# they are used to cross compile for the target.
617ifeq ($(ART_BUILD_HOST_NDEBUG),true)
618  $(eval $(call build-runtime-library,host,ndebug,shared,libart))
619  $(eval $(call build-runtime-library,host,ndebug,shared,libopenjdkjvm))
620  ifeq ($(ART_BUILD_HOST_STATIC),true)
621    $(eval $(call build-runtime-library,host,ndebug,static,libart))
622    $(eval $(call build-runtime-library,host,ndebug,static,libopenjdkjvm))
623  endif
624endif
625ifeq ($(ART_BUILD_HOST_DEBUG),true)
626  $(eval $(call build-runtime-library,host,debug,shared,libart))
627  $(eval $(call build-runtime-library,host,debug,shared,libopenjdkjvm))
628  ifeq ($(ART_BUILD_HOST_STATIC),true)
629    $(eval $(call build-runtime-library,host,debug,static,libart))
630    $(eval $(call build-runtime-library,host,debug,static,libopenjdkjvm))
631  endif
632endif
633
634ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
635#  $(error $(call build-runtime-library,target,ndebug))
636  $(eval $(call build-runtime-library,target,ndebug,shared,libart))
637  $(eval $(call build-runtime-library,target,ndebug,shared,libopenjdkjvm))
638endif
639ifeq ($(ART_BUILD_TARGET_DEBUG),true)
640  $(eval $(call build-runtime-library,target,debug,shared,libart))
641  $(eval $(call build-runtime-library,target,debug,shared,libopenjdkjvm))
642endif
643
644# Clear locally defined variables.
645LOCAL_PATH :=
646LIBART_COMMON_SRC_FILES :=
647LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES :=
648LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
6492ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
650LIBART_HOST_LDFLAGS :=
651LIBART_TARGET_LDFLAGS :=
652LIBART_TARGET_LDFLAGS_arm :=
653LIBART_TARGET_LDFLAGS_arm64 :=
654LIBART_TARGET_LDFLAGS_x86 :=
655LIBART_TARGET_LDFLAGS_x86_64 :=
656LIBART_TARGET_LDFLAGS_mips :=
657LIBART_TARGET_LDFLAGS_mips64 :=
658LIBART_TARGET_SRC_FILES :=
659LIBART_TARGET_SRC_FILES_arm :=
660LIBART_TARGET_SRC_FILES_arm64 :=
661LIBART_TARGET_SRC_FILES_x86 :=
662LIBART_TARGET_SRC_FILES_x86_64 :=
663LIBART_TARGET_SRC_FILES_mips :=
664LIBART_TARGET_SRC_FILES_mips64 :=
665LIBART_HOST_SRC_FILES :=
666LIBART_HOST_SRC_FILES_32 :=
667LIBART_HOST_SRC_FILES_64 :=
668LIBART_ENUM_OPERATOR_OUT_HEADER_FILES :=
669LIBART_CFLAGS :=
670LIBART_TARGET_CFLAGS :=
671LIBART_HOST_CFLAGS :=
672build-runtime-library :=
673