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  {vixl_sources}
66
67vixl_test_files := \
68  {vixl_test_files}
69
70vixl_cpp_flags := \
71  -DVIXL_INCLUDE_SIMULATOR \
72  -DVIXL_GENERATE_SIMULATOR_INSTRUCTIONS_VALUE=0 \
73  -Wall \
74  -Wextra \
75  -Werror \
76  -fdiagnostics-show-option \
77  -Wredundant-decls \
78  -Wunreachable-code \
79  -Wmissing-noreturn \
80  -pedantic \
81  -std=c++11 \
82
83# Explicitly enable the write-strings warning. VIXL uses
84# const correctly when handling string constants.
85vixl_cpp_flags += \
86  -Wwrite-strings \
87
88vixl_cpp_flags_release := \
89  $(vixl_cpp_flags) \
90  -O3 \
91
92vixl_cpp_flags_debug := \
93  $(vixl_cpp_flags) \
94  -DVIXL_DEBUG \
95  -UNDEBUG \
96  -O2 \
97  -ggdb3 \
98
99VIXL_COVERAGE := false
100
101ifeq ($(ART_COVERAGE), true)
102  VIXL_COVERAGE := true
103endif
104
105include $(CLEAR_VARS)
106LOCAL_CLANG := true
107LOCAL_CPP_EXTENSION := .cc
108LOCAL_CPPFLAGS := $(vixl_cpp_flags_release)
109LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
110LOCAL_C_INCLUDES := $(vixl_include_files)
111LOCAL_SRC_FILES :=  $(vixl_src_files)
112LOCAL_SHARED_LIBRARIES := liblog
113LOCAL_MODULE_TAGS := optional
114LOCAL_MODULE := libvixl
115LOCAL_SANITIZE_RECOVER := shift-exponent
116LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
117include $(BUILD_SHARED_LIBRARY)
118
119include $(CLEAR_VARS)
120LOCAL_CLANG := true
121LOCAL_CPP_EXTENSION := .cc
122LOCAL_CPPFLAGS := $(vixl_cpp_flags_debug)
123LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
124LOCAL_C_INCLUDES := $(vixl_include_files)
125LOCAL_SRC_FILES :=  $(vixl_src_files)
126LOCAL_SHARED_LIBRARIES := liblog
127LOCAL_MODULE_TAGS := optional
128LOCAL_MODULE := libvixld
129LOCAL_SANITIZE_RECOVER := shift-exponent
130LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
131include $(BUILD_SHARED_LIBRARY)
132
133
134include $(CLEAR_VARS)
135LOCAL_CLANG := true
136LOCAL_CPP_EXTENSION := .cc
137LOCAL_CPPFLAGS := $(vixl_cpp_flags_release)
138LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
139LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
140LOCAL_C_INCLUDES := $(vixl_include_files)
141LOCAL_SRC_FILES :=  $(vixl_src_files)
142LOCAL_SHARED_LIBRARIES := liblog
143LOCAL_MODULE_TAGS := optional
144LOCAL_MODULE := libvixl
145LOCAL_SANITIZE_RECOVER := shift-exponent
146LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
147LOCAL_MULTILIB := both
148include $(BUILD_HOST_SHARED_LIBRARY)
149
150include $(CLEAR_VARS)
151LOCAL_CLANG := true
152LOCAL_CPP_EXTENSION := .cc
153LOCAL_CPPFLAGS := $(vixl_cpp_flags_debug)
154LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
155LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
156LOCAL_C_INCLUDES := $(vixl_include_files)
157LOCAL_SRC_FILES :=  $(vixl_src_files)
158LOCAL_SHARED_LIBRARIES := liblog
159LOCAL_MODULE_TAGS := optional
160LOCAL_MODULE := libvixld
161LOCAL_SANITIZE_RECOVER := shift-exponent
162LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
163LOCAL_MULTILIB := both
164include $(BUILD_HOST_SHARED_LIBRARY)
165
166# Static libraries for host
167include $(CLEAR_VARS)
168LOCAL_CLANG := true
169LOCAL_CPP_EXTENSION := .cc
170LOCAL_CPPFLAGS := $(vixl_cpp_flags_release)
171LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
172LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
173LOCAL_C_INCLUDES := $(vixl_include_files)
174LOCAL_SRC_FILES :=  $(vixl_src_files)
175LOCAL_STATIC_LIBRARIES := liblog
176LOCAL_MODULE_TAGS := optional
177LOCAL_MODULE := libvixl
178LOCAL_SANITIZE_RECOVER := shift-exponent
179LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
180LOCAL_MULTILIB := both
181include $(BUILD_HOST_STATIC_LIBRARY)
182
183include $(CLEAR_VARS)
184LOCAL_CLANG := true
185LOCAL_CPP_EXTENSION := .cc
186LOCAL_CPPFLAGS := $(vixl_cpp_flags_debug)
187LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
188LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
189LOCAL_C_INCLUDES := $(vixl_include_files)
190LOCAL_SRC_FILES :=  $(vixl_src_files)
191LOCAL_STATIC_LIBRARIES := liblog
192LOCAL_MODULE_TAGS := optional
193LOCAL_MODULE := libvixld
194LOCAL_SANITIZE_RECOVER := shift-exponent
195LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
196LOCAL_MULTILIB := both
197include $(BUILD_HOST_STATIC_LIBRARY)
198
199
200######### VIXL HOST TESTS #########
201#
202# We only support 64bit host builds for now.
203# To run all the tests: vixl-test-runner --run_all
204#
205include $(CLEAR_VARS)
206LOCAL_CLANG := true
207LOCAL_CPP_EXTENSION := .cc
208LOCAL_CPPFLAGS := $(vixl_cpp_flags_debug)
209LOCAL_CLANG_CFLAGS := -Wimplicit-fallthrough
210LOCAL_NATIVE_COVERAGE := $(VIXL_COVERAGE)
211LOCAL_C_INCLUDES := $(vixl_include_files)
212LOCAL_SRC_FILES :=  $(vixl_test_files) $(vixl_src_files)
213LOCAL_MODULE_TAGS := optional
214LOCAL_MODULE_HOST_ARCH := x86_64
215LOCAL_FORCE_STATIC_EXECUTABLE := true
216LOCAL_MODULE := vixl-test-runner
217LOCAL_SANITIZE_RECOVER := shift-exponent
218LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
219include $(BUILD_HOST_EXECUTABLE)
220
221.PHONY: run-vixl-tests
222run-vixl-tests: vixl-test-runner
223	$(vixl_root)/third_party/android/check_top_level_android_mk.sh
224	$(HOST_OUT)/bin/vixl-test-runner --run_all
225	$(HOST_OUT)/bin/vixl-test-runner --run_all --debugger
226	@echo vixl tests PASSED
227