1# NOTE: `Android.mk` is automatically generated via the
2# `third_party/android/generate_android_mk.py` script. Changes should be applied
3# to `third_party/android/Android.mk.template`, and the script run to regenerate
4# `Android.mk`.
5
6# Copyright (C) 2015 The Android Open Source Project
7# All rights reserved.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions
11# are met:
12#  * Redistributions of source code must retain the above copyright
13#    notice, this list of conditions and the following disclaimer.
14#  * Redistributions in binary form must reproduce the above copyright
15#    notice, this list of conditions and the following disclaimer in
16#    the documentation and/or other materials provided with the
17#    distribution.
18#
19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30# SUCH DAMAGE.
31#
32#
33# Copyright (c) 2015 ARM Ltd
34# All rights reserved.
35#
36# Redistribution and use in source and binary forms, with or without
37# modification, are permitted provided that the following conditions
38# are met:
39# 1. Redistributions of source code must retain the above copyright
40#    notice, this list of conditions and the following disclaimer.
41# 2. Redistributions in binary form must reproduce the above copyright
42#    notice, this list of conditions and the following disclaimer in the
43#    documentation and/or other materials provided with the distribution.
44# 3. The name of the company may not be used to endorse or promote
45#    products derived from this software without specific prior written
46#    permission.
47#
48# THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
49# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
50# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
51# IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
52# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
53# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
54# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
55# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
56# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
57# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58
59LOCAL_PATH:= $(call my-dir)
60
61vixl_root := $(LOCAL_PATH)/
62vixl_include_files := $(vixl_root)/src/
63
64vixl_src_files := \
65  src/vixl/a64/assembler-a64.cc \
66  src/vixl/a64/cpu-a64.cc \
67  src/vixl/a64/debugger-a64.cc \
68  src/vixl/a64/decoder-a64.cc \
69  src/vixl/a64/disasm-a64.cc \
70  src/vixl/a64/instructions-a64.cc \
71  src/vixl/a64/instrument-a64.cc \
72  src/vixl/a64/logic-a64.cc \
73  src/vixl/a64/macro-assembler-a64.cc \
74  src/vixl/a64/simulator-a64.cc \
75  src/vixl/code-buffer.cc \
76  src/vixl/compiler-intrinsics.cc \
77  src/vixl/utils.cc
78
79vixl_test_files := \
80  test/test-assembler-a64.cc \
81  test/test-disasm-a64.cc \
82  test/test-fuzz-a64.cc \
83  test/test-invalset.cc \
84  test/test-runner.cc \
85  test/test-simulator-a64.cc \
86  test/test-utils-a64.cc
87
88vixl_cpp_flags := \
89  -DVIXL_INCLUDE_SIMULATOR \
90  -DVIXL_GENERATE_SIMULATOR_INSTRUCTIONS_VALUE=0 \
91  -Wall \
92  -Wextra \
93  -Werror \
94  -fdiagnostics-show-option \
95  -Wredundant-decls \
96  -Wunreachable-code \
97  -Wmissing-noreturn \
98  -pedantic \
99  -std=c++11 \
100
101# Explicitly enable the write-strings warning. VIXL uses
102# const correctly when handling string constants.
103vixl_cpp_flags += \
104  -Wwrite-strings \
105
106vixl_cpp_flags_release := \
107  $(vixl_cpp_flags) \
108  -O3 \
109
110vixl_cpp_flags_debug := \
111  $(vixl_cpp_flags) \
112  -DVIXL_DEBUG \
113  -UNDEBUG \
114  -O2 \
115  -ggdb3 \
116
117VIXL_COVERAGE := false
118
119ifeq ($(ART_COVERAGE), true)
120  VIXL_COVERAGE := true
121endif
122
123include $(CLEAR_VARS)
124LOCAL_CLANG := true
125LOCAL_CPP_EXTENSION := .cc
126LOCAL_CPPFLAGS := $(vixl_cpp_flags_release)
127LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
128LOCAL_C_INCLUDES := $(vixl_include_files)
129LOCAL_SRC_FILES :=  $(vixl_src_files)
130LOCAL_SHARED_LIBRARIES := liblog
131LOCAL_MODULE_TAGS := optional
132LOCAL_MODULE := libvixl
133LOCAL_SANITIZE_RECOVER := shift-exponent
134LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
135include $(BUILD_SHARED_LIBRARY)
136
137include $(CLEAR_VARS)
138LOCAL_CLANG := true
139LOCAL_CPP_EXTENSION := .cc
140LOCAL_CPPFLAGS := $(vixl_cpp_flags_debug)
141LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
142LOCAL_C_INCLUDES := $(vixl_include_files)
143LOCAL_SRC_FILES :=  $(vixl_src_files)
144LOCAL_SHARED_LIBRARIES := liblog
145LOCAL_MODULE_TAGS := optional
146LOCAL_MODULE := libvixld
147LOCAL_SANITIZE_RECOVER := shift-exponent
148LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
149include $(BUILD_SHARED_LIBRARY)
150
151
152include $(CLEAR_VARS)
153LOCAL_CLANG := true
154LOCAL_CPP_EXTENSION := .cc
155LOCAL_CPPFLAGS := $(vixl_cpp_flags_release)
156LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
157LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
158LOCAL_C_INCLUDES := $(vixl_include_files)
159LOCAL_SRC_FILES :=  $(vixl_src_files)
160LOCAL_SHARED_LIBRARIES := liblog
161LOCAL_MODULE_TAGS := optional
162LOCAL_MODULE := libvixl
163LOCAL_SANITIZE_RECOVER := shift-exponent
164LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
165LOCAL_MULTILIB := both
166include $(BUILD_HOST_SHARED_LIBRARY)
167
168include $(CLEAR_VARS)
169LOCAL_CLANG := true
170LOCAL_CPP_EXTENSION := .cc
171LOCAL_CPPFLAGS := $(vixl_cpp_flags_debug)
172LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
173LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
174LOCAL_C_INCLUDES := $(vixl_include_files)
175LOCAL_SRC_FILES :=  $(vixl_src_files)
176LOCAL_SHARED_LIBRARIES := liblog
177LOCAL_MODULE_TAGS := optional
178LOCAL_MODULE := libvixld
179LOCAL_SANITIZE_RECOVER := shift-exponent
180LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
181LOCAL_MULTILIB := both
182include $(BUILD_HOST_SHARED_LIBRARY)
183
184# Static libraries for host
185include $(CLEAR_VARS)
186LOCAL_CLANG := true
187LOCAL_CPP_EXTENSION := .cc
188LOCAL_CPPFLAGS := $(vixl_cpp_flags_release)
189LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
190LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
191LOCAL_C_INCLUDES := $(vixl_include_files)
192LOCAL_SRC_FILES :=  $(vixl_src_files)
193LOCAL_STATIC_LIBRARIES := liblog
194LOCAL_MODULE_TAGS := optional
195LOCAL_MODULE := libvixl
196LOCAL_SANITIZE_RECOVER := shift-exponent
197LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
198LOCAL_MULTILIB := both
199include $(BUILD_HOST_STATIC_LIBRARY)
200
201include $(CLEAR_VARS)
202LOCAL_CLANG := true
203LOCAL_CPP_EXTENSION := .cc
204LOCAL_CPPFLAGS := $(vixl_cpp_flags_debug)
205LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
206LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
207LOCAL_C_INCLUDES := $(vixl_include_files)
208LOCAL_SRC_FILES :=  $(vixl_src_files)
209LOCAL_STATIC_LIBRARIES := liblog
210LOCAL_MODULE_TAGS := optional
211LOCAL_MODULE := libvixld
212LOCAL_SANITIZE_RECOVER := shift-exponent
213LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
214LOCAL_MULTILIB := both
215include $(BUILD_HOST_STATIC_LIBRARY)
216
217
218######### VIXL HOST TESTS #########
219#
220# We only support 64bit host builds for now.
221# To run all the tests: vixl-test-runner --run_all
222#
223include $(CLEAR_VARS)
224LOCAL_CLANG := true
225LOCAL_CPP_EXTENSION := .cc
226LOCAL_CPPFLAGS := $(vixl_cpp_flags_debug)
227LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
228LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
229LOCAL_C_INCLUDES := $(vixl_include_files)
230LOCAL_SRC_FILES :=  $(vixl_test_files) $(vixl_src_files)
231LOCAL_MODULE_TAGS := optional
232LOCAL_MODULE_HOST_ARCH := x86_64
233LOCAL_FORCE_STATIC_EXECUTABLE := true
234LOCAL_MODULE := vixl-test-runner
235LOCAL_SANITIZE_RECOVER := shift-exponent
236LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
237include $(BUILD_HOST_EXECUTABLE)
238
239.PHONY: run-vixl-tests
240run-vixl-tests: vixl-test-runner
241	$(vixl_root)/third_party/android/check_top_level_android_mk.sh
242	$(HOST_OUT)/bin/vixl-test-runner --run_all
243	$(HOST_OUT)/bin/vixl-test-runner --run_all --debugger
244	@echo vixl tests PASSED
245