blob: 6e178d6d9f969affe14a554a79115c29153cb1ee [file] [log] [blame]
Shih-wei Liaoc4c98812012-03-10 21:55:51 -08001#
2# Copyright (C) 2012 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
17
18LIBART_COMPILER_LLVM_CFLAGS := -DART_USE_LLVM_COMPILER=1
19
20LIBART_COMPILER_LLVM_SRC_FILES += \
21 src/compiler_llvm/compilation_unit.cc \
22 src/compiler_llvm/compiler_llvm.cc \
23 src/compiler_llvm/dalvik_reg.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080024 src/compiler_llvm/generated/art_module.cc \
25 src/compiler_llvm/inferred_reg_category_map.cc \
26 src/compiler_llvm/ir_builder.cc \
27 src/compiler_llvm/jni_compiler.cc \
28 src/compiler_llvm/method_compiler.cc \
TDYa127d668a062012-04-13 12:36:57 -070029 src/compiler_llvm/runtime_support_builder.cc \
30 src/compiler_llvm/runtime_support_builder_arm.cc \
TDYa127b08ed122012-06-05 23:51:19 -070031 src/compiler_llvm/runtime_support_builder_thumb2.cc \
TDYa127d668a062012-04-13 12:36:57 -070032 src/compiler_llvm/runtime_support_builder_x86.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080033 src/compiler_llvm/runtime_support_llvm.cc \
TDYa127eead4ac2012-06-03 07:15:25 -070034 src/compiler_llvm/stub_compiler.cc \
35 src/compiler_llvm/tbaa_info.cc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080036
37# $(1): target or host
38# $(2): ndebug or debug
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080039define build-libart-compiler-llvm
40 ifneq ($(1),target)
41 ifneq ($(1),host)
42 $$(error expected target or host for argument 1, received $(1))
43 endif
44 endif
45 ifneq ($(2),ndebug)
46 ifneq ($(2),debug)
47 $$(error expected ndebug or debug for argument 2, received $(2))
48 endif
49 endif
50
51 art_target_or_host := $(1)
52 art_ndebug_or_debug := $(2)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080053
54 include $(CLEAR_VARS)
55 ifeq ($$(art_target_or_host),target)
56 include external/stlport/libstlport.mk
57 endif
58 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
59 ifeq ($$(art_ndebug_or_debug),ndebug)
60 LOCAL_MODULE := libart-compiler-llvm
61 else # debug
62 LOCAL_MODULE := libartd-compiler-llvm
63 endif
64
65 LOCAL_MODULE_TAGS := optional
66 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
67
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -070068 LOCAL_SRC_FILES := $(LIBART_COMPILER_LLVM_SRC_FILES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080069 LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
70 ifeq ($$(art_target_or_host),target)
71 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
72 else # host
73 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
74 endif
75
76 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
Logan Chien971bf3f2012-05-01 15:47:55 +080077
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080078 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -070079 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Shih-wei Liaocdc66902012-07-22 16:45:37 -070080 LOCAL_SHARED_LIBRARIES += libbcc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080081 ifeq ($$(art_target_or_host),target)
82 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
83 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080084 else # host
85 LOCAL_STATIC_LIBRARIES += libcutils
86 LOCAL_SHARED_LIBRARIES += libz-host
87 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
88 LOCAL_LDLIBS := -ldl -lpthread
89 ifeq ($(HOST_OS),linux)
90 LOCAL_LDLIBS += -lrt
91 endif
92 endif
93 ifeq ($$(art_ndebug_or_debug),debug)
94 ifeq ($$(art_target_or_host),target)
95 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
96 else # host
97 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
98 endif
99 LOCAL_SHARED_LIBRARIES += libartd
100 else
101 ifeq ($$(art_target_or_host),target)
102 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
103 else # host
104 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
105 endif
106 LOCAL_SHARED_LIBRARIES += libart
107 endif
108 ifeq ($$(art_target_or_host),target)
109 include $(LLVM_GEN_INTRINSICS_MK)
110 include $(LLVM_DEVICE_BUILD_MK)
111 include $(BUILD_SHARED_LIBRARY)
112 else # host
113 LOCAL_IS_HOST_MODULE := true
114 include $(LLVM_GEN_INTRINSICS_MK)
115 include $(LLVM_HOST_BUILD_MK)
116 include $(BUILD_HOST_SHARED_LIBRARY)
117 endif
118
119 ifeq ($$(art_target_or_host),target)
120 ifeq ($$(art_ndebug_or_debug),debug)
121 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
122 else
123 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
124 endif
125 else # host
126 ifeq ($$(art_ndebug_or_debug),debug)
127 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
128 else
129 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
130 endif
131 endif
132
133endef
134
135ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700136 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800137endif
138ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700139 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800140endif
141ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700142 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800143endif
144ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700145 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800146endif