Android.mk revision 1133db79350060158f99210c56f111c6dad43563
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  compiler_filter.cc \
48  debugger.cc \
49  dex_file.cc \
50  dex_file_verifier.cc \
51  dex_instruction.cc \
52  elf_file.cc \
53  fault_handler.cc \
54  gc/allocation_record.cc \
55  gc/allocator/dlmalloc.cc \
56  gc/allocator/rosalloc.cc \
57  gc/accounting/bitmap.cc \
58  gc/accounting/card_table.cc \
59  gc/accounting/heap_bitmap.cc \
60  gc/accounting/mod_union_table.cc \
61  gc/accounting/remembered_set.cc \
62  gc/accounting/space_bitmap.cc \
63  gc/collector/concurrent_copying.cc \
64  gc/collector/garbage_collector.cc \
65  gc/collector/immune_region.cc \
66  gc/collector/immune_spaces.cc \
67  gc/collector/mark_compact.cc \
68  gc/collector/mark_sweep.cc \
69  gc/collector/partial_mark_sweep.cc \
70  gc/collector/semi_space.cc \
71  gc/collector/sticky_mark_sweep.cc \
72  gc/gc_cause.cc \
73  gc/heap.cc \
74  gc/reference_processor.cc \
75  gc/reference_queue.cc \
76  gc/scoped_gc_critical_section.cc \
77  gc/space/bump_pointer_space.cc \
78  gc/space/dlmalloc_space.cc \
79  gc/space/image_space.cc \
80  gc/space/large_object_space.cc \
81  gc/space/malloc_space.cc \
82  gc/space/region_space.cc \
83  gc/space/rosalloc_space.cc \
84  gc/space/space.cc \
85  gc/space/zygote_space.cc \
86  gc/task_processor.cc \
87  hprof/hprof.cc \
88  image.cc \
89  indirect_reference_table.cc \
90  instrumentation.cc \
91  intern_table.cc \
92  interpreter/interpreter.cc \
93  interpreter/interpreter_common.cc \
94  interpreter/interpreter_goto_table_impl.cc \
95  interpreter/interpreter_switch_impl.cc \
96  interpreter/unstarted_runtime.cc \
97  java_vm_ext.cc \
98  jdwp/jdwp_event.cc \
99  jdwp/jdwp_expand_buf.cc \
100  jdwp/jdwp_handler.cc \
101  jdwp/jdwp_main.cc \
102  jdwp/jdwp_request.cc \
103  jdwp/jdwp_socket.cc \
104  jdwp/object_registry.cc \
105  jni_env_ext.cc \
106  jit/debugger_interface.cc \
107  jit/jit.cc \
108  jit/jit_code_cache.cc \
109  jit/jit_instrumentation.cc \
110  jit/offline_profiling_info.cc \
111  jit/profiling_info.cc \
112  jit/profile_saver.cc  \
113  lambda/art_lambda_method.cc \
114  lambda/box_table.cc \
115  lambda/closure.cc \
116  lambda/closure_builder.cc \
117  lambda/leaking_allocator.cc \
118  jni_internal.cc \
119  jobject_comparator.cc \
120  linear_alloc.cc \
121  mem_map.cc \
122  memory_region.cc \
123  mirror/abstract_method.cc \
124  mirror/array.cc \
125  mirror/class.cc \
126  mirror/dex_cache.cc \
127  mirror/field.cc \
128  mirror/method.cc \
129  mirror/object.cc \
130  mirror/reference.cc \
131  mirror/stack_trace_element.cc \
132  mirror/string.cc \
133  mirror/throwable.cc \
134  monitor.cc \
135  native_bridge_art_interface.cc \
136  native/dalvik_system_DexFile.cc \
137  native/dalvik_system_VMDebug.cc \
138  native/dalvik_system_VMRuntime.cc \
139  native/dalvik_system_VMStack.cc \
140  native/dalvik_system_ZygoteHooks.cc \
141  native/java_lang_Class.cc \
142  native/java_lang_DexCache.cc \
143  native/java_lang_Object.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_AbstractMethod.cc \
153  native/java_lang_reflect_Array.cc \
154  native/java_lang_reflect_Constructor.cc \
155  native/java_lang_reflect_Field.cc \
156  native/java_lang_reflect_Method.cc \
157  native/java_lang_reflect_Proxy.cc \
158  native/java_util_concurrent_atomic_AtomicLong.cc \
159  native/libcore_util_CharsetUtils.cc \
160  native/org_apache_harmony_dalvik_ddmc_DdmServer.cc \
161  native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc \
162  native/sun_misc_Unsafe.cc \
163  oat.cc \
164  oat_file.cc \
165  oat_file_assistant.cc \
166  oat_file_manager.cc \
167  oat_quick_method_header.cc \
168  object_lock.cc \
169  offsets.cc \
170  os_linux.cc \
171  parsed_options.cc \
172  primitive.cc \
173  profiler.cc \
174  quick_exception_handler.cc \
175  quick/inline_method_analyser.cc \
176  reference_table.cc \
177  reflection.cc \
178  runtime.cc \
179  runtime_options.cc \
180  signal_catcher.cc \
181  stack.cc \
182  stack_map.cc \
183  thread.cc \
184  thread_list.cc \
185  thread_pool.cc \
186  trace.cc \
187  transaction.cc \
188  type_lookup_table.cc \
189  utf.cc \
190  utils.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_arm64  := $(JIT_DEBUG_REGISTER_CODE_LDFLAGS)
242LIBART_TARGET_LDFLAGS_x86    := $(JIT_DEBUG_REGISTER_CODE_LDFLAGS)
243LIBART_TARGET_LDFLAGS_x86_64 := $(JIT_DEBUG_REGISTER_CODE_LDFLAGS)
244JIT_DEBUG_REGISTER_CODE_LDFLAGS :=
245
246LIBART_TARGET_SRC_FILES := \
247  $(LIBART_COMMON_SRC_FILES) \
248  jdwp/jdwp_adb.cc \
249  monitor_android.cc \
250  runtime_android.cc \
251  thread_android.cc
252
253LIBART_TARGET_SRC_FILES_arm := \
254  interpreter/mterp/mterp.cc \
255  interpreter/mterp/out/mterp_arm.S \
256  arch/arm/context_arm.cc.arm \
257  arch/arm/entrypoints_init_arm.cc \
258  arch/arm/instruction_set_features_assembly_tests.S \
259  arch/arm/jni_entrypoints_arm.S \
260  arch/arm/memcmp16_arm.S \
261  arch/arm/quick_entrypoints_arm.S \
262  arch/arm/quick_entrypoints_cc_arm.cc \
263  arch/arm/thread_arm.cc \
264  arch/arm/fault_handler_arm.cc
265
266LIBART_TARGET_SRC_FILES_arm64 := \
267  interpreter/mterp/mterp.cc \
268  interpreter/mterp/out/mterp_arm64.S \
269  arch/arm64/context_arm64.cc \
270  arch/arm64/entrypoints_init_arm64.cc \
271  arch/arm64/jni_entrypoints_arm64.S \
272  arch/arm64/memcmp16_arm64.S \
273  arch/arm64/quick_entrypoints_arm64.S \
274  arch/arm64/thread_arm64.cc \
275  monitor_pool.cc \
276  arch/arm64/fault_handler_arm64.cc
277
278LIBART_SRC_FILES_x86 := \
279  interpreter/mterp/mterp.cc \
280  interpreter/mterp/out/mterp_x86.S \
281  arch/x86/context_x86.cc \
282  arch/x86/entrypoints_init_x86.cc \
283  arch/x86/jni_entrypoints_x86.S \
284  arch/x86/memcmp16_x86.S \
285  arch/x86/quick_entrypoints_x86.S \
286  arch/x86/thread_x86.cc \
287  arch/x86/fault_handler_x86.cc
288
289LIBART_TARGET_SRC_FILES_x86 := \
290  $(LIBART_SRC_FILES_x86)
291
292# Note that the fault_handler_x86.cc is not a mistake.  This file is
293# shared between the x86 and x86_64 architectures.
294LIBART_SRC_FILES_x86_64 := \
295  interpreter/mterp/mterp.cc \
296  interpreter/mterp/out/mterp_x86_64.S \
297  arch/x86_64/context_x86_64.cc \
298  arch/x86_64/entrypoints_init_x86_64.cc \
299  arch/x86_64/jni_entrypoints_x86_64.S \
300  arch/x86_64/memcmp16_x86_64.S \
301  arch/x86_64/quick_entrypoints_x86_64.S \
302  arch/x86_64/thread_x86_64.cc \
303  monitor_pool.cc \
304  arch/x86/fault_handler_x86.cc
305
306LIBART_TARGET_SRC_FILES_x86_64 := \
307  $(LIBART_SRC_FILES_x86_64) \
308
309LIBART_TARGET_SRC_FILES_mips := \
310  interpreter/mterp/mterp.cc \
311  interpreter/mterp/out/mterp_mips.S \
312  arch/mips/context_mips.cc \
313  arch/mips/entrypoints_init_mips.cc \
314  arch/mips/jni_entrypoints_mips.S \
315  arch/mips/memcmp16_mips.S \
316  arch/mips/quick_entrypoints_mips.S \
317  arch/mips/thread_mips.cc \
318  arch/mips/fault_handler_mips.cc
319
320LIBART_TARGET_SRC_FILES_mips64 := \
321  interpreter/mterp/mterp.cc \
322  interpreter/mterp/out/mterp_mips64.S \
323  arch/mips64/context_mips64.cc \
324  arch/mips64/entrypoints_init_mips64.cc \
325  arch/mips64/jni_entrypoints_mips64.S \
326  arch/mips64/memcmp16_mips64.S \
327  arch/mips64/quick_entrypoints_mips64.S \
328  arch/mips64/thread_mips64.cc \
329  monitor_pool.cc \
330  arch/mips64/fault_handler_mips64.cc
331
332LIBART_HOST_SRC_FILES := \
333  $(LIBART_COMMON_SRC_FILES) \
334  monitor_linux.cc \
335  runtime_linux.cc \
336  thread_linux.cc
337
338LIBART_HOST_SRC_FILES_32 := \
339  $(LIBART_SRC_FILES_x86)
340
341LIBART_HOST_SRC_FILES_64 := \
342  $(LIBART_SRC_FILES_x86_64)
343
344LIBART_ENUM_OPERATOR_OUT_HEADER_FILES := \
345  arch/instruction_set.h \
346  base/allocator.h \
347  base/mutex.h \
348  debugger.h \
349  base/unix_file/fd_file.h \
350  dex_file.h \
351  dex_instruction.h \
352  dex_instruction_utils.h \
353  gc_root.h \
354  gc/allocator_type.h \
355  gc/allocator/rosalloc.h \
356  gc/collector_type.h \
357  gc/collector/gc_type.h \
358  gc/heap.h \
359  gc/space/region_space.h \
360  gc/space/space.h \
361  gc/weak_root_state.h \
362  image.h \
363  instrumentation.h \
364  indirect_reference_table.h \
365  invoke_type.h \
366  jdwp/jdwp.h \
367  jdwp/jdwp_constants.h \
368  lock_word.h \
369  mirror/class.h \
370  oat.h \
371  object_callbacks.h \
372  process_state.h \
373  profiler_options.h \
374  quick/inline_method_analyser.h \
375  runtime.h \
376  stack.h \
377  thread.h \
378  thread_state.h \
379  verifier/method_verifier.h
380
381LIBOPENJDKJVM_SRC_FILES := openjdkjvm/OpenjdkJvm.cc
382
383LIBART_CFLAGS := -DBUILDING_LIBART=1
384
385LIBART_TARGET_CFLAGS :=
386LIBART_HOST_CFLAGS :=
387
388# Default dex2oat instruction set features.
389LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES := default
390LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
3912ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
392ifeq ($(DEX2OAT_TARGET_ARCH),arm)
393  ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
394    LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
395  else
396    ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
397      LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
398    endif
399  endif
400endif
401ifeq ($(2ND_DEX2OAT_TARGET_ARCH),arm)
402  ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
403    2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
404  else
405    ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
406      2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
407    endif
408  endif
409endif
410
411# $(1): target or host
412# $(2): ndebug or debug
413# $(3): static or shared (note that static only applies for host)
414# $(4): module name : either libart or libopenjdkjvm
415define build-runtime-library
416  ifneq ($(1),target)
417    ifneq ($(1),host)
418      $$(error expected target or host for argument 1, received $(1))
419    endif
420  endif
421  ifneq ($(2),ndebug)
422    ifneq ($(2),debug)
423      $$(error expected ndebug or debug for argument 2, received $(2))
424    endif
425  endif
426  ifneq ($(4),libart)
427    ifneq ($(4),libopenjdkjvm)
428      $$(error expected libart of libopenjdkjvm for argument 4, received $(4))
429    endif
430  endif
431
432  art_target_or_host := $(1)
433  art_ndebug_or_debug := $(2)
434  art_static_or_shared := $(3)
435
436  include $$(CLEAR_VARS)
437  LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION)
438  ifeq ($$(art_ndebug_or_debug),ndebug)
439    LOCAL_MODULE := $(4)
440    ifeq ($$(art_target_or_host),target)
441      LOCAL_FDO_SUPPORT := true
442    endif
443  else # debug
444    LOCAL_MODULE := $(4)d
445  endif
446
447  LOCAL_MODULE_TAGS := optional
448
449  ifeq ($$(art_static_or_shared),static)
450    LOCAL_MODULE_CLASS := STATIC_LIBRARIES
451  else
452    LOCAL_MODULE_CLASS := SHARED_LIBRARIES
453  endif
454
455  ifeq ($(4),libart)
456    ifeq ($$(art_target_or_host),target)
457      LOCAL_SRC_FILES := $$(LIBART_TARGET_SRC_FILES)
458      $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
459        $$(eval LOCAL_SRC_FILES_$$(arch) := $$$$(LIBART_TARGET_SRC_FILES_$$(arch))))
460    else # host
461      LOCAL_SRC_FILES := $$(LIBART_HOST_SRC_FILES)
462      LOCAL_SRC_FILES_32 := $$(LIBART_HOST_SRC_FILES_32)
463      LOCAL_SRC_FILES_64 := $$(LIBART_HOST_SRC_FILES_64)
464      LOCAL_IS_HOST_MODULE := true
465    endif
466  else # libopenjdkjvm
467    LOCAL_SRC_FILES := $$(LIBOPENJDKJVM_SRC_FILES)
468    ifeq ($$(art_target_or_host),host)
469      LOCAL_IS_HOST_MODULE := true
470    endif
471  endif
472
473ifeq ($(4),libart)
474  GENERATED_SRC_DIR := $$(call local-generated-sources-dir)
475  ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES))
476  ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES))
477
478$$(ENUM_OPERATOR_OUT_GEN): art/tools/generate-operator-out.py
479$$(ENUM_OPERATOR_OUT_GEN): PRIVATE_CUSTOM_TOOL = art/tools/generate-operator-out.py $(LOCAL_PATH) $$< > $$@
480$$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PATH)/%.h
481	$$(transform-generated-source)
482
483  LOCAL_GENERATED_SOURCES += $$(ENUM_OPERATOR_OUT_GEN)
484endif
485
486  LOCAL_CFLAGS := $$(LIBART_CFLAGS)
487  LOCAL_LDFLAGS := $$(LIBART_LDFLAGS)
488  ifeq ($$(art_target_or_host),target)
489    LOCAL_CFLAGS += $$(LIBART_TARGET_CFLAGS)
490    LOCAL_LDFLAGS += $$(LIBART_TARGET_LDFLAGS)
491    $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
492      $$(eval LOCAL_LDFLAGS_$$(arch) := $$(LIBART_TARGET_LDFLAGS_$$(arch))))
493  else #host
494    LOCAL_CFLAGS += $$(LIBART_HOST_CFLAGS)
495    LOCAL_LDFLAGS += $$(LIBART_HOST_LDFLAGS)
496    ifeq ($$(art_static_or_shared),static)
497      LOCAL_LDFLAGS += -static
498    endif
499  endif
500
501  # Clang usage
502  ifeq ($$(art_target_or_host),target)
503    $$(eval $$(call set-target-local-clang-vars))
504    $$(eval $$(call set-target-local-cflags-vars,$(2)))
505    LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
506    LOCAL_CFLAGS_$(DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
507    LOCAL_CFLAGS_$(2ND_DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
508  else # host
509    LOCAL_CLANG := $$(ART_HOST_CLANG)
510    LOCAL_LDLIBS := $$(ART_HOST_LDLIBS)
511    LOCAL_LDLIBS += -ldl -lpthread
512    ifeq ($$(HOST_OS),linux)
513      LOCAL_LDLIBS += -lrt
514    endif
515    LOCAL_CFLAGS += $$(ART_HOST_CFLAGS)
516    LOCAL_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES)"
517    LOCAL_ASFLAGS += $$(ART_HOST_ASFLAGS)
518
519    ifeq ($$(art_ndebug_or_debug),debug)
520      LOCAL_CFLAGS += $$(ART_HOST_DEBUG_CFLAGS)
521    else
522      LOCAL_CFLAGS += $$(ART_HOST_NON_DEBUG_CFLAGS)
523    endif
524    LOCAL_MULTILIB := both
525  endif
526
527  LOCAL_C_INCLUDES += $$(ART_C_INCLUDES)
528  LOCAL_C_INCLUDES += art/cmdline
529  LOCAL_C_INCLUDES += art/sigchainlib
530  LOCAL_C_INCLUDES += art
531
532  ifeq ($$(art_static_or_shared),static)
533    LOCAL_STATIC_LIBRARIES := libnativehelper
534    LOCAL_STATIC_LIBRARIES += libnativebridge
535    LOCAL_STATIC_LIBRARIES += libnativeloader
536    LOCAL_STATIC_LIBRARIES += libsigchain_dummy
537    LOCAL_STATIC_LIBRARIES += libbacktrace
538    LOCAL_STATIC_LIBRARIES += liblz4
539  else
540    LOCAL_SHARED_LIBRARIES := libnativehelper
541    LOCAL_SHARED_LIBRARIES += libnativebridge
542    LOCAL_SHARED_LIBRARIES += libnativeloader
543    LOCAL_SHARED_LIBRARIES += libsigchain
544    LOCAL_SHARED_LIBRARIES += libbacktrace
545    LOCAL_SHARED_LIBRARIES += liblz4
546  endif
547
548  ifeq ($$(art_target_or_host),target)
549    LOCAL_SHARED_LIBRARIES += libdl
550    # ZipArchive support, the order matters here to get all symbols.
551    LOCAL_STATIC_LIBRARIES := libziparchive libz libbase
552    # For android::FileMap used by libziparchive.
553    LOCAL_SHARED_LIBRARIES += libutils
554    # For liblog, atrace, properties, ashmem, set_sched_policy and socket_peer_is_trusted.
555    LOCAL_SHARED_LIBRARIES += libcutils
556  else # host
557    ifeq ($$(art_static_or_shared),static)
558      LOCAL_STATIC_LIBRARIES += libziparchive-host libz
559      # For ashmem_create_region.
560      LOCAL_STATIC_LIBRARIES += libcutils
561    else
562      LOCAL_SHARED_LIBRARIES += libziparchive-host libz-host
563      # For ashmem_create_region.
564      LOCAL_SHARED_LIBRARIES += libcutils
565    endif
566  endif
567
568  ifeq ($(4),libopenjdkjvm)
569    ifeq ($$(art_ndebug_or_debug),ndebug)
570      LOCAL_SHARED_LIBRARIES += libart
571    else
572      LOCAL_SHARED_LIBRARIES += libartd
573    endif
574    LOCAL_NOTICE_FILE := $(LOCAL_PATH)/openjdkjvm/NOTICE
575  endif
576  LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
577  LOCAL_ADDITIONAL_DEPENDENCIES += $$(LOCAL_PATH)/Android.mk
578
579  ifeq ($$(art_target_or_host),target)
580    LOCAL_MODULE_TARGET_ARCH := $$(ART_TARGET_SUPPORTED_ARCH)
581  endif
582
583  LOCAL_NATIVE_COVERAGE := $(ART_COVERAGE)
584
585  ifeq ($$(art_target_or_host),target)
586    ifneq ($$(art_ndebug_or_debug),debug)
587      # Leave the symbols in the shared library so that stack unwinders can
588      # produce meaningful name resolution.
589      LOCAL_STRIP_MODULE := keep_symbols
590    endif
591    include $$(BUILD_SHARED_LIBRARY)
592  else # host
593    ifeq ($$(art_static_or_shared),static)
594      include $$(BUILD_HOST_STATIC_LIBRARY)
595    else
596      include $$(BUILD_HOST_SHARED_LIBRARY)
597    endif
598  endif
599
600  # Clear locally defined variables.
601  GENERATED_SRC_DIR :=
602  ENUM_OPERATOR_OUT_CC_FILES :=
603  ENUM_OPERATOR_OUT_GEN :=
604  art_target_or_host :=
605  art_ndebug_or_debug :=
606  art_static_or_shared :=
607endef
608
609# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since
610# they are used to cross compile for the target.
611ifeq ($(ART_BUILD_HOST_NDEBUG),true)
612  $(eval $(call build-runtime-library,host,ndebug,shared,libart))
613  $(eval $(call build-runtime-library,host,ndebug,shared,libopenjdkjvm))
614  ifeq ($(ART_BUILD_HOST_STATIC),true)
615    $(eval $(call build-runtime-library,host,ndebug,static,libart))
616    $(eval $(call build-runtime-library,host,ndebug,static,libopenjdkjvm))
617  endif
618endif
619ifeq ($(ART_BUILD_HOST_DEBUG),true)
620  $(eval $(call build-runtime-library,host,debug,shared,libart))
621  $(eval $(call build-runtime-library,host,debug,shared,libopenjdkjvm))
622  ifeq ($(ART_BUILD_HOST_STATIC),true)
623    $(eval $(call build-runtime-library,host,debug,static,libart))
624    $(eval $(call build-runtime-library,host,debug,static,libopenjdkjvm))
625  endif
626endif
627
628ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
629#  $(error $(call build-runtime-library,target,ndebug))
630  $(eval $(call build-runtime-library,target,ndebug,shared,libart))
631  $(eval $(call build-runtime-library,target,ndebug,shared,libopenjdkjvm))
632endif
633ifeq ($(ART_BUILD_TARGET_DEBUG),true)
634  $(eval $(call build-runtime-library,target,debug,shared,libart))
635  $(eval $(call build-runtime-library,target,debug,shared,libopenjdkjvm))
636endif
637
638# Clear locally defined variables.
639LOCAL_PATH :=
640LIBART_COMMON_SRC_FILES :=
641LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES :=
642LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
6432ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
644LIBART_HOST_LDFLAGS :=
645LIBART_TARGET_LDFLAGS :=
646LIBART_TARGET_LDFLAGS_arm :=
647LIBART_TARGET_LDFLAGS_arm64 :=
648LIBART_TARGET_LDFLAGS_x86 :=
649LIBART_TARGET_LDFLAGS_x86_64 :=
650LIBART_TARGET_LDFLAGS_mips :=
651LIBART_TARGET_LDFLAGS_mips64 :=
652LIBART_TARGET_SRC_FILES :=
653LIBART_TARGET_SRC_FILES_arm :=
654LIBART_TARGET_SRC_FILES_arm64 :=
655LIBART_TARGET_SRC_FILES_x86 :=
656LIBART_TARGET_SRC_FILES_x86_64 :=
657LIBART_TARGET_SRC_FILES_mips :=
658LIBART_TARGET_SRC_FILES_mips64 :=
659LIBART_HOST_SRC_FILES :=
660LIBART_HOST_SRC_FILES_32 :=
661LIBART_HOST_SRC_FILES_64 :=
662LIBART_ENUM_OPERATOR_OUT_HEADER_FILES :=
663LIBART_CFLAGS :=
664LIBART_TARGET_CFLAGS :=
665LIBART_HOST_CFLAGS :=
666build-runtime-library :=
667