blob: fdc3e7c82f218ba26070f63a116252914f489fdc [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 \
67 gc/space/rosalloc_space.cc \
68 gc/space/space.cc \
69 gc/space/zygote_space.cc \
Mathieu Chartiera5eae692014-12-17 17:56:03 -080070 gc/task_processor.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070071 hprof/hprof.cc \
72 image.cc \
73 indirect_reference_table.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070074 instrumentation.cc \
75 intern_table.cc \
76 interpreter/interpreter.cc \
77 interpreter/interpreter_common.cc \
78 interpreter/interpreter_switch_impl.cc \
Ian Rogers68d8b422014-07-17 11:09:10 -070079 java_vm_ext.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070080 jdwp/jdwp_event.cc \
81 jdwp/jdwp_expand_buf.cc \
82 jdwp/jdwp_handler.cc \
83 jdwp/jdwp_main.cc \
84 jdwp/jdwp_request.cc \
85 jdwp/jdwp_socket.cc \
86 jdwp/object_registry.cc \
Ian Rogers68d8b422014-07-17 11:09:10 -070087 jni_env_ext.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070088 jni_internal.cc \
89 jobject_comparator.cc \
90 mem_map.cc \
91 memory_region.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -070092 mirror/art_field.cc \
93 mirror/art_method.cc \
94 mirror/array.cc \
95 mirror/class.cc \
96 mirror/dex_cache.cc \
97 mirror/object.cc \
98 mirror/reference.cc \
99 mirror/stack_trace_element.cc \
100 mirror/string.cc \
101 mirror/throwable.cc \
102 monitor.cc \
Calin Juravlec8423522014-08-12 20:55:20 +0100103 native_bridge_art_interface.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700104 native/dalvik_system_DexFile.cc \
105 native/dalvik_system_VMDebug.cc \
106 native/dalvik_system_VMRuntime.cc \
107 native/dalvik_system_VMStack.cc \
108 native/dalvik_system_ZygoteHooks.cc \
109 native/java_lang_Class.cc \
110 native/java_lang_DexCache.cc \
111 native/java_lang_Object.cc \
112 native/java_lang_Runtime.cc \
113 native/java_lang_String.cc \
114 native/java_lang_System.cc \
115 native/java_lang_Thread.cc \
116 native/java_lang_Throwable.cc \
117 native/java_lang_VMClassLoader.cc \
Mathieu Chartiera5a53ef2014-09-12 12:58:05 -0700118 native/java_lang_ref_FinalizerReference.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700119 native/java_lang_ref_Reference.cc \
120 native/java_lang_reflect_Array.cc \
121 native/java_lang_reflect_Constructor.cc \
122 native/java_lang_reflect_Field.cc \
123 native/java_lang_reflect_Method.cc \
124 native/java_lang_reflect_Proxy.cc \
125 native/java_util_concurrent_atomic_AtomicLong.cc \
126 native/org_apache_harmony_dalvik_ddmc_DdmServer.cc \
127 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc \
128 native/sun_misc_Unsafe.cc \
129 oat.cc \
130 oat_file.cc \
131 object_lock.cc \
132 offsets.cc \
133 os_linux.cc \
134 parsed_options.cc \
135 primitive.cc \
136 quick_exception_handler.cc \
137 quick/inline_method_analyser.cc \
138 reference_table.cc \
139 reflection.cc \
140 runtime.cc \
141 signal_catcher.cc \
142 stack.cc \
143 thread.cc \
144 thread_list.cc \
145 thread_pool.cc \
146 throw_location.cc \
147 trace.cc \
148 transaction.cc \
149 profiler.cc \
150 fault_handler.cc \
151 utf.cc \
152 utils.cc \
153 verifier/dex_gc_map.cc \
154 verifier/instruction_flags.cc \
155 verifier/method_verifier.cc \
156 verifier/reg_type.cc \
157 verifier/reg_type_cache.cc \
158 verifier/register_line.cc \
159 well_known_classes.cc \
160 zip_archive.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700161
162LIBART_COMMON_SRC_FILES += \
Ian Rogers22d5e732014-07-15 22:23:51 -0700163 arch/context.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800164 arch/instruction_set.cc \
165 arch/instruction_set_features.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700166 arch/memcmp16.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800167 arch/arm/instruction_set_features_arm.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700168 arch/arm/registers_arm.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800169 arch/arm64/instruction_set_features_arm64.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700170 arch/arm64/registers_arm64.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800171 arch/mips/instruction_set_features_mips.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700172 arch/mips/registers_mips.cc \
Andreas Gampe57b34292015-01-14 15:45:59 -0800173 arch/mips64/instruction_set_features_mips64.cc \
174 arch/mips64/registers_mips64.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800175 arch/x86/instruction_set_features_x86.cc \
176 arch/x86/registers_x86.cc \
177 arch/x86_64/registers_x86_64.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700178 entrypoints/entrypoint_utils.cc \
179 entrypoints/interpreter/interpreter_entrypoints.cc \
180 entrypoints/jni/jni_entrypoints.cc \
181 entrypoints/math_entrypoints.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700182 entrypoints/quick/quick_alloc_entrypoints.cc \
183 entrypoints/quick/quick_cast_entrypoints.cc \
184 entrypoints/quick/quick_deoptimization_entrypoints.cc \
185 entrypoints/quick/quick_dexcache_entrypoints.cc \
186 entrypoints/quick/quick_field_entrypoints.cc \
187 entrypoints/quick/quick_fillarray_entrypoints.cc \
188 entrypoints/quick/quick_instrumentation_entrypoints.cc \
189 entrypoints/quick/quick_jni_entrypoints.cc \
190 entrypoints/quick/quick_lock_entrypoints.cc \
191 entrypoints/quick/quick_math_entrypoints.cc \
192 entrypoints/quick/quick_thread_entrypoints.cc \
193 entrypoints/quick/quick_throw_entrypoints.cc \
194 entrypoints/quick/quick_trampoline_entrypoints.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700195
Sebastien Hertzfa888d02014-09-30 12:00:11 +0200196# Source files that only compile with GCC.
197LIBART_GCC_ONLY_SRC_FILES := \
198 interpreter/interpreter_goto_table_impl.cc
199
Elliott Hughes7ac7e322014-06-27 17:20:59 -0700200LIBART_TARGET_LDFLAGS :=
Ian Rogersc5f17732014-06-05 20:48:42 -0700201LIBART_HOST_LDFLAGS :=
Colin Crossdc781a12014-02-04 16:22:03 -0800202
Brian Carlstrom7940e442013-07-12 13:46:57 -0700203LIBART_TARGET_SRC_FILES := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700204 $(LIBART_COMMON_SRC_FILES) \
Ian Rogers22d5e732014-07-15 22:23:51 -0700205 jdwp/jdwp_adb.cc \
206 monitor_android.cc \
207 runtime_android.cc \
208 thread_android.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700209
Colin Crossdc781a12014-02-04 16:22:03 -0800210LIBART_TARGET_SRC_FILES_arm := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700211 arch/arm/context_arm.cc.arm \
212 arch/arm/entrypoints_init_arm.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800213 arch/arm/instruction_set_features_assembly_tests.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700214 arch/arm/jni_entrypoints_arm.S \
215 arch/arm/memcmp16_arm.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700216 arch/arm/quick_entrypoints_arm.S \
Zheng Xu5667fdb2014-10-23 18:29:55 +0800217 arch/arm/quick_entrypoints_cc_arm.cc \
Ian Rogers22d5e732014-07-15 22:23:51 -0700218 arch/arm/thread_arm.cc \
219 arch/arm/fault_handler_arm.cc
Colin Crossdc781a12014-02-04 16:22:03 -0800220
Stuart Monteithb95a5342014-03-12 13:32:32 +0000221LIBART_TARGET_SRC_FILES_arm64 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700222 arch/arm64/context_arm64.cc \
223 arch/arm64/entrypoints_init_arm64.cc \
224 arch/arm64/jni_entrypoints_arm64.S \
225 arch/arm64/memcmp16_arm64.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700226 arch/arm64/quick_entrypoints_arm64.S \
227 arch/arm64/thread_arm64.cc \
228 monitor_pool.cc \
229 arch/arm64/fault_handler_arm64.cc
Stuart Monteithb95a5342014-03-12 13:32:32 +0000230
Ying Wangc6585b72014-04-23 18:19:44 -0700231LIBART_SRC_FILES_x86 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700232 arch/x86/context_x86.cc \
233 arch/x86/entrypoints_init_x86.cc \
234 arch/x86/jni_entrypoints_x86.S \
Alexander Ivchenko907194a2014-07-14 18:54:34 +0400235 arch/x86/memcmp16_x86.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700236 arch/x86/quick_entrypoints_x86.S \
237 arch/x86/thread_x86.cc \
238 arch/x86/fault_handler_x86.cc
Colin Crossdc781a12014-02-04 16:22:03 -0800239
Ying Wangc6585b72014-04-23 18:19:44 -0700240LIBART_TARGET_SRC_FILES_x86 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700241 $(LIBART_SRC_FILES_x86)
Ying Wangc6585b72014-04-23 18:19:44 -0700242
Dave Allisondfd3b472014-07-16 16:04:32 -0700243# Note that the fault_handler_x86.cc is not a mistake. This file is
244# shared between the x86 and x86_64 architectures.
Ying Wangc6585b72014-04-23 18:19:44 -0700245LIBART_SRC_FILES_x86_64 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700246 arch/x86_64/context_x86_64.cc \
247 arch/x86_64/entrypoints_init_x86_64.cc \
248 arch/x86_64/jni_entrypoints_x86_64.S \
Varvara Rainchik2a0bffd2014-07-30 17:01:24 +0400249 arch/x86_64/memcmp16_x86_64.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700250 arch/x86_64/quick_entrypoints_x86_64.S \
251 arch/x86_64/thread_x86_64.cc \
252 monitor_pool.cc \
Dave Allisondfd3b472014-07-16 16:04:32 -0700253 arch/x86/fault_handler_x86.cc
Colin Crossdc781a12014-02-04 16:22:03 -0800254
Ying Wangc6585b72014-04-23 18:19:44 -0700255LIBART_TARGET_SRC_FILES_x86_64 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700256 $(LIBART_SRC_FILES_x86_64) \
Colin Crossdc781a12014-02-04 16:22:03 -0800257
258LIBART_TARGET_SRC_FILES_mips := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700259 arch/mips/context_mips.cc \
260 arch/mips/entrypoints_init_mips.cc \
261 arch/mips/jni_entrypoints_mips.S \
262 arch/mips/memcmp16_mips.S \
Ian Rogers22d5e732014-07-15 22:23:51 -0700263 arch/mips/quick_entrypoints_mips.S \
264 arch/mips/thread_mips.cc \
265 arch/mips/fault_handler_mips.cc
Colin Crossdc781a12014-02-04 16:22:03 -0800266
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800267LIBART_TARGET_SRC_FILES_mips64 := \
268 arch/mips64/context_mips64.cc \
269 arch/mips64/entrypoints_init_mips64.cc \
270 arch/mips64/jni_entrypoints_mips64.S \
271 arch/mips64/memcmp16_mips64.S \
272 arch/mips64/quick_entrypoints_mips64.S \
273 arch/mips64/thread_mips64.cc \
274 monitor_pool.cc \
275 arch/mips64/fault_handler_mips64.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700276
Brian Carlstrom7940e442013-07-12 13:46:57 -0700277LIBART_HOST_SRC_FILES := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700278 $(LIBART_COMMON_SRC_FILES) \
Ian Rogers22d5e732014-07-15 22:23:51 -0700279 monitor_linux.cc \
280 runtime_linux.cc \
281 thread_linux.cc
Brian Carlstrom7940e442013-07-12 13:46:57 -0700282
Ying Wangc6585b72014-04-23 18:19:44 -0700283LIBART_HOST_SRC_FILES_32 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700284 $(LIBART_SRC_FILES_x86)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700285
Ying Wangc6585b72014-04-23 18:19:44 -0700286LIBART_HOST_SRC_FILES_64 := \
Ian Rogers22d5e732014-07-15 22:23:51 -0700287 $(LIBART_SRC_FILES_x86_64)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700288
289LIBART_ENUM_OPERATOR_OUT_HEADER_FILES := \
Ian Rogersd582fa42014-11-05 23:46:43 -0800290 arch/instruction_set.h \
Mathieu Chartierbad02672014-08-25 13:08:22 -0700291 base/allocator.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700292 base/mutex.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700293 debugger.h \
Andreas Gampe4303ba92014-11-06 01:00:46 -0800294 base/unix_file/fd_file.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700295 dex_file.h \
296 dex_instruction.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700297 gc/allocator/rosalloc.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700298 gc/collector/gc_type.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700299 gc/allocator_type.h \
Mathieu Chartierb363f662014-07-16 13:28:58 -0700300 gc/collector_type.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700301 gc/space/space.h \
302 gc/heap.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700303 instrumentation.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700304 indirect_reference_table.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700305 invoke_type.h \
306 jdwp/jdwp.h \
307 jdwp/jdwp_constants.h \
308 lock_word.h \
309 mirror/class.h \
310 oat.h \
311 object_callbacks.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700312 profiler_options.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700313 quick/inline_method_analyser.h \
Ian Rogers6a3c1fc2014-10-31 00:33:20 -0700314 runtime.h \
315 stack.h \
Ian Rogers22d5e732014-07-15 22:23:51 -0700316 thread.h \
317 thread_state.h \
318 verifier/method_verifier.h
Brian Carlstrom7940e442013-07-12 13:46:57 -0700319
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700320LIBART_CFLAGS := -DBUILDING_LIBART=1
Brian Carlstrom7940e442013-07-12 13:46:57 -0700321
Christopher Ferrisfc35de02014-07-10 18:53:22 -0700322ifeq ($(MALLOC_IMPL),dlmalloc)
Christopher Ferrisc4ddc042014-05-13 14:47:50 -0700323 LIBART_CFLAGS += -DUSE_DLMALLOC
Christopher Ferrisfc35de02014-07-10 18:53:22 -0700324else
325 LIBART_CFLAGS += -DUSE_JEMALLOC
Christopher Ferrisc4ddc042014-05-13 14:47:50 -0700326endif
327
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700328# Default dex2oat instruction set features.
329LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES := default
330LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
3312ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := default
332ifeq ($(DEX2OAT_TARGET_ARCH),arm)
333 ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
Andreas Gampe72a122c2014-11-13 19:10:33 -0800334 LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700335 else
336 ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
337 LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
338 endif
339 endif
340endif
341ifeq ($(2ND_DEX2OAT_TARGET_ARCH),arm)
342 ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a15 krait denver))
Andreas Gampe72a122c2014-11-13 19:10:33 -0800343 2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := atomic_ldrd_strd,div
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700344 else
345 ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7))
346 2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES := div
347 endif
348 endif
349endif
350
Brian Carlstrom7940e442013-07-12 13:46:57 -0700351# $(1): target or host
352# $(2): ndebug or debug
353define build-libart
354 ifneq ($(1),target)
355 ifneq ($(1),host)
356 $$(error expected target or host for argument 1, received $(1))
357 endif
358 endif
359 ifneq ($(2),ndebug)
360 ifneq ($(2),debug)
361 $$(error expected ndebug or debug for argument 2, received $(2))
362 endif
363 endif
364
365 art_target_or_host := $(1)
366 art_ndebug_or_debug := $(2)
367
Ian Rogersafd9acc2014-06-17 08:21:54 -0700368 include $$(CLEAR_VARS)
Chih-Hung Hsiehc9596952014-10-16 12:14:02 -0700369 # Clang assembler has problem with macros in asm_support_x86.S, http://b/17443165,
370 # on linux. Yet sdk on mac needs integrated assembler.
371 ifeq ($$(HOST_OS),darwin)
372 LOCAL_CLANG_ASFLAGS += -integrated-as
373 else
374 LOCAL_CLANG_ASFLAGS += -no-integrated-as
375 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700376 LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700377 ifeq ($$(art_ndebug_or_debug),ndebug)
378 LOCAL_MODULE := libart
Dehao Chen6c36a8b2014-11-13 14:13:58 -0800379 ifeq ($$(art_target_or_host),target)
380 LOCAL_FDO_SUPPORT := true
381 endif
Brian Carlstrom7940e442013-07-12 13:46:57 -0700382 else # debug
383 LOCAL_MODULE := libartd
384 endif
385
386 LOCAL_MODULE_TAGS := optional
387 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
388
389 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700390 LOCAL_SRC_FILES := $$(LIBART_TARGET_SRC_FILES)
391 $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
392 $$(eval LOCAL_SRC_FILES_$$(arch) := $$$$(LIBART_TARGET_SRC_FILES_$$(arch))))
Brian Carlstrom7940e442013-07-12 13:46:57 -0700393 else # host
Ian Rogersafd9acc2014-06-17 08:21:54 -0700394 LOCAL_SRC_FILES := $$(LIBART_HOST_SRC_FILES)
395 LOCAL_SRC_FILES_32 := $$(LIBART_HOST_SRC_FILES_32)
396 LOCAL_SRC_FILES_64 := $$(LIBART_HOST_SRC_FILES_64)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700397 LOCAL_IS_HOST_MODULE := true
398 endif
399
Colin Crossdc781a12014-02-04 16:22:03 -0800400 GENERATED_SRC_DIR := $$(call local-generated-sources-dir)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700401 ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES))
402 ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES))
403
404$$(ENUM_OPERATOR_OUT_GEN): art/tools/generate-operator-out.py
405$$(ENUM_OPERATOR_OUT_GEN): PRIVATE_CUSTOM_TOOL = art/tools/generate-operator-out.py $(LOCAL_PATH) $$< > $$@
406$$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : $(LOCAL_PATH)/%.h
407 $$(transform-generated-source)
408
409 LOCAL_GENERATED_SOURCES += $$(ENUM_OPERATOR_OUT_GEN)
410
Ian Rogersafd9acc2014-06-17 08:21:54 -0700411 LOCAL_CFLAGS := $$(LIBART_CFLAGS)
Dan Albert58bea4a2014-08-09 18:08:07 -0700412 LOCAL_LDFLAGS := $$(LIBART_LDFLAGS)
Ian Rogersc5f17732014-06-05 20:48:42 -0700413 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700414 LOCAL_LDFLAGS += $$(LIBART_TARGET_LDFLAGS)
Ian Rogersc5f17732014-06-05 20:48:42 -0700415 else
Ian Rogersafd9acc2014-06-17 08:21:54 -0700416 LOCAL_LDFLAGS += $$(LIBART_HOST_LDFLAGS)
Ian Rogersc5f17732014-06-05 20:48:42 -0700417 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700418 $$(foreach arch,$$(ART_TARGET_SUPPORTED_ARCH), \
419 $$(eval LOCAL_LDFLAGS_$$(arch) := $$(LIBART_TARGET_LDFLAGS_$$(arch))))
Colin Crossdc781a12014-02-04 16:22:03 -0800420
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700421 # Clang usage
Brian Carlstrom7940e442013-07-12 13:46:57 -0700422 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700423 $$(eval $$(call set-target-local-clang-vars))
424 $$(eval $$(call set-target-local-cflags-vars,$(2)))
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700425 LOCAL_CFLAGS_$(DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
426 LOCAL_CFLAGS_$(2ND_DEX2OAT_TARGET_ARCH) += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(2ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES)"
427
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700428 # TODO: Loop with ifeq, ART_TARGET_CLANG
Ian Rogersafd9acc2014-06-17 08:21:54 -0700429 ifneq ($$(ART_TARGET_CLANG_$$(TARGET_ARCH)),true)
430 LOCAL_SRC_FILES_$$(TARGET_ARCH) += $$(LIBART_GCC_ONLY_SRC_FILES)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700431 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700432 ifneq ($$(ART_TARGET_CLANG_$$(TARGET_2ND_ARCH)),true)
433 LOCAL_SRC_FILES_$$(TARGET_2ND_ARCH) += $$(LIBART_GCC_ONLY_SRC_FILES)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700434 endif
Brian Carlstrom7940e442013-07-12 13:46:57 -0700435 else # host
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700436 ifneq ($$(ART_HOST_CLANG),true)
437 # Add files only built with GCC on the host.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700438 LOCAL_SRC_FILES += $$(LIBART_GCC_ONLY_SRC_FILES)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700439 endif
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700440 LOCAL_CLANG := $$(ART_HOST_CLANG)
441 LOCAL_LDLIBS := $$(ART_HOST_LDLIBS)
442 LOCAL_LDLIBS += -ldl -lpthread
443 ifeq ($$(HOST_OS),linux)
444 LOCAL_LDLIBS += -lrt
445 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700446 LOCAL_CFLAGS += $$(ART_HOST_CFLAGS)
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700447 LOCAL_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES="$(LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES)"
448
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700449 ifeq ($$(art_ndebug_or_debug),debug)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700450 LOCAL_CFLAGS += $$(ART_HOST_DEBUG_CFLAGS)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700451 else
Ian Rogersafd9acc2014-06-17 08:21:54 -0700452 LOCAL_CFLAGS += $$(ART_HOST_NON_DEBUG_CFLAGS)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700453 endif
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700454 LOCAL_MULTILIB := both
Brian Carlstrom7940e442013-07-12 13:46:57 -0700455 endif
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700456
Ian Rogersafd9acc2014-06-17 08:21:54 -0700457 LOCAL_C_INCLUDES += $$(ART_C_INCLUDES)
Dave Allisonf4b80bc2014-05-14 15:41:25 -0700458 LOCAL_C_INCLUDES += art/sigchainlib
459
Ian Rogers872dd822014-10-30 11:19:14 -0700460 LOCAL_SHARED_LIBRARIES := libnativehelper libnativebridge libsigchain
Dan Albert2a0e9542014-05-21 14:55:02 -0700461 include external/libcxx/libcxx.mk
Dan Alberte73a0642014-11-11 15:14:07 -0800462 LOCAL_SHARED_LIBRARIES += libbacktrace
Brian Carlstrom7940e442013-07-12 13:46:57 -0700463 ifeq ($$(art_target_or_host),target)
Ian Rogers872dd822014-10-30 11:19:14 -0700464 LOCAL_SHARED_LIBRARIES += libdl
465 # ZipArchive support, the order matters here to get all symbols.
Narayan Kamath92572be2013-11-28 14:06:24 +0000466 LOCAL_STATIC_LIBRARIES := libziparchive libz
Ian Rogers872dd822014-10-30 11:19:14 -0700467 # For android::FileMap used by libziparchive.
468 LOCAL_SHARED_LIBRARIES += libutils
469 # For liblog, atrace, properties, ashmem, set_sched_policy and socket_peer_is_trusted.
470 LOCAL_SHARED_LIBRARIES += libcutils
Brian Carlstrom7940e442013-07-12 13:46:57 -0700471 else # host
Ian Rogers872dd822014-10-30 11:19:14 -0700472 LOCAL_SHARED_LIBRARIES += libziparchive-host
473 # For ashmem_create_region.
474 LOCAL_STATIC_LIBRARIES += libcutils
Brian Carlstrom7940e442013-07-12 13:46:57 -0700475 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700476 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
Ian Rogersc7dd2952014-10-21 23:31:19 -0700477 LOCAL_ADDITIONAL_DEPENDENCIES += $$(LOCAL_PATH)/Android.mk
Colin Crossdc781a12014-02-04 16:22:03 -0800478
479 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700480 LOCAL_MODULE_TARGET_ARCH := $$(ART_TARGET_SUPPORTED_ARCH)
Colin Crossdc781a12014-02-04 16:22:03 -0800481 endif
482
Brian Carlstrom7940e442013-07-12 13:46:57 -0700483 ifeq ($$(art_target_or_host),target)
Christopher Ferrisd59b7b12014-04-01 12:29:09 -0700484 ifneq ($$(art_ndebug_or_debug),debug)
485 # Leave the symbols in the shared library so that stack unwinders can
486 # produce meaningful name resolution.
487 LOCAL_STRIP_MODULE := keep_symbols
488 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700489 include $$(BUILD_SHARED_LIBRARY)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700490 else # host
Ian Rogersafd9acc2014-06-17 08:21:54 -0700491 include $$(BUILD_HOST_SHARED_LIBRARY)
Brian Carlstrom7940e442013-07-12 13:46:57 -0700492 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700493
494 # Clear locally defined variables.
495 GENERATED_SRC_DIR :=
496 ENUM_OPERATOR_OUT_CC_FILES :=
497 ENUM_OPERATOR_OUT_GEN :=
498 art_target_or_host :=
499 art_ndebug_or_debug :=
Brian Carlstrom7940e442013-07-12 13:46:57 -0700500endef
501
Ian Rogers719d1a32014-03-06 12:13:39 -0800502# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since
503# they are used to cross compile for the target.
Junmo Park76ab3472014-08-11 21:28:16 +0900504ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Ian Rogersc5f17732014-06-05 20:48:42 -0700505 $(eval $(call build-libart,host,ndebug))
506endif
Junmo Park76ab3472014-08-11 21:28:16 +0900507ifeq ($(ART_BUILD_HOST_DEBUG),true)
Ian Rogersc5f17732014-06-05 20:48:42 -0700508 $(eval $(call build-libart,host,debug))
Brian Carlstrom7940e442013-07-12 13:46:57 -0700509endif
Ian Rogers719d1a32014-03-06 12:13:39 -0800510
511ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700512# $(error $(call build-libart,target,ndebug))
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700513 $(eval $(call build-libart,target,ndebug))
Ian Rogers719d1a32014-03-06 12:13:39 -0800514endif
515ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700516 $(eval $(call build-libart,target,debug))
Ian Rogers719d1a32014-03-06 12:13:39 -0800517endif
Dave Allisonf4b80bc2014-05-14 15:41:25 -0700518
Ian Rogersafd9acc2014-06-17 08:21:54 -0700519# Clear locally defined variables.
520LOCAL_PATH :=
521LIBART_COMMON_SRC_FILES :=
522LIBART_GCC_ONLY_SRC_FILES :=
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700523LIBART_HOST_DEFAULT_INSTRUCTION_SET_FEATURES :=
524LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
5252ND_LIBART_TARGET_DEFAULT_INSTRUCTION_SET_FEATURES :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700526LIBART_TARGET_LDFLAGS :=
527LIBART_HOST_LDFLAGS :=
528LIBART_TARGET_SRC_FILES :=
529LIBART_TARGET_SRC_FILES_arm :=
530LIBART_TARGET_SRC_FILES_arm64 :=
531LIBART_TARGET_SRC_FILES_x86 :=
532LIBART_TARGET_SRC_FILES_x86_64 :=
533LIBART_TARGET_SRC_FILES_mips :=
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800534LIBART_TARGET_SRC_FILES_mips64 :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700535LIBART_HOST_SRC_FILES :=
536LIBART_HOST_SRC_FILES_32 :=
537LIBART_HOST_SRC_FILES_64 :=
538LIBART_ENUM_OPERATOR_OUT_HEADER_FILES :=
539LIBART_CFLAGS :=
Elliott Hughes7ac7e322014-06-27 17:20:59 -0700540build-libart :=