blob: 188ddb5374dfc200e1b6b9ecef6dfb786fa6a47e [file] [log] [blame]
Carl Shapiro7b216702011-06-17 15:09:26 -07001#
2# Copyright (C) 2011 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
Dragos Sbirlea37c19bc2013-07-29 09:38:31 -070017ifndef ANDROID_COMMON_MK
18ANDROID_COMMON_MK = true
19
Stuart Monteithb95a5342014-03-12 13:32:32 +000020ART_SUPPORTED_ARCH := arm arm64 mips x86 x86_64
Colin Crossdc781a12014-02-04 16:22:03 -080021
22ifeq (,$(filter $(TARGET_ARCH),$(ART_SUPPORTED_ARCH)))
23$(warning unsupported TARGET_ARCH=$(TARGET_ARCH))
24endif
25
Brian Carlstrom7940e442013-07-12 13:46:57 -070026# These can be overridden via the environment or by editing to
27# enable/disable certain build configuration.
28#
29# For example, to disable everything but the host debug build you use:
30#
31# (export ART_BUILD_TARGET_NDEBUG=false && export ART_BUILD_TARGET_DEBUG=false && export ART_BUILD_HOST_NDEBUG=false && ...)
32#
33# Beware that tests may use the non-debug build for performance, notable 055-enum-performance
34#
35ART_BUILD_TARGET_NDEBUG ?= true
36ART_BUILD_TARGET_DEBUG ?= true
Brian Carlstrom19e776c2013-07-23 12:16:44 -070037ART_BUILD_HOST_NDEBUG ?= $(WITH_HOST_DALVIK)
38ART_BUILD_HOST_DEBUG ?= $(WITH_HOST_DALVIK)
Brian Carlstrom7940e442013-07-12 13:46:57 -070039
Andreas Gampe922141a2014-03-12 10:59:26 -070040ifeq ($(BUILD_HOST_64bit),)
41ART_HOST_ARCH := x86
42else
43ART_HOST_ARCH := x86_64
44endif
45
Brian Carlstrom7940e442013-07-12 13:46:57 -070046ifeq ($(ART_BUILD_TARGET_NDEBUG),false)
47$(info Disabling ART_BUILD_TARGET_NDEBUG)
48endif
49ifeq ($(ART_BUILD_TARGET_DEBUG),false)
50$(info Disabling ART_BUILD_TARGET_DEBUG)
51endif
52ifeq ($(ART_BUILD_HOST_NDEBUG),false)
53$(info Disabling ART_BUILD_HOST_NDEBUG)
54endif
55ifeq ($(ART_BUILD_HOST_DEBUG),false)
56$(info Disabling ART_BUILD_HOST_DEBUG)
57endif
58
59#
60# Used to enable smart mode
61#
Anwar Ghuloum8447d842013-04-30 17:27:40 -070062ART_SMALL_MODE := false
63ifneq ($(wildcard art/SMALL_ART),)
64$(info Enabling ART_SMALL_MODE because of existence of art/SMALL_ART)
65ART_SMALL_MODE := true
Ian Rogersf3e98552013-03-20 15:49:49 -070066endif
Anwar Ghulouma72dd8b2013-06-03 17:01:15 -070067ifeq ($(WITH_ART_SMALL_MODE), true)
68ART_SMALL_MODE := true
69endif
Ian Rogersf3e98552013-03-20 15:49:49 -070070
Brian Carlstrom7940e442013-07-12 13:46:57 -070071#
72# Used to enable SEA mode
73#
Dragos Sbirlea7467ee02013-06-21 09:20:34 -070074ART_SEA_IR_MODE := false
75ifneq ($(wildcard art/SEA_IR_ART),)
76$(info Enabling ART_SEA_IR_MODE because of existence of art/SEA_IR_ART)
77ART_SEA_IR_MODE := true
78endif
79ifeq ($(WITH_ART_SEA_IR_MODE), true)
80ART_SEA_IR_MODE := true
81endif
82
Brian Carlstrom7940e442013-07-12 13:46:57 -070083#
84# Used to enable portable mode
85#
Brian Carlstrom06809ed2012-09-17 14:19:20 -070086ART_USE_PORTABLE_COMPILER := false
87ifneq ($(wildcard art/USE_PORTABLE_COMPILER),)
88$(info Enabling ART_USE_PORTABLE_COMPILER because of existence of art/USE_PORTABLE_COMPILER)
89ART_USE_PORTABLE_COMPILER := true
90endif
91ifeq ($(WITH_ART_USE_PORTABLE_COMPILER),true)
92$(info Enabling ART_USE_PORTABLE_COMPILER because WITH_ART_USE_PORTABLE_COMPILER=true)
93ART_USE_PORTABLE_COMPILER := true
94endif
Shih-wei Liaod1fec812012-02-13 09:51:10 -080095
Nicolas Geoffrayb34f69a2014-03-07 15:28:39 +000096#
97# Used to enable optimizing compiler
98#
99ART_USE_OPTIMIZING_COMPILER := false
100ifneq ($(wildcard art/USE_OPTIMIZING_COMPILER),)
101$(info Enabling ART_USE_OPTIMIZING_COMPILER because of existence of art/USE_OPTIMIZING_COMPILER)
102ART_USE_OPTIMIZING_COMPILER := true
103endif
104ifeq ($(WITH_ART_USE_OPTIMIZING_COMPILER), true)
105ART_USE_OPTIMIZING_COMPILER := true
106endif
107
108ifeq ($(ART_USE_OPTIMIZING_COMPILER),true)
109DEX2OAT_FLAGS := --compiler-backend=Optimizing
110DALVIKVM_FLAGS := -Xcompiler-option --compiler-backend=Optimizing
111endif
112
Hiroshi Yamauchi1dda0602014-05-12 12:32:32 -0700113#
114# Used to change the default GC. Valid values are CMS, SS, GSS. The default is CMS.
115#
116ART_DEFAULT_GC_TYPE ?= CMS
117ART_DEFAULT_GC_TYPE_CFLAGS := -DART_DEFAULT_GC_TYPE_IS_$(ART_DEFAULT_GC_TYPE)
118
Shih-wei Liaod1fec812012-02-13 09:51:10 -0800119LLVM_ROOT_PATH := external/llvm
Ying Wangd9101722013-09-18 09:36:27 -0700120# Don't fail a dalvik minimal host build.
121-include $(LLVM_ROOT_PATH)/llvm.mk
Shih-wei Liaod1fec812012-02-13 09:51:10 -0800122
Brian Carlstrom9719cd22014-03-09 14:05:04 -0700123# Clang build support.
Ian Rogers35df1f32014-03-08 23:48:23 -0800124# Target builds use GCC by default.
Ian Rogersb48b9eb2014-02-28 16:20:21 -0800125ART_TARGET_CLANG := false
Brian Carlstrom9719cd22014-03-09 14:05:04 -0700126ART_HOST_CLANG := false
Ying Wangd858c962014-03-10 18:27:10 -0700127ifneq ($(WITHOUT_HOST_CLANG),true)
Brian Carlstrom9719cd22014-03-09 14:05:04 -0700128 # By default, host builds use clang for better warnings.
Ian Rogers35df1f32014-03-08 23:48:23 -0800129 ART_HOST_CLANG := true
Ian Rogers35df1f32014-03-08 23:48:23 -0800130endif
Ian Rogerscd5d0422013-05-17 15:54:01 -0700131
Tim Murraya7e7c2a2014-04-30 14:09:31 -0700132# enable ART_TARGET_CLANG for ARM64
133ifneq (,$(filter $(TARGET_ARCH),arm64))
134ART_TARGET_CLANG := true
135endif
136
Brian Carlstromb32a3ad2014-01-20 14:48:07 -0800137# directory used for dalvik-cache on device
138ART_DALVIK_CACHE_DIR := /data/dalvik-cache
139
Brian Carlstrom32b4b2a2012-01-31 16:21:40 -0800140# directory used for gtests on device
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700141ART_BASE_NATIVETEST_DIR := /data/nativetest/art
142ART_BASE_NATIVETEST_OUT := $(TARGET_OUT_DATA_NATIVE_TESTS)/art
Brian Carlstrom32b4b2a2012-01-31 16:21:40 -0800143
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700144# directory used for tests on device
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700145ART_BASE_TEST_DIR := /data/art-test
146ART_BASE_TEST_OUT := $(TARGET_OUT_DATA)/art-test
147
148# Primary vs. secondary
1492ND_TARGET_ARCH := $(TARGET_2ND_ARCH)
150ART_PHONY_TEST_TARGET_SUFFIX :=
1512ND_ART_PHONY_TEST_TARGET_SUFFIX :=
152ART_TARGET_BINARY_SUFFIX :=
1532ND_ART_TARGET_BINARY_SUFFIX :=
154ifdef TARGET_2ND_ARCH
155 art_test_primary_suffix :=
156 art_test_secondary_suffix :=
157 ifneq ($(filter %64,$(TARGET_ARCH)),)
158 art_test_primary_suffix := 64
159 ART_PHONY_TEST_TARGET_SUFFIX := 64
160 2ND_ART_PHONY_TEST_TARGET_SUFFIX := 32
161 ART_TARGET_BINARY_SUFFIX := 64
162 else
163 # TODO: ???
164 $(error Do not know what to do with this multi-target configuration!)
165 endif
166 # Primary with primary suffix
167 ART_NATIVETEST_DIR := $(ART_BASE_NATIVETEST_DIR)$(art_test_primary_suffix)
168 ART_NATIVETEST_OUT := $(ART_BASE_NATIVETEST_OUT)$(art_test_primary_suffix)
169 ART_TEST_DIR := $(ART_BASE_TEST_DIR)$(art_test_primary_suffix)
170 ART_TEST_OUT := $(ART_BASE_TEST_OUT)$(art_test_primary_suffix)
171 # Secondary with 2ND_ prefix and secondary suffix
172 2ND_ART_NATIVETEST_DIR := $(ART_BASE_NATIVETEST_DIR)$(art_test_secondary_suffix)
173 2ND_ART_NATIVETEST_OUT := $(ART_BASE_NATIVETEST_OUT)$(art_test_secondary_suffix)
174 2ND_ART_TEST_DIR := $(ART_BASE_TEST_DIR)$(art_test_secondary_suffix)
175 2ND_ART_TEST_OUT := $(ART_BASE_TEST_OUT)$(art_test_secondary_suffix)
176else
177 ART_NATIVETEST_DIR := $(ART_BASE_NATIVETEST_DIR)
178 ART_NATIVETEST_OUT := $(ART_BASE_NATIVETEST_OUT)
179 ART_TEST_DIR := $(ART_BASE_TEST_DIR)
180 ART_TEST_OUT := $(ART_BASE_TEST_OUT)
181 # No secondary
182endif
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700183
Brian Carlstromcdc8de42011-07-19 14:23:17 -0700184ART_CPP_EXTENSION := .cc
Carl Shapiro9bf84fd2011-06-17 17:05:25 -0700185
Brian Carlstrom7940e442013-07-12 13:46:57 -0700186ART_HOST_SHLIB_EXTENSION := $(HOST_SHLIB_SUFFIX)
187ART_HOST_SHLIB_EXTENSION ?= .so
188
Elliott Hughes0af55432011-08-17 18:37:28 -0700189ART_C_INCLUDES := \
190 external/gtest/include \
Ian Rogers1d54e732013-05-02 21:10:01 -0700191 external/valgrind/main/include \
Mathieu Chartier75165d02013-09-12 14:00:31 -0700192 external/valgrind/main \
Serban Constantinescued8dd492014-02-11 14:15:10 +0000193 external/vixl/src \
buzbeec143c552011-08-20 17:38:58 -0700194 external/zlib \
Brian Carlstrom7940e442013-07-12 13:46:57 -0700195 frameworks/compile/mclinker/include
Brian Carlstromb0460ea2011-07-29 10:08:05 -0700196
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700197art_cflags := \
Ian Rogers637c65b2013-05-31 11:46:00 -0700198 -fno-rtti \
Mathieu Chartier9b3c3cd2013-08-12 17:41:54 -0700199 -std=gnu++11 \
Carl Shapiro1fb86202011-06-27 17:43:13 -0700200 -ggdb3 \
201 -Wall \
202 -Werror \
203 -Wextra \
Nicolas Geoffrayf3e2cc42014-02-18 18:37:26 +0000204 -Wno-sign-promo \
205 -Wno-unused-parameter \
Mark Mendell3f2d0312014-01-20 17:20:27 -0800206 -Wstrict-aliasing \
Tim Murraya7e7c2a2014-04-30 14:09:31 -0700207 -fstrict-aliasing
208
209# these are necessary for Clang ARM64 ART builds
210ifeq ($(ART_TARGET_CLANG), true)
211art_cflags += \
Tim Murray4a0047a2014-04-30 13:40:58 -0700212 -Wno-implicit-exception-spec-mismatch \
213 -DNVALGRIND \
214 -Wno-unused-value
Tim Murraya7e7c2a2014-04-30 14:09:31 -0700215endif
Carl Shapiro1fb86202011-06-27 17:43:13 -0700216
Anwar Ghuloumc44f68f2013-05-10 13:24:54 -0700217ifeq ($(ART_SMALL_MODE),true)
218 art_cflags += -DART_SMALL_MODE=1
Ian Rogersf3e98552013-03-20 15:49:49 -0700219endif
220
Dragos Sbirlea7467ee02013-06-21 09:20:34 -0700221ifeq ($(ART_SEA_IR_MODE),true)
222 art_cflags += -DART_SEA_IR_MODE=1
223endif
224
Brian Carlstrom69d7a6b2011-12-15 17:31:21 -0800225ifeq ($(HOST_OS),linux)
Shih-wei Liao24782c62012-01-08 12:46:11 -0800226 art_non_debug_cflags := \
Elliott Hughes3b6baaa2011-10-14 19:13:56 -0700227 -Wframe-larger-than=1728
Brian Carlstrom69d7a6b2011-12-15 17:31:21 -0800228endif
Elliott Hughes3b6baaa2011-10-14 19:13:56 -0700229
Ian Rogers8d11af52013-08-15 14:24:29 -0700230art_non_debug_cflags := \
Tim Murray4a0047a2014-04-30 13:40:58 -0700231 -O3
232
233# FIXME: upstream LLVM has a vectorizer bug that needs to be fixed
234ifeq ($(ART_TARGET_CLANG),true)
235art_non_debug_cflags += \
236 -fno-vectorize
237endif
Ian Rogers8d11af52013-08-15 14:24:29 -0700238
Elliott Hughes3b6baaa2011-10-14 19:13:56 -0700239art_debug_cflags := \
Ian Rogers8d11af52013-08-15 14:24:29 -0700240 -O1 \
Elliott Hughes06e3ad42012-02-07 14:51:57 -0800241 -DDYNAMIC_ANNOTATIONS_ENABLED=1 \
Elliott Hughes3b6baaa2011-10-14 19:13:56 -0700242 -UNDEBUG
243
Brian Carlstrom9719cd22014-03-09 14:05:04 -0700244ART_HOST_CFLAGS := $(art_cflags) -DANDROID_SMP=1 -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS)
Brian Carlstrom1bd2ceb2013-11-06 00:29:48 -0800245ART_HOST_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=default
Hiroshi Yamauchi1dda0602014-05-12 12:32:32 -0700246ART_HOST_CFLAGS += $(ART_DEFAULT_GC_TYPE_CFLAGS)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700247
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800248ART_TARGET_CFLAGS := $(art_cflags) -DART_TARGET -DART_BASE_ADDRESS=$(LIBART_IMG_TARGET_BASE_ADDRESS)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700249ifeq ($(TARGET_CPU_SMP),true)
250 ART_TARGET_CFLAGS += -DANDROID_SMP=1
251else
252 ART_TARGET_CFLAGS += -DANDROID_SMP=0
253endif
Hiroshi Yamauchi1dda0602014-05-12 12:32:32 -0700254ART_TARGET_CFLAGS += $(ART_DEFAULT_GC_TYPE_CFLAGS)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700255
Brian Carlstrom1bd2ceb2013-11-06 00:29:48 -0800256# DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is set in ../build/core/dex_preopt.mk based on
257# the TARGET_CPU_VARIANT
258ifeq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
259$(error Required DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES is not set)
260endif
261ART_TARGET_CFLAGS += -DART_DEFAULT_INSTRUCTION_SET_FEATURES=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
262
Ian Rogers719d1a32014-03-06 12:13:39 -0800263# Enable thread-safety for GCC 4.6, and clang, but not for GCC 4.7 or later where this feature was
264# removed. Warn when -Wthread-safety is not used.
Ian Rogersba3ce9a2013-05-17 18:50:09 -0700265ifneq ($(filter 4.6 4.6.%, $(TARGET_GCC_VERSION)),)
266 ART_TARGET_CFLAGS += -Wthread-safety
267else
Tim Murray4a0047a2014-04-30 13:40:58 -0700268 # FIXME: add -Wthread-safety when the problem is fixed
Ian Rogers719d1a32014-03-06 12:13:39 -0800269 ifeq ($(ART_TARGET_CLANG),true)
Tim Murray4a0047a2014-04-30 13:40:58 -0700270 ART_TARGET_CFLAGS +=
Ian Rogers719d1a32014-03-06 12:13:39 -0800271 else
272 # Warn if -Wthread-safety is not suport and not doing a top-level or 'mma' build.
273 ifneq ($(ONE_SHOT_MAKEFILE),)
274 # Enable target GCC 4.6 with: export TARGET_GCC_VERSION_EXP=4.6
275 $(info Using target GCC $(TARGET_GCC_VERSION) disables thread-safety checks.)
276 endif
Ian Rogersba3ce9a2013-05-17 18:50:09 -0700277 endif
278endif
Ian Rogers719d1a32014-03-06 12:13:39 -0800279# We compile with GCC 4.6 or clang on the host, both of which support -Wthread-safety.
Ian Rogersba3ce9a2013-05-17 18:50:09 -0700280ART_HOST_CFLAGS += -Wthread-safety
281
Brian Carlstrom89521892011-12-07 22:05:07 -0800282# To use oprofile_android --callgraph, uncomment this and recompile with "mmm art -B -j16"
283# ART_TARGET_CFLAGS += -fno-omit-frame-pointer -marm -mapcs
284
Ian Rogersa9844542014-04-21 17:01:02 -0700285# Addition CPU specific CFLAGS.
286ifeq ($(TARGET_ARCH),arm)
287 ifneq ($(filter cortex-a15, $(TARGET_CPU_VARIANT)),)
288 # Fake a ARM feature for LPAE support.
289 ART_TARGET_CFLAGS += -D__ARM_FEATURE_LPAE=1
290 endif
291endif
292
Elliott Hughes3b6baaa2011-10-14 19:13:56 -0700293ART_HOST_NON_DEBUG_CFLAGS := $(art_non_debug_cflags)
294ART_TARGET_NON_DEBUG_CFLAGS := $(art_non_debug_cflags)
295
Brian Carlstromfd2ec542012-05-02 15:08:57 -0700296# TODO: move -fkeep-inline-functions to art_debug_cflags when target gcc > 4.4 (and -lsupc++)
Elliott Hughes1ba27142012-01-20 15:32:00 -0800297ART_HOST_DEBUG_CFLAGS := $(art_debug_cflags) -fkeep-inline-functions
Brian Carlstromfd2ec542012-05-02 15:08:57 -0700298ART_HOST_DEBUG_LDLIBS := -lsupc++
Elliott Hughesad6c9c32012-01-19 17:39:12 -0800299
300ifneq ($(HOST_OS),linux)
301 # Some Mac OS pthread header files are broken with -fkeep-inline-functions.
Elliott Hughes34cf5142012-01-20 16:39:13 -0800302 ART_HOST_DEBUG_CFLAGS := $(filter-out -fkeep-inline-functions,$(ART_HOST_DEBUG_CFLAGS))
Elliott Hughes60234562012-06-01 12:25:59 -0700303 # Mac OS doesn't have libsupc++.
304 ART_HOST_DEBUG_LDLIBS := $(filter-out -lsupc++,$(ART_HOST_DEBUG_LDLIBS))
Elliott Hughesad6c9c32012-01-19 17:39:12 -0800305endif
306
Brian Carlstrom86927212011-09-15 11:31:11 -0700307ART_TARGET_DEBUG_CFLAGS := $(art_debug_cflags)
Elliott Hughes1d3f1142011-09-13 12:00:00 -0700308
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700309ART_BUILD_TARGET := false
310ART_BUILD_HOST := false
Brian Carlstrom265091e2013-01-30 14:08:26 -0800311ART_BUILD_NDEBUG := false
312ART_BUILD_DEBUG := false
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700313ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
314 ART_BUILD_TARGET := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800315 ART_BUILD_NDEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700316endif
317ifeq ($(ART_BUILD_TARGET_DEBUG),true)
318 ART_BUILD_TARGET := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800319 ART_BUILD_DEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700320endif
321ifeq ($(ART_BUILD_HOST_NDEBUG),true)
322 ART_BUILD_HOST := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800323 ART_BUILD_NDEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700324endif
325ifeq ($(ART_BUILD_HOST_DEBUG),true)
326 ART_BUILD_HOST := true
Brian Carlstrom265091e2013-01-30 14:08:26 -0800327 ART_BUILD_DEBUG := true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700328endif
Dragos Sbirlea37c19bc2013-07-29 09:38:31 -0700329
Andreas Gampe2fe07922014-04-21 07:50:39 -0700330# Helper function to call a function twice with a target suffix
331# $(1): The generator function for the rules
332# Has one argument, the suffix
333define call-art-multi-target
334 $(call $(1),$(ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700335
Andreas Gampe2fe07922014-04-21 07:50:39 -0700336 ifdef TARGET_2ND_ARCH
337 $(call $(1),$(2ND_ART_PHONY_TEST_TARGET_SUFFIX))
338 endif
339endef
340
341# Helper function to combine two variables with suffixes together.
342# $(1): The base name.
343define combine-art-multi-target-var
344 ifdef TARGET_2ND_ARCH
345 ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),)
346 ifneq ($(2ND_ART_PHONY_TEST_TARGET_SUFFIX),)
347$(1) := $($(1)$(ART_PHONY_TEST_TARGET_SUFFIX)) $($(1)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX))
348 endif
349 endif
350 endif
351endef
352
353
354# Helper function to define a variable twice with a target suffix. Assume the name generated is
355# derived from $(2) so we can create a combined var.
356# $(1): The generator function for the rules
357# Has one argument, the suffix
358define call-art-multi-target-var
359 $(call $(1),$(ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700360
Andreas Gampe2fe07922014-04-21 07:50:39 -0700361 ifdef TARGET_2ND_ARCH
362 $(call $(1),$(2ND_ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700363
Andreas Gampe2fe07922014-04-21 07:50:39 -0700364 # Link both together, if it makes sense
365 ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),)
366 ifneq ($(2ND_ART_PHONY_TEST_TARGET_SUFFIX),)
367$(2) := $(2)$(ART_PHONY_TEST_TARGET_SUFFIX) $(2)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
368 endif
369 endif
370
371 endif
372endef
373
374# Helper function to call a function twice with a target suffix. Assume it generates make rules
375# with the given name, and link them.
376# $(1): The generator function for the rules
377# Has one argument, the suffix
378# $(2): The base rule name, necessary for the link
379# We assume we can link the names together easily...
380define call-art-multi-target-rule
381 $(call $(1),$(ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700382
Andreas Gampe2fe07922014-04-21 07:50:39 -0700383 ifdef TARGET_2ND_ARCH
384 $(call $(1),$(2ND_ART_PHONY_TEST_TARGET_SUFFIX))
Tim Murray4a0047a2014-04-30 13:40:58 -0700385
Andreas Gampe2fe07922014-04-21 07:50:39 -0700386 # Link both together, if it makes sense
387 ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),)
388 ifneq ($(2ND_ART_PHONY_TEST_TARGET_SUFFIX),)
389.PHONY: $(2)
390$(2): $(2)$(ART_PHONY_TEST_TARGET_SUFFIX) $(2)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
391 endif
392 endif
393 endif
394endef
395
396
Dragos Sbirlea37c19bc2013-07-29 09:38:31 -0700397endif # ANDROID_COMMON_MK