blob: 894fb5425126ae75723b02ebfd3adc8636990b10 [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
Shih-wei Liao21d28f52012-06-12 05:55:00 -070019ifeq ($(ART_USE_DEXLANG_FRONTEND),true)
20 LIBART_COMPILER_LLVM_CFLAGS += -DART_USE_DEXLANG_FRONTEND=1
21endif
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080022
23LIBART_COMPILER_LLVM_SRC_FILES += \
24 src/compiler_llvm/compilation_unit.cc \
25 src/compiler_llvm/compiler_llvm.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080026 src/compiler_llvm/generated/art_module.cc \
27 src/compiler_llvm/inferred_reg_category_map.cc \
28 src/compiler_llvm/ir_builder.cc \
29 src/compiler_llvm/jni_compiler.cc \
TDYa127d668a062012-04-13 12:36:57 -070030 src/compiler_llvm/runtime_support_builder.cc \
31 src/compiler_llvm/runtime_support_builder_arm.cc \
TDYa127b08ed122012-06-05 23:51:19 -070032 src/compiler_llvm/runtime_support_builder_thumb2.cc \
TDYa127d668a062012-04-13 12:36:57 -070033 src/compiler_llvm/runtime_support_builder_x86.cc \
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080034 src/compiler_llvm/runtime_support_llvm.cc \
TDYa127eead4ac2012-06-03 07:15:25 -070035 src/compiler_llvm/stub_compiler.cc \
36 src/compiler_llvm/tbaa_info.cc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080037
Shih-wei Liao21d28f52012-06-12 05:55:00 -070038ifeq ($(ART_USE_DEXLANG_FRONTEND),true)
39 LIBART_COMPILER_LLVM_SRC_FILES += \
40 src/compiler_llvm/gbc_expander.cc \
41 src/greenland/dalvik_reg.cc \
42 src/greenland/dex_lang.cc \
43 src/greenland/intrinsic_helper.cc \
44 src/greenland/ir_builder.cc
45else
46 LIBART_COMPILER_LLVM_SRC_FILES += \
47 src/compiler_llvm/dalvik_reg.cc \
48 src/compiler_llvm/method_compiler.cc
49endif
50
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080051# $(1): target or host
52# $(2): ndebug or debug
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080053define build-libart-compiler-llvm
54 ifneq ($(1),target)
55 ifneq ($(1),host)
56 $$(error expected target or host for argument 1, received $(1))
57 endif
58 endif
59 ifneq ($(2),ndebug)
60 ifneq ($(2),debug)
61 $$(error expected ndebug or debug for argument 2, received $(2))
62 endif
63 endif
64
65 art_target_or_host := $(1)
66 art_ndebug_or_debug := $(2)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080067
68 include $(CLEAR_VARS)
69 ifeq ($$(art_target_or_host),target)
70 include external/stlport/libstlport.mk
71 endif
72 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
73 ifeq ($$(art_ndebug_or_debug),ndebug)
74 LOCAL_MODULE := libart-compiler-llvm
75 else # debug
76 LOCAL_MODULE := libartd-compiler-llvm
77 endif
78
79 LOCAL_MODULE_TAGS := optional
80 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
81
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -070082 LOCAL_SRC_FILES := $(LIBART_COMPILER_LLVM_SRC_FILES)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080083 LOCAL_CFLAGS := $(LIBART_COMPILER_LLVM_CFLAGS)
84 ifeq ($$(art_target_or_host),target)
85 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
86 else # host
87 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
88 endif
89
90 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
Logan Chien971bf3f2012-05-01 15:47:55 +080091
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080092 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -070093 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Shih-wei Liaocdc66902012-07-22 16:45:37 -070094 LOCAL_SHARED_LIBRARIES += libbcc
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080095 ifeq ($$(art_target_or_host),target)
96 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
97 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080098 else # host
99 LOCAL_STATIC_LIBRARIES += libcutils
100 LOCAL_SHARED_LIBRARIES += libz-host
101 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
102 LOCAL_LDLIBS := -ldl -lpthread
103 ifeq ($(HOST_OS),linux)
104 LOCAL_LDLIBS += -lrt
105 endif
106 endif
107 ifeq ($$(art_ndebug_or_debug),debug)
108 ifeq ($$(art_target_or_host),target)
109 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
110 else # host
111 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
112 endif
113 LOCAL_SHARED_LIBRARIES += libartd
114 else
115 ifeq ($$(art_target_or_host),target)
116 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
117 else # host
118 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
119 endif
120 LOCAL_SHARED_LIBRARIES += libart
121 endif
122 ifeq ($$(art_target_or_host),target)
123 include $(LLVM_GEN_INTRINSICS_MK)
124 include $(LLVM_DEVICE_BUILD_MK)
125 include $(BUILD_SHARED_LIBRARY)
126 else # host
127 LOCAL_IS_HOST_MODULE := true
128 include $(LLVM_GEN_INTRINSICS_MK)
129 include $(LLVM_HOST_BUILD_MK)
130 include $(BUILD_HOST_SHARED_LIBRARY)
131 endif
132
133 ifeq ($$(art_target_or_host),target)
134 ifeq ($$(art_ndebug_or_debug),debug)
135 $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
136 else
137 $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
138 endif
139 else # host
140 ifeq ($$(art_ndebug_or_debug),debug)
141 $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
142 else
143 $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
144 endif
145 endif
146
147endef
148
149ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700150 $(eval $(call build-libart-compiler-llvm,target,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800151endif
152ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700153 $(eval $(call build-libart-compiler-llvm,target,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800154endif
155ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700156 $(eval $(call build-libart-compiler-llvm,host,ndebug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800157endif
158ifeq ($(ART_BUILD_HOST_DEBUG),true)
Shih-wei Liaofa3c10c2012-04-11 13:44:35 -0700159 $(eval $(call build-libart-compiler-llvm,host,debug))
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800160endif