blob: 907d8840aaf61b055b7f1c175e11281abe9e2ea3 [file] [log] [blame]
Brian Carlstrom7940e442013-07-12 13:46:57 -07001#
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
Ian Rogersafd9acc2014-06-17 08:21:54 -070019include art/build/Android.common_build.mk
Brian Carlstrom7940e442013-07-12 13:46:57 -070020
21LIBART_COMMON_SRC_FILES := \
Ian Rogers22d5e732014-07-15 22:23:51 -070022 atomic.cc.arm \
23 barrier.cc \
24 base/allocator.cc \
25 base/bit_vector.cc \
26 base/hex_dump.cc \
27 base/logging.cc \
28 base/mutex.cc \
29 base/scoped_flock.cc \
30 base/stringpiece.cc \
31 base/stringprintf.cc \
32 base/timing_logger.cc \
33 base/unix_file/fd_file.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070034 base/unix_file/random_access_file_utils.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070035 check_jni.cc \
36 class_linker.cc \
37 common_throws.cc \
38 debugger.cc \
39 dex_file.cc \
40 dex_file_verifier.cc \
41 dex_instruction.cc \
42 elf_file.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070043 gc/allocator/dlmalloc.cc \
44 gc/allocator/rosalloc.cc \
45 gc/accounting/card_table.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070046 gc/accounting/heap_bitmap.cc \
47 gc/accounting/mod_union_table.cc \
48 gc/accounting/remembered_set.cc \
49 gc/accounting/space_bitmap.cc \
50 gc/collector/concurrent_copying.cc \
51 gc/collector/garbage_collector.cc \
52 gc/collector/immune_region.cc \
53 gc/collector/mark_compact.cc \
54 gc/collector/mark_sweep.cc \
55 gc/collector/partial_mark_sweep.cc \
56 gc/collector/semi_space.cc \
57 gc/collector/sticky_mark_sweep.cc \
58 gc/gc_cause.cc \
59 gc/heap.cc \
60 gc/reference_processor.cc \
61 gc/reference_queue.cc \
62 gc/space/bump_pointer_space.cc \
63 gc/space/dlmalloc_space.cc \
64 gc/space/image_space.cc \
65 gc/space/large_object_space.cc \
66 gc/space/malloc_space.cc \
Hiroshi Yamauchi2cd334a2015-01-09 14:03:35 -080067 gc/space/region_space.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070068 gc/space/rosalloc_space.cc \
69 gc/space/space.cc \
70 gc/space/zygote_space.cc \
Mathieu Chartiera5eae692014-12-17 17:56:03 -080071 gc/task_processor.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070072 hprof/hprof.cc \
73 image.cc \
74 indirect_reference_table.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070075 instrumentation.cc \
76 intern_table.cc \
77 interpreter/interpreter.cc \
78 interpreter/interpreter_common.cc \
79 interpreter/interpreter_switch_impl.cc \
Ian Rogers68d8b422014-07-17 11:09:10 -070080 java_vm_ext.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070081 jdwp/jdwp_event.cc \
82 jdwp/jdwp_expand_buf.cc \
83 jdwp/jdwp_handler.cc \
84 jdwp/jdwp_main.cc \
85 jdwp/jdwp_request.cc \
86 jdwp/jdwp_socket.cc \
87 jdwp/object_registry.cc \
Ian Rogers68d8b422014-07-17 11:09:10 -070088 jni_env_ext.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070089 jni_internal.cc \
90 jobject_comparator.cc \
91 mem_map.cc \
92 memory_region.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070093 mirror/art_field.cc \
94 mirror/art_method.cc \
95 mirror/array.cc \
96 mirror/class.cc \
97 mirror/dex_cache.cc \
98 mirror/object.cc \
99 mirror/reference.cc \
100 mirror/stack_trace_element.cc \
101 mirror/string.cc \
102 mirror/throwable.cc \
103 monitor.cc \
Calin Juravlec8423522014-08-12 20:55:20 +0100104 native_bridge_art_interface.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700105 native/dalvik_system_DexFile.cc \
106 native/dalvik_system_VMDebug.cc \
107 native/dalvik_system_VMRuntime.cc \
108 native/dalvik_system_VMStack.cc \
109 native/dalvik_system_ZygoteHooks.cc \
110 native/java_lang_Class.cc \
111 native/java_lang_DexCache.cc \
112 native/java_lang_Object.cc \
113 native/java_lang_Runtime.cc \
114 native/java_lang_String.cc \
115 native/java_lang_System.cc \
116 native/java_lang_Thread.cc \
117 native/java_lang_Throwable.cc \
118 native/java_lang_VMClassLoader.cc \
Mathieu Chartiera5a53ef2014-09-12 12:58:05 -0700119 native/java_lang_ref_FinalizerReference.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700120 native/java_lang_ref_Reference.cc \
121 native/java_lang_reflect_Array.cc \
122 native/java_lang_reflect_Constructor.cc \
123 native/java_lang_reflect_Field.cc \
124 native/java_lang_reflect_Method.cc \
125 native/java_lang_reflect_Proxy.cc \
126 native/java_util_concurrent_atomic_AtomicLong.cc \
127 native/org_apache_harmony_dalvik_ddmc_DdmServer.cc \
128 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc \
129 native/sun_misc_Unsafe.cc \
130 oat.cc \
131 oat_file.cc \
132 object_lock.cc \
133 offsets.cc \
134 os_linux.cc \
135 parsed_options.cc \
136 primitive.cc \
137 quick_exception_handler.cc \
138 quick/inline_method_analyser.cc \
139 reference_table.cc \
140 reflection.cc \
141 runtime.cc \
Igor Murashkinaaebaa02015-01-26 10:55:53 -0800142 runtime_options.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700143 signal_catcher.cc \
144 stack.cc \
145 thread.cc \
146 thread_list.cc \
147 thread_pool.cc \
148 throw_location.cc \
149 trace.cc \
150 transaction.cc \
151 profiler.cc \
152 fault_handler.cc \
153 utf.cc \
154 utils.cc \
155 verifier/dex_gc_map.cc \
156 verifier/instruction_flags.cc \
157 verifier/method_verifier.cc \
158 verifier/reg_type.cc \
159 verifier/reg_type_cache.cc \
160 verifier/register_line.cc \
161 well_known_classes.cc \
162 zip_archive.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700163
164LIBART_COMMON_SRC_FILES += \
Ian Rogers22d5e732014-07-15 22:23:51 -0700165 arch/context.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800166 arch/instruction_set.cc \
167 arch/instruction_set_features.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700168 arch/memcmp16.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800169 arch/arm/instruction_set_features_arm.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700170 arch/arm/registers_arm.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800171 arch/arm64/instruction_set_features_arm64.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700172 arch/arm64/registers_arm64.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800173 arch/mips/instruction_set_features_mips.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700174 arch/mips/registers_mips.cc \
Andreas Gampe57b34292015-01-14 15:45:59 -0800175 arch/mips64/instruction_set_features_mips64.cc \
176 arch/mips64/registers_mips64.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800177 arch/x86/instruction_set_features_x86.cc \
178 arch/x86/registers_x86.cc \
179 arch/x86_64/registers_x86_64.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700180 entrypoints/entrypoint_utils.cc \
181 entrypoints/interpreter/interpreter_entrypoints.cc \
182 entrypoints/jni/jni_entrypoints.cc \
183 entrypoints/math_entrypoints.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700184 entrypoints/quick/quick_alloc_entrypoints.cc \
185 entrypoints/quick/quick_cast_entrypoints.cc \
186 entrypoints/quick/quick_deoptimization_entrypoints.cc \
187 entrypoints/quick/quick_dexcache_entrypoints.cc \
188 entrypoints/quick/quick_field_entrypoints.cc \
189 entrypoints/quick/quick_fillarray_entrypoints.cc \
190 entrypoints/quick/quick_instrumentation_entrypoints.cc \
191 entrypoints/quick/quick_jni_entrypoints.cc \
192 entrypoints/quick/quick_lock_entrypoints.cc \
193 entrypoints/quick/quick_math_entrypoints.cc \
194 entrypoints/quick/quick_thread_entrypoints.cc \
195 entrypoints/quick/quick_throw_entrypoints.cc \
196 entrypoints/quick/quick_trampoline_entrypoints.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700197
Sebastien Hertzfa888d02014-09-30 12:00:11 +0200198# Source files that only compile with GCC.
199LIBART_GCC_ONLY_SRC_FILES := \
200 interpreter/interpreter_goto_table_impl.cc
201
Elliott Hughes7ac7e322014-06-27 17:20:59 -0700202LIBART_TARGET_LDFLAGS :=
Ian Rogersc5f17732014-06-05 20:48:42 -0700203LIBART_HOST_LDFLAGS :=
Colin Crossdc781a12014-02-04 16:22:03 -0800204
Brian Carlstrom7940e442013-07-12 13:46:57 -0700205LIBART_TARGET_SRC_FILES := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700206 $(LIBART_COMMON_SRC_FILES) \
Ian Rogers22d5e732014-07-15 22:23:51 -0700207 jdwp/jdwp_adb.cc \
208 monitor_android.cc \
209 runtime_android.cc \
210 thread_android.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700211
Colin Crossdc781a12014-02-04 16:22:03 -0800212LIBART_TARGET_SRC_FILES_arm := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700213 arch/arm/context_arm.cc.arm \
214 arch/arm/entrypoints_init_arm.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800215 arch/arm/instruction_set_features_assembly_tests.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700216 arch/arm/jni_entrypoints_arm.S \
217 arch/arm/memcmp16_arm.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700218 arch/arm/quick_entrypoints_arm.S \
Zheng Xu5667fdb2014-10-23 18:29:55 +0800219 arch/arm/quick_entrypoints_cc_arm.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700220 arch/arm/thread_arm.cc \
221 arch/arm/fault_handler_arm.cc
Colin Crossdc781a12014-02-04 16:22:03 -0800222
Stuart Monteithb95a5342014-03-12 13:32:32 +0000223LIBART_TARGET_SRC_FILES_arm64 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700224 arch/arm64/context_arm64.cc \
225 arch/arm64/entrypoints_init_arm64.cc \
226 arch/arm64/jni_entrypoints_arm64.S \
227 arch/arm64/memcmp16_arm64.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700228 arch/arm64/quick_entrypoints_arm64.S \
229 arch/arm64/thread_arm64.cc \
230 monitor_pool.cc \
231 arch/arm64/fault_handler_arm64.cc
Stuart Monteithb95a5342014-03-12 13:32:32 +0000232
Ying Wangc6585b72014-04-23 18:19:44 -0700233LIBART_SRC_FILES_x86 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700234 arch/x86/context_x86.cc \
235 arch/x86/entrypoints_init_x86.cc \
236 arch/x86/jni_entrypoints_x86.S \
Alexander Ivchenko907194a2014-07-14 18:54:34 +0400237 arch/x86/memcmp16_x86.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700238 arch/x86/quick_entrypoints_x86.S \
239 arch/x86/thread_x86.cc \
240 arch/x86/fault_handler_x86.cc
Colin Crossdc781a12014-02-04 16:22:03 -0800241
Ying Wangc6585b72014-04-23 18:19:44 -0700242LIBART_TARGET_SRC_FILES_x86 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700243 $(LIBART_SRC_FILES_x86)
Ying Wangc6585b72014-04-23 18:19:44 -0700244
Dave Allisondfd3b472014-07-16 16:04:32 -0700245# Note that the fault_handler_x86.cc is not a mistake. This file is
246# shared between the x86 and x86_64 architectures.
Ying Wangc6585b72014-04-23 18:19:44 -0700247LIBART_SRC_FILES_x86_64 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700248 arch/x86_64/context_x86_64.cc \
249 arch/x86_64/entrypoints_init_x86_64.cc \
250 arch/x86_64/jni_entrypoints_x86_64.S \
Varvara Rainchik2a0bffd2014-07-30 17:01:24 +0400251 arch/x86_64/memcmp16_x86_64.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700252 arch/x86_64/quick_entrypoints_x86_64.S \
253 arch/x86_64/thread_x86_64.cc \
254 monitor_pool.cc \
Dave Allisondfd3b472014-07-16 16:04:32 -0700255 arch/x86/fault_handler_x86.cc
Colin Crossdc781a12014-02-04 16:22:03 -0800256
Ying Wangc6585b72014-04-23 18:19:44 -0700257LIBART_TARGET_SRC_FILES_x86_64 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700258 $(LIBART_SRC_FILES_x86_64) \
Colin Crossdc781a12014-02-04 16:22:03 -0800259
260LIBART_TARGET_SRC_FILES_mips := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700261 arch/mips/context_mips.cc \
262 arch/mips/entrypoints_init_mips.cc \
263 arch/mips/jni_entrypoints_mips.S \
264 arch/mips/memcmp16_mips.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700265 arch/mips/quick_entrypoints_mips.S \
266 arch/mips/thread_mips.cc \
267 arch/mips/fault_handler_mips.cc
Colin Crossdc781a12014-02-04 16:22:03 -0800268
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800269LIBART_TARGET_SRC_FILES_mips64 := \
270 arch/mips64/context_mips64.cc \
271 arch/mips64/entrypoints_init_mips64.cc \
272 arch/mips64/jni_entrypoints_mips64.S \
273 arch/mips64/memcmp16_mips64.S \
274 arch/mips64/quick_entrypoints_mips64.S \
275 arch/mips64/thread_mips64.cc \
276 monitor_pool.cc \
277 arch/mips64/fault_handler_mips64.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700278
Brian Carlstrom7940e442013-07-12 13:46:57 -0700279LIBART_HOST_SRC_FILES := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700280 $(LIBART_COMMON_SRC_FILES) \
Ian Rogers22d5e732014-07-15 22:23:51 -0700281 monitor_linux.cc \
282 runtime_linux.cc \
283 thread_linux.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700284
Ying Wangc6585b72014-04-23 18:19:44 -0700285LIBART_HOST_SRC_FILES_32 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700286 $(LIBART_SRC_FILES_x86)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700287
Ying Wangc6585b72014-04-23 18:19:44 -0700288LIBART_HOST_SRC_FILES_64 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700289 $(LIBART_SRC_FILES_x86_64)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700290
291LIBART_ENUM_OPERATOR_OUT_HEADER_FILES := \
Ian Rogersd582fa42014-11-05 23:46:43 -0800292 arch/instruction_set.h \
Mathieu Chartierbad02672014-08-25 13:08:22 -0700293 base/allocator.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700294 base/mutex.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700295 debugger.h \
Andreas Gampe4303ba92014-11-06 01:00:46 -0800296 base/unix_file/fd_file.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700297 dex_file.h \
298 dex_instruction.h \
Mathieu Chartiere34fa1d2015-01-14 14:55:47 -0800299 gc_root.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700300 gc/allocator/rosalloc.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700301 gc/collector/gc_type.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700302 gc/allocator_type.h \
Mathieu Chartierb363f662014-07-16 13:28:58 -0700303 gc/collector_type.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700304 gc/space/space.h \
305 gc/heap.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700306 instrumentation.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700307 indirect_reference_table.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700308 invoke_type.h \
309 jdwp/jdwp.h \
310 jdwp/jdwp_constants.h \
311 lock_word.h \
312 mirror/class.h \
313 oat.h \
314 object_callbacks.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700315 profiler_options.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700316 quick/inline_method_analyser.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700317 runtime.h \
318 stack.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700319 thread.h \
320 thread_state.h \
321 verifier/method_verifier.h
Brian Carlstrom7940e442013-07-12 13:46:57 -0700322
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700323LIBART_CFLAGS := -DBUILDING_LIBART=1
Brian Carlstrom7940e442013-07-12 13:46:57 -0700324
Christopher Ferrisfc35de02014-07-10 18:53:22 -0700325ifeq ($(MALLOC_IMPL),dlmalloc)
Christopher Ferrisc4ddc042014-05-13 14:47:50 -0700326 LIBART_CFLAGS += -DUSE_DLMALLOC
Christopher Ferrisfc35de02014-07-10 18:53:22 -0700327else
328 LIBART_CFLAGS += -DUSE_JEMALLOC
Christopher Ferrisc4ddc042014-05-13 14:47:50 -0700329endif
330
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700331# Default dex2oat instruction set features.
332LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES := default
333LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
3342ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
335ifeq ($(DEX2OAT_TARGET_ARCH),arm)
336 ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
Andreas Gampe72a122c2014-11-13 19:10:33 -0800337 LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700338 else
339 ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
340 LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
341 endif
342 endif
343endif
344ifeq ($(2ND_DEX2OAT_TARGET_ARCH),arm)
345 ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
Andreas Gampe72a122c2014-11-13 19:10:33 -0800346 2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700347 else
348 ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
349 2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
350 endif
351 endif
352endif
353
Brian Carlstrom7940e442013-07-12 13:46:57 -0700354# $(1): target or host
355# $(2): ndebug or debug
356define build-libart
357 ifneq ($(1),target)
358 ifneq ($(1),host)
359 $$(error expected target or host for argument 1, received $(1))
360 endif
361 endif
362 ifneq ($(2),ndebug)
363 ifneq ($(2),debug)
364 $$(error expected ndebug or debug for argument 2, received $(2))
365 endif
366 endif
367
368 art_target_or_host := $(1)
369 art_ndebug_or_debug := $(2)
370
Ian Rogersafd9acc2014-06-17 08:21:54 -0700371 include $$(CLEAR_VARS)
Chih-Hung Hsiehc9596952014-10-16 12:14:02 -0700372 # Clang assembler has problem with macros in asm_support_x86.S, http://b/17443165,
373 # on linux. Yet sdk on mac needs integrated assembler.
374 ifeq ($$(HOST_OS),darwin)
375 LOCAL_CLANG_ASFLAGS += -integrated-as
376 else
377 LOCAL_CLANG_ASFLAGS += -no-integrated-as
378 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700379 LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700380 ifeq ($$(art_ndebug_or_debug),ndebug)
381 LOCAL_MODULE := libart
Dehao Chen6c36a8b2014-11-13 14:13:58 -0800382 ifeq ($$(art_target_or_host),target)
383 LOCAL_FDO_SUPPORT := true
384 endif
Brian Carlstrom7940e442013-07-12 13:46:57 -0700385 else # debug
386 LOCAL_MODULE := libartd
387 endif
388
389 LOCAL_MODULE_TAGS := optional
390 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
391
392 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700393 LOCAL_SRC_FILES := $$(LIBART_TARGET_SRC_FILES)
394 $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
395 $$(eval LOCAL_SRC_FILES_$$(arch) := $$$$(LIBART_TARGET_SRC_FILES_$$(arch))))
Brian Carlstrom7940e442013-07-12 13:46:57 -0700396 else # host
Ian Rogersafd9acc2014-06-17 08:21:54 -0700397 LOCAL_SRC_FILES := $$(LIBART_HOST_SRC_FILES)
398 LOCAL_SRC_FILES_32 := $$(LIBART_HOST_SRC_FILES_32)
399 LOCAL_SRC_FILES_64 := $$(LIBART_HOST_SRC_FILES_64)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700400 LOCAL_IS_HOST_MODULE := true
401 endif
402
Colin Crossdc781a12014-02-04 16:22:03 -0800403 GENERATED_SRC_DIR := $$(call local-generated-sources-dir)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700404 ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES))
405 ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES))
406
407$$(ENUM_OPERATOR_OUT_GEN): art/tools/generate-operator-out.py
408$$(ENUM_OPERATOR_OUT_GEN): PRIVATE_CUSTOM_TOOL = art/tools/generate-operator-out.py $(LOCAL_PATH) $$< > $$@
409$$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PATH)/%.h
410 $$(transform-generated-source)
411
412 LOCAL_GENERATED_SOURCES += $$(ENUM_OPERATOR_OUT_GEN)
413
Ian Rogersafd9acc2014-06-17 08:21:54 -0700414 LOCAL_CFLAGS := $$(LIBART_CFLAGS)
Dan Albert58bea4a2014-08-09 18:08:07 -0700415 LOCAL_LDFLAGS := $$(LIBART_LDFLAGS)
Ian Rogersc5f17732014-06-05 20:48:42 -0700416 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700417 LOCAL_LDFLAGS += $$(LIBART_TARGET_LDFLAGS)
Ian Rogersc5f17732014-06-05 20:48:42 -0700418 else
Ian Rogersafd9acc2014-06-17 08:21:54 -0700419 LOCAL_LDFLAGS += $$(LIBART_HOST_LDFLAGS)
Ian Rogersc5f17732014-06-05 20:48:42 -0700420 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700421 $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
422 $$(eval LOCAL_LDFLAGS_$$(arch) := $$(LIBART_TARGET_LDFLAGS_$$(arch))))
Colin Crossdc781a12014-02-04 16:22:03 -0800423
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700424 # Clang usage
Brian Carlstrom7940e442013-07-12 13:46:57 -0700425 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700426 $$(eval $$(call set-target-local-clang-vars))
427 $$(eval $$(call set-target-local-cflags-vars,$(2)))
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700428 LOCAL_CFLAGS_$(DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
429 LOCAL_CFLAGS_$(2ND_DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
430
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700431 # TODO: Loop with ifeq, ART_TARGET_CLANG
Ian Rogersafd9acc2014-06-17 08:21:54 -0700432 ifneq ($$(ART_TARGET_CLANG_$$(TARGET_ARCH)),true)
433 LOCAL_SRC_FILES_$$(TARGET_ARCH) += $$(LIBART_GCC_ONLY_SRC_FILES)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700434 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700435 ifneq ($$(ART_TARGET_CLANG_$$(TARGET_2ND_ARCH)),true)
436 LOCAL_SRC_FILES_$$(TARGET_2ND_ARCH) += $$(LIBART_GCC_ONLY_SRC_FILES)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700437 endif
Brian Carlstrom7940e442013-07-12 13:46:57 -0700438 else # host
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700439 ifneq ($$(ART_HOST_CLANG),true)
440 # Add files only built with GCC on the host.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700441 LOCAL_SRC_FILES += $$(LIBART_GCC_ONLY_SRC_FILES)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700442 endif
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700443 LOCAL_CLANG := $$(ART_HOST_CLANG)
444 LOCAL_LDLIBS := $$(ART_HOST_LDLIBS)
445 LOCAL_LDLIBS += -ldl -lpthread
446 ifeq ($$(HOST_OS),linux)
447 LOCAL_LDLIBS += -lrt
448 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700449 LOCAL_CFLAGS += $$(ART_HOST_CFLAGS)
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700450 LOCAL_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES)"
451
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700452 ifeq ($$(art_ndebug_or_debug),debug)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700453 LOCAL_CFLAGS += $$(ART_HOST_DEBUG_CFLAGS)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700454 else
Ian Rogersafd9acc2014-06-17 08:21:54 -0700455 LOCAL_CFLAGS += $$(ART_HOST_NON_DEBUG_CFLAGS)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700456 endif
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700457 LOCAL_MULTILIB := both
Brian Carlstrom7940e442013-07-12 13:46:57 -0700458 endif
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700459
Ian Rogersafd9acc2014-06-17 08:21:54 -0700460 LOCAL_C_INCLUDES += $$(ART_C_INCLUDES)
Igor Murashkinaaebaa02015-01-26 10:55:53 -0800461 LOCAL_C_INCLUDES += art/cmdline
Dave Allisonf4b80bc2014-05-14 15:41:25 -0700462 LOCAL_C_INCLUDES += art/sigchainlib
Igor Murashkinaaebaa02015-01-26 10:55:53 -0800463 LOCAL_C_INCLUDES += art
Dave Allisonf4b80bc2014-05-14 15:41:25 -0700464
Ian Rogers872dd822014-10-30 11:19:14 -0700465 LOCAL_SHARED_LIBRARIES := libnativehelper libnativebridge libsigchain
Dan Alberte73a0642014-11-11 15:14:07 -0800466 LOCAL_SHARED_LIBRARIES += libbacktrace
Brian Carlstrom7940e442013-07-12 13:46:57 -0700467 ifeq ($$(art_target_or_host),target)
Ian Rogers872dd822014-10-30 11:19:14 -0700468 LOCAL_SHARED_LIBRARIES += libdl
469 # ZipArchive support, the order matters here to get all symbols.
Narayan Kamath92572be2013-11-28 14:06:24 +0000470 LOCAL_STATIC_LIBRARIES := libziparchive libz
Ian Rogers872dd822014-10-30 11:19:14 -0700471 # For android::FileMap used by libziparchive.
472 LOCAL_SHARED_LIBRARIES += libutils
473 # For liblog, atrace, properties, ashmem, set_sched_policy and socket_peer_is_trusted.
474 LOCAL_SHARED_LIBRARIES += libcutils
Brian Carlstrom7940e442013-07-12 13:46:57 -0700475 else # host
Ian Rogers872dd822014-10-30 11:19:14 -0700476 LOCAL_SHARED_LIBRARIES += libziparchive-host
477 # For ashmem_create_region.
478 LOCAL_STATIC_LIBRARIES += libcutils
Brian Carlstrom7940e442013-07-12 13:46:57 -0700479 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700480 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
Ian Rogersc7dd2952014-10-21 23:31:19 -0700481 LOCAL_ADDITIONAL_DEPENDENCIES += $$(LOCAL_PATH)/Android.mk
Colin Crossdc781a12014-02-04 16:22:03 -0800482
483 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700484 LOCAL_MODULE_TARGET_ARCH := $$(ART_TARGET_SUPPORTED_ARCH)
Colin Crossdc781a12014-02-04 16:22:03 -0800485 endif
486
Dan Albert31fb2602014-09-30 22:10:10 -0700487 LOCAL_NATIVE_COVERAGE := $(ART_COVERAGE)
488
Brian Carlstrom7940e442013-07-12 13:46:57 -0700489 ifeq ($$(art_target_or_host),target)
Christopher Ferrisd59b7b12014-04-01 12:29:09 -0700490 ifneq ($$(art_ndebug_or_debug),debug)
491 # Leave the symbols in the shared library so that stack unwinders can
492 # produce meaningful name resolution.
493 LOCAL_STRIP_MODULE := keep_symbols
494 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700495 include $$(BUILD_SHARED_LIBRARY)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700496 else # host
Ian Rogersafd9acc2014-06-17 08:21:54 -0700497 include $$(BUILD_HOST_SHARED_LIBRARY)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700498 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700499
500 # Clear locally defined variables.
501 GENERATED_SRC_DIR :=
502 ENUM_OPERATOR_OUT_CC_FILES :=
503 ENUM_OPERATOR_OUT_GEN :=
504 art_target_or_host :=
505 art_ndebug_or_debug :=
Brian Carlstrom7940e442013-07-12 13:46:57 -0700506endef
507
Ian Rogers719d1a32014-03-06 12:13:39 -0800508# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since
509# they are used to cross compile for the target.
Junmo Park76ab3472014-08-11 21:28:16 +0900510ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Ian Rogersc5f17732014-06-05 20:48:42 -0700511 $(eval $(call build-libart,host,ndebug))
512endif
Junmo Park76ab3472014-08-11 21:28:16 +0900513ifeq ($(ART_BUILD_HOST_DEBUG),true)
Ian Rogersc5f17732014-06-05 20:48:42 -0700514 $(eval $(call build-libart,host,debug))
Brian Carlstrom7940e442013-07-12 13:46:57 -0700515endif
Ian Rogers719d1a32014-03-06 12:13:39 -0800516
517ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700518# $(error $(call build-libart,target,ndebug))
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700519 $(eval $(call build-libart,target,ndebug))
Ian Rogers719d1a32014-03-06 12:13:39 -0800520endif
521ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700522 $(eval $(call build-libart,target,debug))
Ian Rogers719d1a32014-03-06 12:13:39 -0800523endif
Dave Allisonf4b80bc2014-05-14 15:41:25 -0700524
Ian Rogersafd9acc2014-06-17 08:21:54 -0700525# Clear locally defined variables.
526LOCAL_PATH :=
527LIBART_COMMON_SRC_FILES :=
528LIBART_GCC_ONLY_SRC_FILES :=
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700529LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES :=
530LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
5312ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700532LIBART_TARGET_LDFLAGS :=
533LIBART_HOST_LDFLAGS :=
534LIBART_TARGET_SRC_FILES :=
535LIBART_TARGET_SRC_FILES_arm :=
536LIBART_TARGET_SRC_FILES_arm64 :=
537LIBART_TARGET_SRC_FILES_x86 :=
538LIBART_TARGET_SRC_FILES_x86_64 :=
539LIBART_TARGET_SRC_FILES_mips :=
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800540LIBART_TARGET_SRC_FILES_mips64 :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700541LIBART_HOST_SRC_FILES :=
542LIBART_HOST_SRC_FILES_32 :=
543LIBART_HOST_SRC_FILES_64 :=
544LIBART_ENUM_OPERATOR_OUT_HEADER_FILES :=
545LIBART_CFLAGS :=
Elliott Hughes7ac7e322014-06-27 17:20:59 -0700546build-libart :=