blob: a9108e076abc55a8ad38c6d4abb414a35db3a7e9 [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 \
24 src/compiler/codegen/RallocUtil.cc
25
26LIBART_COMPILER_ARM_SRC_FILES += \
27 $(LIBART_COMPILER_COMMON_SRC_FILES) \
28 src/compiler/codegen/arm/ArchUtility.cc \
29 src/compiler/codegen/arm/ArmRallocUtil.cc \
30 src/compiler/codegen/arm/Assemble.cc \
31 src/compiler/codegen/arm/armv7-a/Codegen.cc
32
33LIBART_COMPILER_MIPS_SRC_FILES += \
34 $(LIBART_COMPILER_COMMON_SRC_FILES) \
35 src/compiler/codegen/mips/ArchUtility.cc \
36 src/compiler/codegen/mips/MipsRallocUtil.cc \
37 src/compiler/codegen/mips/Assemble.cc \
38 src/compiler/codegen/mips/mips/Codegen.cc
39
40LIBART_COMPILER_X86_SRC_FILES += \
41 $(LIBART_COMPILER_COMMON_SRC_FILES) \
42 src/compiler/codegen/x86/ArchUtility.cc \
43 src/compiler/codegen/x86/X86RallocUtil.cc \
44 src/compiler/codegen/x86/Assemble.cc \
45 src/compiler/codegen/x86/x86/Codegen.cc
46
47# $(1): target or host
48# $(2): ndebug or debug
49# $(3): architecture name
50# $(4): list of source files
51define build-libart-compiler
52 ifneq ($(1),target)
53 ifneq ($(1),host)
54 $$(error expected target or host for argument 1, received $(1))
55 endif
56 endif
57 ifneq ($(2),ndebug)
58 ifneq ($(2),debug)
59 $$(error expected ndebug or debug for argument 2, received $(2))
60 endif
61 endif
62
63 art_target_or_host := $(1)
64 art_ndebug_or_debug := $(2)
65 libart_compiler_arch := $(3)
66 libart_compiler_src_files := $(4)
67
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-$(libart_compiler_arch)
75 else # debug
76 LOCAL_MODULE := libartd-compiler-$(libart_compiler_arch)
77 endif
78
79 LOCAL_MODULE_TAGS := optional
80 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
81
82 LOCAL_SRC_FILES := $(libart_compiler_src_files)
83 ifeq ($$(art_target_or_host),target)
84 LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
85 else # host
86 LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
87 endif
88 LOCAL_SHARED_LIBRARIES := liblog
89 ifeq ($$(art_ndebug_or_debug),debug)
90 ifeq ($$(art_target_or_host),target)
91 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
92 else # host
93 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
94 endif
95 LOCAL_SHARED_LIBRARIES += libartd
96 else
97 ifeq ($$(art_target_or_host),target)
98 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
99 else # host
100 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
101 endif
102 LOCAL_SHARED_LIBRARIES += libart
103 endif
104
105 # TODO: temporary hack for testing.
106 ifeq ($(libart_compiler_arch),MIPS)
107 LOCAL_CFLAGS += -D__mips_hard_float
108 endif
109
110 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
111 ifeq ($$(art_target_or_host),target)
112 LOCAL_SHARED_LIBRARIES += libstlport
113 else # host
114 LOCAL_LDLIBS := -ldl -lpthread
115 endif
116 ifeq ($$(art_target_or_host),target)
117 include $(BUILD_SHARED_LIBRARY)
118 else # host
119 LOCAL_IS_HOST_MODULE := true
120 include $(BUILD_HOST_SHARED_LIBRARY)
121 endif
122endef
123
124# $(1): target or host
125# $(2): ndebug or debug
126define build-libart-compilers
127 $(foreach arch,ARM MIPS X86,$(eval $(call build-libart-compiler,$(1),$(2),$(arch),$(LIBART_COMPILER_$(arch)_SRC_FILES))))
128endef
129
130ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
131 $(eval $(call build-libart-compilers,target,ndebug))
132endif
133ifeq ($(ART_BUILD_TARGET_DEBUG),true)
134 $(eval $(call build-libart-compilers,target,debug))
135endif
136ifeq ($(ART_BUILD_HOST_NDEBUG),true)
137 $(eval $(call build-libart-compilers,host,ndebug))
138endif
139ifeq ($(ART_BUILD_HOST_DEBUG),true)
140 $(eval $(call build-libart-compilers,host,debug))
141endif