blob: 630f3e4656a0b6d8868ba28faa7aa527a560a63e [file] [log] [blame]
Ian Rogers02ed4c02013-09-06 13:10:04 -07001#
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
17LOCAL_PATH := $(call my-dir)
18
Ian Rogersafd9acc2014-06-17 08:21:54 -070019include art/build/Android.common_build.mk
Ian Rogers02ed4c02013-09-06 13:10:04 -070020
21LIBART_DISASSEMBLER_SRC_FILES := \
22 disassembler.cc \
23 disassembler_arm.cc \
Serban Constantinescue6622be2014-02-27 15:36:47 +000024 disassembler_arm64.cc \
Ian Rogers02ed4c02013-09-06 13:10:04 -070025 disassembler_mips.cc \
26 disassembler_x86.cc
27
28# $(1): target or host
29# $(2): ndebug or debug
Roland Levillain04147ef2016-09-06 11:09:41 +010030# $(3): static or shared (static is only valid for host)
Ian Rogers02ed4c02013-09-06 13:10:04 -070031define build-libart-disassembler
32 ifneq ($(1),target)
33 ifneq ($(1),host)
34 $$(error expected target or host for argument 1, received $(1))
35 endif
36 endif
37 ifneq ($(2),ndebug)
38 ifneq ($(2),debug)
39 $$(error expected ndebug or debug for argument 2, received $(2))
40 endif
41 endif
Roland Levillain04147ef2016-09-06 11:09:41 +010042 ifeq ($(3),static)
43 ifneq ($(1),host)
44 $$(error received static for argument 3, but argument 1 is not host)
45 endif
46 else
47 ifneq ($(3),shared)
48 $$(error expected static or shared for argument 3, received $(3))
49 endif
50 endif
Ian Rogers02ed4c02013-09-06 13:10:04 -070051
52 art_target_or_host := $(1)
53 art_ndebug_or_debug := $(2)
Roland Levillain04147ef2016-09-06 11:09:41 +010054 art_static_or_shared := $(3)
Ian Rogers02ed4c02013-09-06 13:10:04 -070055
56 include $(CLEAR_VARS)
Ian Rogersbd5ea6a2014-04-16 16:34:44 -070057 ifeq ($$(art_target_or_host),host)
58 LOCAL_IS_HOST_MODULE := true
Ian Rogers02ed4c02013-09-06 13:10:04 -070059 endif
60 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
61 ifeq ($$(art_ndebug_or_debug),ndebug)
62 LOCAL_MODULE := libart-disassembler
63 else # debug
64 LOCAL_MODULE := libartd-disassembler
65 endif
66
67 LOCAL_MODULE_TAGS := optional
Roland Levillain04147ef2016-09-06 11:09:41 +010068 ifeq ($$(art_static_or_shared),static)
69 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
70 else # shared
71 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
72 endif
Ian Rogers02ed4c02013-09-06 13:10:04 -070073
74 LOCAL_SRC_FILES := $$(LIBART_DISASSEMBLER_SRC_FILES)
75
Ian Rogers02ed4c02013-09-06 13:10:04 -070076 ifeq ($$(art_target_or_host),target)
Colin Crossecf75a62016-07-28 16:01:42 -070077 LOCAL_CLANG := $(ART_TARGET_CLANG)
Roland Levillain12bd7212015-06-04 17:50:27 +010078 $(call set-target-local-cflags-vars,$(2))
Ian Rogers02ed4c02013-09-06 13:10:04 -070079 else # host
80 LOCAL_CLANG := $(ART_HOST_CLANG)
81 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Roland Levillain12bd7212015-06-04 17:50:27 +010082 LOCAL_ASFLAGS += $(ART_HOST_ASFLAGS)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -070083 ifeq ($$(art_ndebug_or_debug),debug)
84 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
Roland Levillainb5390f72016-07-04 16:59:53 +010085 LOCAL_ASFLAGS += $(ART_HOST_DEBUG_ASFLAGS)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -070086 else
87 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
Roland Levillainb5390f72016-07-04 16:59:53 +010088 LOCAL_ASFLAGS += $(ART_HOST_NON_DEBUG_ASFLAGS)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -070089 endif
Ian Rogers02ed4c02013-09-06 13:10:04 -070090 endif
91
Roland Levillain04147ef2016-09-06 11:09:41 +010092 ifeq ($$(art_static_or_shared),static)
93 LOCAL_STATIC_LIBRARIES += liblog
94 ifeq ($$(art_ndebug_or_debug),debug)
95 LOCAL_STATIC_LIBRARIES += libartd
96 else
97 LOCAL_STATIC_LIBRARIES += libart
98 endif
99 else # shared
100 LOCAL_SHARED_LIBRARIES += liblog
101 ifeq ($$(art_ndebug_or_debug),debug)
102 LOCAL_SHARED_LIBRARIES += libartd
103 else
104 LOCAL_SHARED_LIBRARIES += libart
105 endif
Ian Rogers02ed4c02013-09-06 13:10:04 -0700106 endif
107
108 LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime
David Srbecky588e8e12015-04-06 18:36:59 +0100109 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
110 LOCAL_MULTILIB := both
Ian Rogers02ed4c02013-09-06 13:10:04 -0700111
Ian Rogersafd9acc2014-06-17 08:21:54 -0700112 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
Ian Rogers02ed4c02013-09-06 13:10:04 -0700113 LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
Dan Albert31fb2602014-09-30 22:10:10 -0700114 LOCAL_NATIVE_COVERAGE := $(ART_COVERAGE)
Ian Rogers872dd822014-10-30 11:19:14 -0700115 # For disassembler_arm64.
Roland Levillain04147ef2016-09-06 11:09:41 +0100116 ifeq ($$(art_static_or_shared),static)
117 ifeq ($$(art_ndebug_or_debug),debug)
118 LOCAL_STATIC_LIBRARIES += libvixld-arm64
119 else
120 LOCAL_STATIC_LIBRARIES += libvixl-arm64
121 endif
122 ifeq ($$(art_target_or_host),target)
123 $$(error libart-disassembler static builds for target are not supported)
124 else # host
125 include $(BUILD_HOST_STATIC_LIBRARY)
126 endif
127 else # shared
128 ifeq ($$(art_ndebug_or_debug),debug)
129 LOCAL_SHARED_LIBRARIES += libvixld-arm64
130 else
131 LOCAL_SHARED_LIBRARIES += libvixl-arm64
132 endif
133 ifeq ($$(art_target_or_host),target)
134 include $(BUILD_SHARED_LIBRARY)
135 else # host
136 include $(BUILD_HOST_SHARED_LIBRARY)
137 endif
Serban Constantinescu32f5b4d2014-11-25 20:05:46 +0000138 endif
Roland Levillain04147ef2016-09-06 11:09:41 +0100139
140 # Clear out local variables now that we're done with them.
141 art_target_or_host :=
142 art_ndebug_or_debug :=
143 art_static_or_shared :=
Ian Rogers02ed4c02013-09-06 13:10:04 -0700144endef
145
146ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Roland Levillain04147ef2016-09-06 11:09:41 +0100147 $(eval $(call build-libart-disassembler,target,ndebug,shared))
Ian Rogers02ed4c02013-09-06 13:10:04 -0700148endif
149ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Roland Levillain04147ef2016-09-06 11:09:41 +0100150 $(eval $(call build-libart-disassembler,target,debug,shared))
Ian Rogers02ed4c02013-09-06 13:10:04 -0700151endif
Roland Levillain04147ef2016-09-06 11:09:41 +0100152# We always build dex2oat and dependencies, even if the host build is
153# otherwise disabled, since they are used to cross compile for the target.
Junmo Park76ab3472014-08-11 21:28:16 +0900154ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Roland Levillain04147ef2016-09-06 11:09:41 +0100155 $(eval $(call build-libart-disassembler,host,ndebug,shared))
156 ifeq ($(ART_BUILD_HOST_STATIC),true)
157 $(eval $(call build-libart-disassembler,host,ndebug,static))
158 endif
Ian Rogersc5f17732014-06-05 20:48:42 -0700159endif
Junmo Park76ab3472014-08-11 21:28:16 +0900160ifeq ($(ART_BUILD_HOST_DEBUG),true)
Roland Levillain04147ef2016-09-06 11:09:41 +0100161 $(eval $(call build-libart-disassembler,host,debug,shared))
162 ifeq ($(ART_BUILD_HOST_STATIC),true)
163 $(eval $(call build-libart-disassembler,host,debug,static))
164 endif
Ian Rogers02ed4c02013-09-06 13:10:04 -0700165endif