blob: 01d9c12c503f36708851bce50a603214112b1679 [file] [log] [blame]
Elliott Hughesb3bd5f02012-03-08 21:05:27 -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
17LIBART_COMPILER_COMMON_SRC_FILES += \
18 src/compiler/Dataflow.cc \
19 src/compiler/Frontend.cc \
20 src/compiler/IntermediateRep.cc \
21 src/compiler/Ralloc.cc \
22 src/compiler/SSATransformation.cc \
23 src/compiler/Utility.cc \
Elliott Hughes46f060a2012-03-09 17:36:50 -080024 src/compiler/codegen/RallocUtil.cc \
25 src/jni_compiler.cc
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080026
27LIBART_COMPILER_ARM_SRC_FILES += \
28 $(LIBART_COMPILER_COMMON_SRC_FILES) \
Elliott Hughes46f060a2012-03-09 17:36:50 -080029 src/jni_internal_arm.cc \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080030 src/compiler/codegen/arm/ArchUtility.cc \
31 src/compiler/codegen/arm/ArmRallocUtil.cc \
32 src/compiler/codegen/arm/Assemble.cc \
33 src/compiler/codegen/arm/armv7-a/Codegen.cc
34
35LIBART_COMPILER_MIPS_SRC_FILES += \
36 $(LIBART_COMPILER_COMMON_SRC_FILES) \
37 src/compiler/codegen/mips/ArchUtility.cc \
38 src/compiler/codegen/mips/MipsRallocUtil.cc \
39 src/compiler/codegen/mips/Assemble.cc \
40 src/compiler/codegen/mips/mips/Codegen.cc
41
42LIBART_COMPILER_X86_SRC_FILES += \
43 $(LIBART_COMPILER_COMMON_SRC_FILES) \
Elliott Hughes46f060a2012-03-09 17:36:50 -080044 src/jni_internal_x86.cc \
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080045 src/compiler/codegen/x86/ArchUtility.cc \
46 src/compiler/codegen/x86/X86RallocUtil.cc \
47 src/compiler/codegen/x86/Assemble.cc \
48 src/compiler/codegen/x86/x86/Codegen.cc
49
50# $(1): target or host
51# $(2): ndebug or debug
52# $(3): architecture name
53# $(4): list of source files
54define build-libart-compiler
55 ifneq ($(1),target)
56 ifneq ($(1),host)
57 $$(error expected target or host for argument 1, received $(1))
58 endif
59 endif
60 ifneq ($(2),ndebug)
61 ifneq ($(2),debug)
62 $$(error expected ndebug or debug for argument 2, received $(2))
63 endif
64 endif
65
66 art_target_or_host := $(1)
67 art_ndebug_or_debug := $(2)
68 libart_compiler_arch := $(3)
69 libart_compiler_src_files := $(4)
70
71 include $(CLEAR_VARS)
72 ifeq ($$(art_target_or_host),target)
73 include external/stlport/libstlport.mk
74 endif
75 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
76 ifeq ($$(art_ndebug_or_debug),ndebug)
77 LOCAL_MODULE := libart-compiler-$(libart_compiler_arch)
78 else # debug
79 LOCAL_MODULE := libartd-compiler-$(libart_compiler_arch)
80 endif
81
82 LOCAL_MODULE_TAGS := optional
83 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
84
85 LOCAL_SRC_FILES := $(libart_compiler_src_files)
86 ifeq ($$(art_target_or_host),target)
87 LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
88 else # host
89 LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
90 endif
91 LOCAL_SHARED_LIBRARIES := liblog
92 ifeq ($$(art_ndebug_or_debug),debug)
93 ifeq ($$(art_target_or_host),target)
94 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
95 else # host
96 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
97 endif
98 LOCAL_SHARED_LIBRARIES += libartd
99 else
100 ifeq ($$(art_target_or_host),target)
101 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
102 else # host
103 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
104 endif
105 LOCAL_SHARED_LIBRARIES += libart
106 endif
107
108 # TODO: temporary hack for testing.
109 ifeq ($(libart_compiler_arch),MIPS)
110 LOCAL_CFLAGS += -D__mips_hard_float
111 endif
112
113 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
114 ifeq ($$(art_target_or_host),target)
115 LOCAL_SHARED_LIBRARIES += libstlport
116 else # host
117 LOCAL_LDLIBS := -ldl -lpthread
118 endif
119 ifeq ($$(art_target_or_host),target)
120 include $(BUILD_SHARED_LIBRARY)
121 else # host
122 LOCAL_IS_HOST_MODULE := true
123 include $(BUILD_HOST_SHARED_LIBRARY)
124 endif
125endef
126
127# $(1): target or host
128# $(2): ndebug or debug
129define build-libart-compilers
130 $(foreach arch,ARM MIPS X86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch),$(LIBART_COMPILER_$(arch)_SRC_FILES))))
131endef
132
133ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
134 $(eval $(call build-libart-compilers,target,ndebug))
135endif
136ifeq ($(ART_BUILD_TARGET_DEBUG),true)
137 $(eval $(call build-libart-compilers,target,debug))
138endif
139ifeq ($(ART_BUILD_HOST_NDEBUG),true)
140 $(eval $(call build-libart-compilers,host,ndebug))
141endif
142ifeq ($(ART_BUILD_HOST_DEBUG),true)
143 $(eval $(call build-libart-compilers,host,debug))
144endif