Android.mk revision 5644f0048d6a98dc099ae9fe898ced491da700aa
1b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes#
2b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# Copyright (C) 2012 The Android Open Source Project
3b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes#
4b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# Licensed under the Apache License, Version 2.0 (the "License");
5b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# you may not use this file except in compliance with the License.
6b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# You may obtain a copy of the License at
7b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes#
8b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes#      http://www.apache.org/licenses/LICENSE-2.0
9b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes#
10b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# Unless required by applicable law or agreed to in writing, software
11b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# distributed under the License is distributed on an "AS IS" BASIS,
12b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# See the License for the specific language governing permissions and
14b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# limitations under the License.
15b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes#
16b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
17b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott HughesLIBART_COMPILER_COMMON_SRC_FILES += \
18b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/Dataflow.cc \
19b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/Frontend.cc \
20b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/IntermediateRep.cc \
21b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/Ralloc.cc \
22b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/SSATransformation.cc \
23b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/Utility.cc \
2446f060a53fffc14333096f0a48f95730ee4768eeElliott Hughes	src/compiler/codegen/RallocUtil.cc \
2557b86d47b66322693a070185fadfb43cb9c12eabIan Rogers	src/oat/jni/calling_convention.cc \
2657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers	src/oat/jni/jni_compiler.cc \
2757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers	src/oat/jni/arm/calling_convention_arm.cc \
2857b86d47b66322693a070185fadfb43cb9c12eabIan Rogers	src/oat/jni/x86/calling_convention_x86.cc
29b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
302cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbeeifeq ($(ART_USE_QUICK_COMPILER), true)
312cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbeeLIBART_COMPILER_COMMON_SRC_FILES += \
322cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee	src/greenland/ir_builder.cc \
332cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee	src/greenland/intrinsic_helper.cc
342cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbeeendif
352cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee
365644f0048d6a98dc099ae9fe898ced491da700aaBrian CarlstromLIBART_COMPILER_arm_SRC_FILES += \
37b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	$(LIBART_COMPILER_COMMON_SRC_FILES) \
38b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/arm/ArchUtility.cc \
39b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/arm/ArmRallocUtil.cc \
40b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/arm/Assemble.cc \
4157b86d47b66322693a070185fadfb43cb9c12eabIan Rogers	src/compiler/codegen/arm/armv7-a/Codegen.cc \
4257b86d47b66322693a070185fadfb43cb9c12eabIan Rogers	src/oat/jni/arm/jni_internal_arm.cc
43b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
445644f0048d6a98dc099ae9fe898ced491da700aaBrian CarlstromLIBART_COMPILER_mips_SRC_FILES += \
45b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	$(LIBART_COMPILER_COMMON_SRC_FILES) \
46b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/mips/ArchUtility.cc \
47b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/mips/MipsRallocUtil.cc \
48b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/mips/Assemble.cc \
49b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/mips/mips/Codegen.cc
50b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
515644f0048d6a98dc099ae9fe898ced491da700aaBrian CarlstromLIBART_COMPILER_x86_SRC_FILES += \
52b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	$(LIBART_COMPILER_COMMON_SRC_FILES) \
53b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/x86/ArchUtility.cc \
54b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/x86/X86RallocUtil.cc \
55b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes	src/compiler/codegen/x86/Assemble.cc \
5657b86d47b66322693a070185fadfb43cb9c12eabIan Rogers	src/compiler/codegen/x86/x86/Codegen.cc \
5757b86d47b66322693a070185fadfb43cb9c12eabIan Rogers	src/oat/jni/x86/jni_internal_x86.cc
58b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
59b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# $(1): target or host
60b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# $(2): ndebug or debug
61b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# $(3): architecture name
62b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesdefine build-libart-compiler
63b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  ifneq ($(1),target)
64b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    ifneq ($(1),host)
65b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes      $$(error expected target or host for argument 1, received $(1))
66b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    endif
67b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  endif
68b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  ifneq ($(2),ndebug)
69b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    ifneq ($(2),debug)
70b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes      $$(error expected ndebug or debug for argument 2, received $(2))
71b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    endif
72b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  endif
73b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
74b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  art_target_or_host := $(1)
75b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  art_ndebug_or_debug := $(2)
76b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  libart_compiler_arch := $(3)
77b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
78b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  include $(CLEAR_VARS)
79b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  ifeq ($$(art_target_or_host),target)
80b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    include external/stlport/libstlport.mk
81b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  endif
82b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
83b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  ifeq ($$(art_ndebug_or_debug),ndebug)
84ceeea7d1610a88dee67b701c90208bfdc935c3d8Elliott Hughes    LOCAL_MODULE := libart-compiler-$$(libart_compiler_arch)
85b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  else # debug
86ceeea7d1610a88dee67b701c90208bfdc935c3d8Elliott Hughes    LOCAL_MODULE := libartd-compiler-$$(libart_compiler_arch)
87b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  endif
88b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
89b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  LOCAL_MODULE_TAGS := optional
90b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  LOCAL_MODULE_CLASS := SHARED_LIBRARIES
91b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
925644f0048d6a98dc099ae9fe898ced491da700aaBrian Carlstrom  LOCAL_SRC_FILES := $$(LIBART_COMPILER_$$(libart_compiler_arch)_SRC_FILES)
935644f0048d6a98dc099ae9fe898ced491da700aaBrian Carlstrom
94b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  ifeq ($$(art_target_or_host),target)
95b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
96b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  else # host
97b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
98b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  endif
991bac54ffa933fbe9b92b62437577f2f4583eff1aElliott Hughes
1001bac54ffa933fbe9b92b62437577f2f4583eff1aElliott Hughes  # TODO: clean up the compilers and remove this.
1011bac54ffa933fbe9b92b62437577f2f4583eff1aElliott Hughes  LOCAL_CFLAGS += -Wno-unused-parameter
1021bac54ffa933fbe9b92b62437577f2f4583eff1aElliott Hughes
103b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  LOCAL_SHARED_LIBRARIES := liblog
104b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  ifeq ($$(art_ndebug_or_debug),debug)
105b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    ifeq ($$(art_target_or_host),target)
106b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes      LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
107b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    else # host
108b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes      LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
109b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    endif
110b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    LOCAL_SHARED_LIBRARIES += libartd
111b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  else
112b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    ifeq ($$(art_target_or_host),target)
113b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes      LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
114b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    else # host
115b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes      LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
116b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    endif
117b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    LOCAL_SHARED_LIBRARIES += libart
118b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  endif
119b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
120b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  # TODO: temporary hack for testing.
1215644f0048d6a98dc099ae9fe898ced491da700aaBrian Carlstrom  ifeq ($$(libart_compiler_arch),mips)
122b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    LOCAL_CFLAGS += -D__mips_hard_float
123b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  endif
124b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
1252cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee  ifeq ($(ART_USE_QUICK_COMPILER), true)
1262cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee    LOCAL_CFLAGS += -DART_USE_QUICK_COMPILER
1272cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee  endif
1282cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee
129b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
1302cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee
1312cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee  ifeq ($(ART_USE_QUICK_COMPILER), true)
1322cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee    LOCAL_STATIC_LIBRARIES += \
1332cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      libLLVMBitWriter \
1342cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      libLLVMBitReader \
1352cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      libLLVMCore \
1362cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      libLLVMSupport
1372cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee  endif
1382cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee
139b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  ifeq ($$(art_target_or_host),target)
140b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    LOCAL_SHARED_LIBRARIES += libstlport
141b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  else # host
142b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    LOCAL_LDLIBS := -ldl -lpthread
143b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  endif
144b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  ifeq ($$(art_target_or_host),target)
1452cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee    ifeq ($(ART_USE_QUICK_COMPILER), true)
1462cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      LOCAL_SHARED_LIBRARIES += libcutils
1472cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      include $(LLVM_GEN_INTRINSICS_MK)
1482cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      include $(LLVM_DEVICE_BUILD_MK)
1492cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee    endif
150b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    include $(BUILD_SHARED_LIBRARY)
151b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  else # host
152b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    LOCAL_IS_HOST_MODULE := true
1532cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee    ifeq ($(ART_USE_QUICK_COMPILER), true)
1542cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      LOCAL_STATIC_LIBRARIES += libcutils
1552cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      include $(LLVM_GEN_INTRINSICS_MK)
1562cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee      include $(LLVM_HOST_BUILD_MK)
1572cfc639fc803bf67e3d2a961f2b637220c86d5f7buzbee    endif
158b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes    include $(BUILD_HOST_SHARED_LIBRARY)
159b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  endif
16073666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom
16173666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom  ifeq ($$(art_target_or_host),target)
16273666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom    ifeq ($$(art_ndebug_or_debug),debug)
16373666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom      $(TARGET_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
16473666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom    else
16573666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom      $(TARGET_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
16673666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom    endif
16773666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom  else # host
16873666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom    ifeq ($$(art_ndebug_or_debug),debug)
16973666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom      $(HOST_OUT_EXECUTABLES)/dex2oatd: $$(LOCAL_INSTALLED_MODULE)
17073666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom    else
17173666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom      $(HOST_OUT_EXECUTABLES)/dex2oat: $$(LOCAL_INSTALLED_MODULE)
17273666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom    endif
17373666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom  endif
17473666be63d30f9af5487982f69600be38caaed1bBrian Carlstrom
175b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesendef
176b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
177b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# $(1): target or host
178b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes# $(2): ndebug or debug
179b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesdefine build-libart-compilers
1805644f0048d6a98dc099ae9fe898ced491da700aaBrian Carlstrom  $(foreach arch,arm mips x86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch))))
181b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesendef
182b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes
183b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesifeq ($(ART_BUILD_TARGET_NDEBUG),true)
1845644f0048d6a98dc099ae9fe898ced491da700aaBrian Carlstrom  $(eval $(call build-libart-compiler,target,ndebug,$(TARGET_ARCH)))
185b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesendif
186b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesifeq ($(ART_BUILD_TARGET_DEBUG),true)
1875644f0048d6a98dc099ae9fe898ced491da700aaBrian Carlstrom  $(eval $(call build-libart-compiler,target,debug,$(TARGET_ARCH)))
188b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesendif
189b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesifeq ($(ART_BUILD_HOST_NDEBUG),true)
190b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  $(eval $(call build-libart-compilers,host,ndebug))
191b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesendif
192b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesifeq ($(ART_BUILD_HOST_DEBUG),true)
193b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughes  $(eval $(call build-libart-compilers,host,debug))
194b3bd5f07884f5a1f2b84224363b1372d7c28d447Elliott Hughesendif
195