blob: 01819ee9564a82db676d151e26ad52f139c493b4 [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
17LOCAL_PATH := $(call my-dir)
Carl Shapiro7b216702011-06-17 15:09:26 -070018
Brian Carlstrom7940e442013-07-12 13:46:57 -070019art_path := $(LOCAL_PATH)
20art_build_path := $(art_path)/build
Brian Carlstrom1f8730b2013-11-13 17:36:23 -080021include $(art_build_path)/Android.common.mk
Brian Carlstromcdc8de42011-07-19 14:23:17 -070022
Brian Carlstromb2793372012-03-17 18:27:16 -070023########################################################################
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070024# clean-oat targets
25#
26
27# following the example of build's dont_bother for clean targets
28ifneq (,$(filter clean-oat,$(MAKECMDGOALS)))
29art_dont_bother := true
30endif
31ifneq (,$(filter clean-oat-host,$(MAKECMDGOALS)))
32art_dont_bother := true
33endif
34ifneq (,$(filter clean-oat-target,$(MAKECMDGOALS)))
35art_dont_bother := true
36endif
37
38.PHONY: clean-oat
39clean-oat: clean-oat-host clean-oat-target
40
41.PHONY: clean-oat-host
42clean-oat-host:
Brian Carlstrom999cd432013-06-22 23:08:53 -070043 rm -f $(ART_NATIVETEST_OUT)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070044 rm -f $(ART_NATIVETEST_OUT)/*.oat
45 rm -f $(ART_NATIVETEST_OUT)/*.art
Brian Carlstrom999cd432013-06-22 23:08:53 -070046 rm -f $(ART_TEST_OUT)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070047 rm -f $(ART_TEST_OUT)/*.oat
48 rm -f $(ART_TEST_OUT)/*.art
Brian Carlstrom999cd432013-06-22 23:08:53 -070049 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070050 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.oat
51 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.art
Brian Carlstrom999cd432013-06-22 23:08:53 -070052 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070053 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.oat
54 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.art
Brian Carlstromb32a3ad2014-01-20 14:48:07 -080055 rm -f $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)/*.oat
56 rm -f $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)/*.art
Brian Carlstrom999cd432013-06-22 23:08:53 -070057 rm -f $(TARGET_OUT_UNSTRIPPED)/system/framework/*.odex
Brian Carlstrom1d6848c2013-03-06 15:03:52 -080058 rm -f $(TARGET_OUT_UNSTRIPPED)/system/framework/*.oat
Brian Carlstrom999cd432013-06-22 23:08:53 -070059 rm -f $(TARGET_OUT_APPS)/*.odex
Brian Carlstrom30e2ea42013-06-19 23:25:37 -070060 rm -f $(TARGET_OUT_INTERMEDIATES)/JAVA_LIBRARIES/*_intermediates/javalib.odex
61 rm -f $(TARGET_OUT_INTERMEDIATES)/APPS/*_intermediates/*.odex
Colin Crossdc781a12014-02-04 16:22:03 -080062ifdef TARGET_2ND_ARCH
63 rm -f $(2ND_TARGET_OUT_INTERMEDIATES)/JAVA_LIBRARIES/*_intermediates/javalib.odex
64 rm -f $(2ND_TARGET_OUT_INTERMEDIATES)/APPS/*_intermediates/*.odex
65endif
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +070066 rm -rf /tmp/$(USER)/test-*/dalvik-cache/*
Brian Carlstromae089612014-05-01 13:52:23 -070067 rm -rf /tmp/android-data/dalvik-cache/*
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070068
69.PHONY: clean-oat-target
70clean-oat-target:
71 adb remount
Brian Carlstromae089612014-05-01 13:52:23 -070072 adb shell rm -f $(ART_NATIVETEST_DIR)/*.odex
73 adb shell rm -f $(ART_NATIVETEST_DIR)/*.oat
74 adb shell rm -f $(ART_NATIVETEST_DIR)/*.art
75 adb shell rm -f $(ART_TEST_DIR)/*.odex
76 adb shell rm -f $(ART_TEST_DIR)/*.oat
77 adb shell rm -f $(ART_TEST_DIR)/*.art
78ifdef TARGET_2ND_ARCH
79 adb shell rm -f $(2ND_ART_NATIVETEST_DIR)/*.odex
80 adb shell rm -f $(2ND_ART_NATIVETEST_DIR)/*.oat
81 adb shell rm -f $(2ND_ART_NATIVETEST_DIR)/*.art
82 adb shell rm -f $(2ND_ART_TEST_DIR)/*.odex
83 adb shell rm -f $(2ND_ART_TEST_DIR)/*.oat
84 adb shell rm -f $(2ND_ART_TEST_DIR)/*.art
85endif
86 adb shell rm -rf $(ART_DALVIK_CACHE_DIR)/*
87 adb shell rm -f $(DEXPREOPT_BOOT_JAR_DIR)/*.oat
88 adb shell rm -f $(DEXPREOPT_BOOT_JAR_DIR)/*.art
89 adb shell rm -f system/app/*.odex
90 adb shell rm -rf data/run-test/test-*/dalvik-cache/*
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070091
92ifneq ($(art_dont_bother),true)
93
94########################################################################
Brian Carlstromb2793372012-03-17 18:27:16 -070095# product targets
Brian Carlstrom7940e442013-07-12 13:46:57 -070096include $(art_path)/runtime/Android.mk
97include $(art_path)/compiler/Android.mk
98include $(art_path)/dex2oat/Android.mk
Ian Rogers02ed4c02013-09-06 13:10:04 -070099include $(art_path)/disassembler/Android.mk
Brian Carlstrom7940e442013-07-12 13:46:57 -0700100include $(art_path)/oatdump/Android.mk
Brian Carlstromfa50baa2013-08-02 01:00:27 -0700101include $(art_path)/dalvikvm/Android.mk
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000102include $(art_path)/tools/Android.mk
Brian Carlstrom7940e442013-07-12 13:46:57 -0700103include $(art_build_path)/Android.oat.mk
Carl Shapiro7b216702011-06-17 15:09:26 -0700104
Andreas Gampe2fe07922014-04-21 07:50:39 -0700105
106
Brian Carlstromb2793372012-03-17 18:27:16 -0700107# ART_HOST_DEPENDENCIES depends on Android.executable.mk above for ART_HOST_EXECUTABLES
Brian Carlstromfd7ad0a2013-12-10 18:20:45 -0800108ART_HOST_DEPENDENCIES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_JAVA_LIBRARIES)/core-libart-hostdex.jar
Elliott Hughesf1eedca2012-04-20 16:00:32 -0700109ART_HOST_DEPENDENCIES += $(HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION)
Brian Carlstromfd7ad0a2013-12-10 18:20:45 -0800110ART_TARGET_DEPENDENCIES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_JAVA_LIBRARIES)/core-libart.jar $(TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so
Brian Carlstrom15803792012-03-13 00:53:08 -0700111
Brian Carlstromb2793372012-03-17 18:27:16 -0700112########################################################################
113# test targets
Brian Carlstrom15803792012-03-13 00:53:08 -0700114
Brian Carlstrom7940e442013-07-12 13:46:57 -0700115include $(art_path)/test/Android.mk
116include $(art_build_path)/Android.gtest.mk
Brian Carlstromb2793372012-03-17 18:27:16 -0700117
Andreas Gampe2fe07922014-04-21 07:50:39 -0700118$(eval $(call combine-art-multi-target-var,ART_TARGET_GTEST_TARGETS))
119$(eval $(call combine-art-multi-target-var,ART_TARGET_GTEST_EXECUTABLES))
120
Brian Carlstromb2793372012-03-17 18:27:16 -0700121# The ART_*_TEST_DEPENDENCIES definitions:
122# - depend on Android.oattest.mk above for ART_TEST_*_DEX_FILES
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800123# - depend on Android.gtest.mk above for ART_*_GTEST_EXECUTABLES
124ART_HOST_TEST_DEPENDENCIES := $(ART_HOST_DEPENDENCIES) $(ART_HOST_GTEST_EXECUTABLES) $(ART_TEST_HOST_DEX_FILES) $(HOST_CORE_IMG_OUT)
Andreas Gampe2fe07922014-04-21 07:50:39 -0700125
126define declare-art-target-test-dependencies-var
127ART_TARGET_TEST_DEPENDENCIES$(1) := $(ART_TARGET_DEPENDENCIES) $(ART_TARGET_GTEST_EXECUTABLES$(1)) $(ART_TEST_TARGET_DEX_FILES$(1)) $(TARGET_CORE_IMG_OUT$(1))
128endef
129$(eval $(call call-art-multi-target-var,declare-art-target-test-dependencies-var,ART_TARGET_TEST_DEPENDENCIES))
Brian Carlstrom16192862011-09-12 17:50:06 -0700130
Brian Carlstrom7940e442013-07-12 13:46:57 -0700131include $(art_build_path)/Android.libarttest.mk
Brian Carlstrom934486c2011-07-12 23:42:50 -0700132
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700133# "mm test-art" to build and run all tests on host and device
134.PHONY: test-art
135test-art: test-art-host test-art-target
Brian Carlstrom395520e2011-09-25 19:35:00 -0700136 @echo test-art PASSED
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700137
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700138.PHONY: test-art-gtest
Brian Carlstromb2793372012-03-17 18:27:16 -0700139test-art-gtest: test-art-host-gtest test-art-target-gtest
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700140 @echo test-art-gtest PASSED
141
Brian Carlstromb2793372012-03-17 18:27:16 -0700142.PHONY: test-art-oat
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700143test-art-oat: test-art-host-oat test-art-target-oat
Brian Carlstromb2793372012-03-17 18:27:16 -0700144 @echo test-art-oat PASSED
Elliott Hughes2cae5a22011-08-14 14:27:25 -0700145
Brian Carlstrom08981ab2012-05-25 18:40:15 -0700146.PHONY: test-art-run-test
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700147test-art-run-test: test-art-host-run-test test-art-target-run-test
Brian Carlstrom08981ab2012-05-25 18:40:15 -0700148 @echo test-art-run-test PASSED
149
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700150########################################################################
151# host test targets
152
Brian Carlstrom934486c2011-07-12 23:42:50 -0700153# "mm test-art-host" to build and run all host tests
154.PHONY: test-art-host
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700155test-art-host: test-art-host-gtest test-art-host-oat test-art-host-run-test
Brian Carlstrom395520e2011-09-25 19:35:00 -0700156 @echo test-art-host PASSED
Brian Carlstrom59848da2011-07-23 20:35:19 -0700157
Ian Rogers85d9ba62013-01-16 22:32:12 -0800158.PHONY: test-art-host-interpreter
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700159test-art-host-interpreter: test-art-host-oat-interpreter test-art-host-run-test-interpreter
Ian Rogers85d9ba62013-01-16 22:32:12 -0800160 @echo test-art-host-interpreter PASSED
161
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700162.PHONY: test-art-host-dependencies
Brian Carlstrom43534862014-02-19 01:13:52 -0800163test-art-host-dependencies: $(ART_HOST_TEST_DEPENDENCIES) $(HOST_OUT_SHARED_LIBRARIES)/libarttest$(ART_HOST_SHLIB_EXTENSION) $(HOST_CORE_DEX_LOCATIONS)
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700164
Brian Carlstromb2793372012-03-17 18:27:16 -0700165.PHONY: test-art-host-gtest
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800166test-art-host-gtest: $(ART_HOST_GTEST_TARGETS)
Brian Carlstromb2793372012-03-17 18:27:16 -0700167 @echo test-art-host-gtest PASSED
Elliott Hughes2cae5a22011-08-14 14:27:25 -0700168
Brian Carlstromb2793372012-03-17 18:27:16 -0700169# "mm valgrind-test-art-host-gtest" to build and run the host gtests under valgrind.
170.PHONY: valgrind-test-art-host-gtest
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800171valgrind-test-art-host-gtest: $(ART_HOST_VALGRIND_GTEST_TARGETS)
Brian Carlstromb2793372012-03-17 18:27:16 -0700172 @echo valgrind-test-art-host-gtest PASSED
173
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700174.PHONY: test-art-host-oat-default
175test-art-host-oat-default: $(ART_TEST_HOST_OAT_DEFAULT_TARGETS)
176 @echo test-art-host-oat-default PASSED
177
178.PHONY: test-art-host-oat-interpreter
179test-art-host-oat-interpreter: $(ART_TEST_HOST_OAT_INTERPRETER_TARGETS)
180 @echo test-art-host-oat-interpreter PASSED
181
Brian Carlstromb2793372012-03-17 18:27:16 -0700182.PHONY: test-art-host-oat
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700183test-art-host-oat: test-art-host-oat-default test-art-host-oat-interpreter
Brian Carlstromb2793372012-03-17 18:27:16 -0700184 @echo test-art-host-oat PASSED
Elliott Hughes5511f212011-08-12 18:07:45 -0700185
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700186define declare-test-art-host-run-test
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700187.PHONY: test-art-host-run-test-default-$(1)
Brian Carlstrom43534862014-02-19 01:13:52 -0800188test-art-host-run-test-default-$(1): test-art-host-dependencies $(DX) $(HOST_OUT_EXECUTABLES)/jasmin
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000189 DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) art/test/run-test $(DALVIKVM_FLAGS) --host $(1)
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700190 @echo test-art-host-run-test-default-$(1) PASSED
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700191
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700192TEST_ART_HOST_RUN_TEST_DEFAULT_TARGETS += test-art-host-run-test-default-$(1)
Ian Rogers27cedf82012-11-21 11:42:43 -0800193
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700194.PHONY: test-art-host-run-test-interpreter-$(1)
Brian Carlstrom43534862014-02-19 01:13:52 -0800195test-art-host-run-test-interpreter-$(1): test-art-host-dependencies $(DX) $(HOST_OUT_EXECUTABLES)/jasmin
Nicolas Geoffray92cf83e2014-03-18 17:59:20 +0000196 DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) art/test/run-test $(DALVIKVM_FLAGS) --host --interpreter $(1)
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700197 @echo test-art-host-run-test-interpreter-$(1) PASSED
Ian Rogers27cedf82012-11-21 11:42:43 -0800198
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700199TEST_ART_HOST_RUN_TEST_INTERPRETER_TARGETS += test-art-host-run-test-interpreter-$(1)
Brian Carlstroma404db02013-08-28 09:37:40 -0700200
201.PHONY: test-art-host-run-test-$(1)
202test-art-host-run-test-$(1): test-art-host-run-test-default-$(1) test-art-host-run-test-interpreter-$(1)
203
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700204endef
205
Brian Carlstrom934ce802014-04-01 18:09:33 -0700206$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call declare-test-art-host-run-test,$(test))))
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700207
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700208.PHONY: test-art-host-run-test-default
209test-art-host-run-test-default: $(TEST_ART_HOST_RUN_TEST_DEFAULT_TARGETS)
210 @echo test-art-host-run-test-default PASSED
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700211
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700212.PHONY: test-art-host-run-test-interpreter
213test-art-host-run-test-interpreter: $(TEST_ART_HOST_RUN_TEST_INTERPRETER_TARGETS)
214 @echo test-art-host-run-test-interpreter PASSED
215
216.PHONY: test-art-host-run-test
217test-art-host-run-test: test-art-host-run-test-default test-art-host-run-test-interpreter
218 @echo test-art-host-run-test PASSED
Ian Rogers27cedf82012-11-21 11:42:43 -0800219
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700220########################################################################
221# target test targets
222
223# "mm test-art-target" to build and run all target tests
Andreas Gampe2fe07922014-04-21 07:50:39 -0700224define declare-test-art-target
225.PHONY: test-art-target$(1)
226test-art-target$(1): test-art-target-gtest$(1) test-art-target-oat$(1) test-art-target-run-test$(1)
227 @echo test-art-target$(1) PASSED
228endef
229$(eval $(call call-art-multi-target-rule,declare-test-art-target,test-art-target))
Brian Carlstrom86927212011-09-15 11:31:11 -0700230
Andreas Gampe2fe07922014-04-21 07:50:39 -0700231
232define declare-test-art-target-dependencies
233.PHONY: test-art-target-dependencies$(1)
234test-art-target-dependencies$(1): $(ART_TARGET_TEST_DEPENDENCIES$(1)) $(ART_TEST_OUT)/libarttest.so
235endef
236$(eval $(call call-art-multi-target-rule,declare-test-art-target-dependencies,test-art-target-dependencies))
237
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700238
Brian Carlstrom86927212011-09-15 11:31:11 -0700239.PHONY: test-art-target-sync
Andreas Gampe2fe07922014-04-21 07:50:39 -0700240test-art-target-sync: test-art-target-dependencies$(ART_PHONY_TEST_TARGET_SUFFIX) test-art-target-dependencies$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700241 adb remount
242 adb sync
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700243 adb shell mkdir -p $(ART_TEST_DIR)
Brian Carlstrom86927212011-09-15 11:31:11 -0700244
Brian Carlstrom86927212011-09-15 11:31:11 -0700245
Andreas Gampe2fe07922014-04-21 07:50:39 -0700246define declare-test-art-target-gtest
247.PHONY: test-art-target-gtest$(1)
248test-art-target-gtest$(1): $(ART_TARGET_GTEST_TARGETS$(1))
Andreas Gampea63229c2014-04-21 09:51:07 -0700249 @echo test-art-target-gtest$(1) PASSED
Andreas Gampe2fe07922014-04-21 07:50:39 -0700250endef
251$(eval $(call call-art-multi-target-rule,declare-test-art-target-gtest,test-art-target-gtest))
252
253
254define declare-test-art-target-oat
255.PHONY: test-art-target-oat$(1)
256test-art-target-oat$(1): $(ART_TEST_TARGET_OAT_TARGETS$(1))
257 @echo test-art-target-oat$(1) PASSED
258endef
259$(eval $(call call-art-multi-target-rule,declare-test-art-target-oat,test-art-target-oat))
260
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700261
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700262define declare-test-art-target-run-test-impl
Andreas Gampe2fe07922014-04-21 07:50:39 -0700263$(2)run_test_$(1) :=
264ifeq ($($(2)ART_PHONY_TEST_TARGET_SUFFIX),64)
265 $(2)run_test_$(1) := --64
266endif
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700267.PHONY: test-art-target-run-test-$(1)$($(2)ART_PHONY_TEST_TARGET_SUFFIX)
268test-art-target-run-test-$(1)$($(2)ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-sync $(DX) $(HOST_OUT_EXECUTABLES)/jasmin
Andreas Gampe2fe07922014-04-21 07:50:39 -0700269 DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) art/test/run-test $(DALVIKVM_FLAGS) $$($(2)run_test_$(1)) $(1)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700270 @echo test-art-target-run-test-$(1)$($(2)ART_PHONY_TEST_TARGET_SUFFIX) PASSED
271endef
Brian Carlstrome24fa612011-09-29 00:53:55 -0700272
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700273define declare-test-art-target-run-test
274
275 ifdef TARGET_2ND_ARCH
Andreas Gampe2fe07922014-04-21 07:50:39 -0700276 $(call declare-test-art-target-run-test-impl,$(1),2ND_)
277
278 TEST_ART_TARGET_RUN_TEST_TARGETS$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) += test-art-target-run-test-$(1)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700279
280 ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),)
281 # Link primary to non-suffix
282test-art-target-run-test-$(1): test-art-target-run-test-$(1)$(ART_PHONY_TEST_TARGET_SUFFIX)
283 endif
284 endif
Andreas Gampe2fe07922014-04-21 07:50:39 -0700285 $(call declare-test-art-target-run-test-impl,$(1),)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700286
Andreas Gampe2fe07922014-04-21 07:50:39 -0700287 TEST_ART_TARGET_RUN_TEST_TARGETS$(ART_PHONY_TEST_TARGET_SUFFIX) += test-art-target-run-test-$(1)$(ART_PHONY_TEST_TARGET_SUFFIX)
Brian Carlstroma404db02013-08-28 09:37:40 -0700288
289test-art-run-test-$(1): test-art-host-run-test-$(1) test-art-target-run-test-$(1)
290
Brian Carlstrom37c44442012-03-06 22:21:18 -0800291endef
292
Brian Carlstrom934ce802014-04-01 18:09:33 -0700293$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call declare-test-art-target-run-test,$(test))))
Brian Carlstrom37c44442012-03-06 22:21:18 -0800294
Andreas Gampe2fe07922014-04-21 07:50:39 -0700295
296define declare-test-art-target-run-test
297.PHONY: test-art-target-run-test$(1)
298test-art-target-run-test$(1): $(TEST_ART_TARGET_RUN_TEST_TARGETS$(1))
299 @echo test-art-target-run-test$(1) PASSED
300endef
301$(eval $(call call-art-multi-target-rule,declare-test-art-target-run-test,test-art-target-run-test))
302
Brian Carlstrome24fa612011-09-29 00:53:55 -0700303
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700304########################################################################
Brian Carlstrom04941d92012-02-19 01:47:51 -0800305# oat-target and oat-target-sync targets
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700306
Brian Carlstrom04941d92012-02-19 01:47:51 -0800307OAT_TARGET_TARGETS :=
308
309# $(1): input jar or apk target location
310define declare-oat-target-target
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700311ifneq (,$(filter $(1),$(addprefix system/app/,$(addsuffix .apk,$(PRODUCT_DEX_PREOPT_PACKAGES_IN_DATA)))))
Brian Carlstrom999cd432013-06-22 23:08:53 -0700312OUT_OAT_FILE := $(call dalvik-cache-out,$(1)/classes.dex)
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700313else
Brian Carlstrom999cd432013-06-22 23:08:53 -0700314OUT_OAT_FILE := $(PRODUCT_OUT)/$(basename $(1)).odex
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700315endif
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700316
317ifeq ($(ONE_SHOT_MAKEFILE),)
Brian Carlstrom90e27412013-03-13 21:51:47 -0700318# ONE_SHOT_MAKEFILE is empty for a top level build and we don't want
319# to define the oat-target-* rules there because they will conflict
320# with the build/core/dex_preopt.mk defined rules.
Brian Carlstrom04941d92012-02-19 01:47:51 -0800321.PHONY: oat-target-$(1)
Brian Carlstrom90e27412013-03-13 21:51:47 -0700322oat-target-$(1):
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700323
324else
325.PHONY: oat-target-$(1)
Shih-wei Liao7eea0e82012-05-28 23:56:21 -0700326oat-target-$(1): $$(OUT_OAT_FILE)
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700327
Nicolas Geoffray1db132d2014-03-26 10:56:24 +0000328$$(OUT_OAT_FILE): $(PRODUCT_OUT)/$(1) $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) $(DEX2OATD_DEPENDENCY)
Brian Carlstrom90e27412013-03-13 21:51:47 -0700329 @mkdir -p $$(dir $$@)
Ian Rogers9b797762014-04-18 15:40:37 -0700330 $(DEX2OATD) --runtime-arg -Xms64m --runtime-arg -Xmx64m \
331 --boot-image=$(DEFAULT_DEX_PREOPT_BUILT_IMAGE) --dex-file=$(PRODUCT_OUT)/$(1) \
332 --dex-location=/$(1) --oat-file=$$@ \
333 --instruction-set=$(DEX2OAT_TARGET_ARCH) \
334 --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
335 --android-root=$(PRODUCT_OUT)/system
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700336
337endif
Brian Carlstrom04941d92012-02-19 01:47:51 -0800338
339OAT_TARGET_TARGETS += oat-target-$(1)
Brian Carlstroma9f19782011-10-13 00:14:47 -0700340endef
341
Brian Carlstrombd411022012-02-07 12:09:09 -0800342$(foreach file,\
343 $(filter-out\
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800344 $(addprefix $(TARGET_OUT_JAVA_LIBRARIES)/,$(addsuffix .jar,$(LIBART_TARGET_BOOT_JARS))),\
Brian Carlstrombd411022012-02-07 12:09:09 -0800345 $(wildcard $(TARGET_OUT_APPS)/*.apk) $(wildcard $(TARGET_OUT_JAVA_LIBRARIES)/*.jar)),\
Brian Carlstrom04941d92012-02-19 01:47:51 -0800346 $(eval $(call declare-oat-target-target,$(subst $(PRODUCT_OUT)/,,$(file)))))
347
348.PHONY: oat-target
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800349oat-target: $(ART_TARGET_DEPENDENCIES) $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) $(OAT_TARGET_TARGETS)
Ian Rogersbeb60e22012-01-31 10:40:40 -0800350
Brian Carlstroma6cc8932012-01-04 14:44:07 -0800351.PHONY: oat-target-sync
Brian Carlstrom04941d92012-02-19 01:47:51 -0800352oat-target-sync: oat-target
Brian Carlstrom0796af02011-10-12 14:31:45 -0700353 adb remount
354 adb sync
355
Brian Carlstrom76aa0c02011-10-11 15:29:43 -0700356########################################################################
Brian Carlstromfa50baa2013-08-02 01:00:27 -0700357# "m build-art" for quick minimal build
358.PHONY: build-art
359build-art: build-art-host build-art-target
360
361.PHONY: build-art-host
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800362build-art-host: $(ART_HOST_EXECUTABLES) $(ART_HOST_GTEST_EXECUTABLES) $(HOST_CORE_IMG_OUT) $(HOST_OUT)/lib/libjavacore.so
Brian Carlstromfa50baa2013-08-02 01:00:27 -0700363
364.PHONY: build-art-target
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800365build-art-target: $(ART_TARGET_EXECUTABLES) $(ART_TARGET_GTEST_EXECUTABLES) $(TARGET_CORE_IMG_OUT) $(TARGET_OUT)/lib/libjavacore.so
Brian Carlstromfa50baa2013-08-02 01:00:27 -0700366
367########################################################################
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000368# "m art-host" for just building the files needed to run the art script
369.PHONY: art-host
370art-host: $(HOST_OUT_EXECUTABLES)/art $(HOST_OUT)/bin/dalvikvm $(HOST_OUT)/lib/libart.so $(HOST_OUT)/bin/dex2oat $(HOST_OUT_JAVA_LIBRARIES)/core.art $(HOST_OUT)/lib/libjavacore.so
371
372.PHONY: art-host-debug
373art-host-debug: art-host $(HOST_OUT)/lib/libartd.so $(HOST_OUT)/bin/dex2oatd
374
375########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700376# oatdump targets
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700377
Ian Rogersfa824272013-11-05 16:12:57 -0800378ART_DUMP_OAT_PATH ?= $(OUT_DIR)
379
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800380OATDUMP := $(HOST_OUT_EXECUTABLES)/oatdump$(HOST_EXECUTABLE_SUFFIX)
381OATDUMPD := $(HOST_OUT_EXECUTABLES)/oatdumpd$(HOST_EXECUTABLE_SUFFIX)
382# TODO: for now, override with debug version for better error reporting
383OATDUMP := $(OATDUMPD)
384
Brian Carlstrom395520e2011-09-25 19:35:00 -0700385.PHONY: dump-oat
Ian Rogers62d6c772013-02-27 08:32:07 -0800386dump-oat: dump-oat-core dump-oat-boot
Brian Carlstrom395520e2011-09-25 19:35:00 -0700387
Brian Carlstrome10b6972011-09-26 13:49:03 -0700388.PHONY: dump-oat-core
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700389dump-oat-core: dump-oat-core-host dump-oat-core-target
390
391.PHONY: dump-oat-core-host
Brian Carlstrom265091e2013-01-30 14:08:26 -0800392ifeq ($(ART_BUILD_HOST),true)
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700393dump-oat-core-host: $(HOST_CORE_IMG_OUT) $(OATDUMP)
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000394 $(OATDUMP) --image=$(HOST_CORE_IMG_OUT) --output=$(ART_DUMP_OAT_PATH)/core.host.oatdump.txt
Ian Rogersfa824272013-11-05 16:12:57 -0800395 @echo Output in $(ART_DUMP_OAT_PATH)/core.host.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800396endif
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700397
398.PHONY: dump-oat-core-target
Brian Carlstrom265091e2013-01-30 14:08:26 -0800399ifeq ($(ART_BUILD_TARGET),true)
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700400dump-oat-core-target: $(TARGET_CORE_IMG_OUT) $(OATDUMP)
Ian Rogersfa824272013-11-05 16:12:57 -0800401 $(OATDUMP) --image=$(TARGET_CORE_IMG_OUT) --output=$(ART_DUMP_OAT_PATH)/core.target.oatdump.txt
402 @echo Output in $(ART_DUMP_OAT_PATH)/core.target.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800403endif
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700404
Brian Carlstrome10b6972011-09-26 13:49:03 -0700405.PHONY: dump-oat-boot
Brian Carlstrom265091e2013-01-30 14:08:26 -0800406ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800407dump-oat-boot: $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) $(OATDUMP)
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000408 $(OATDUMP) --image=$(DEFAULT_DEX_PREOPT_BUILT_IMAGE) --output=$(ART_DUMP_OAT_PATH)/boot.oatdump.txt
Ian Rogersfa824272013-11-05 16:12:57 -0800409 @echo Output in $(ART_DUMP_OAT_PATH)/boot.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800410endif
Brian Carlstrom78128a62011-09-15 17:21:19 -0700411
Brian Carlstrom2e92fd62012-10-18 00:04:10 -0700412.PHONY: dump-oat-Calculator
Brian Carlstrom265091e2013-01-30 14:08:26 -0800413ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800414dump-oat-Calculator: $(TARGET_OUT_APPS)/Calculator.odex $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) $(OATDUMP)
Ian Rogersfa824272013-11-05 16:12:57 -0800415 $(OATDUMP) --oat-file=$< --output=$(ART_DUMP_OAT_PATH)/Calculator.oatdump.txt
416 @echo Output in $(ART_DUMP_OAT_PATH)/Calculator.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800417endif
Brian Carlstrom2e92fd62012-10-18 00:04:10 -0700418
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700419########################################################################
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700420# cpplint targets to style check art source files
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700421
Brian Carlstrom05eecea2013-07-18 21:59:52 -0700422include $(art_build_path)/Android.cpplint.mk
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700423
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700424########################################################################
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700425# targets to switch back and forth from libdvm to libart
426
427.PHONY: use-art
428use-art:
429 adb root && sleep 3
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800430 adb shell stop
Brian Carlstrom2d27d832014-01-30 13:14:00 -0800431 adb shell setprop persist.sys.dalvik.vm.lib.1 libart.so
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800432 adb shell start
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700433
434.PHONY: use-artd
435use-artd:
436 adb root && sleep 3
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800437 adb shell stop
Brian Carlstrom2d27d832014-01-30 13:14:00 -0800438 adb shell setprop persist.sys.dalvik.vm.lib.1 libartd.so
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800439 adb shell start
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700440
441.PHONY: use-dalvik
442use-dalvik:
443 adb root && sleep 3
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800444 adb shell stop
Brian Carlstrom2d27d832014-01-30 13:14:00 -0800445 adb shell setprop persist.sys.dalvik.vm.lib.1 libdvm.so
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800446 adb shell start
447
448.PHONY: use-art-full
449use-art-full:
450 adb root && sleep 3
451 adb shell stop
452 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.dex
453 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.oat
454 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.art
455 adb shell setprop dalvik.vm.dex2oat-flags ""
456 adb shell setprop dalvik.vm.image-dex2oat-flags ""
457 adb shell setprop persist.sys.dalvik.vm.lib.1 libart.so
458 adb shell start
459
460.PHONY: use-art-smart
461use-art-smart:
462 adb root && sleep 3
463 adb shell stop
464 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.dex
465 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.oat
466 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.art
467 adb shell setprop dalvik.vm.dex2oat-flags "--compiler-filter=interpret-only"
468 adb shell setprop dalvik.vm.image-dex2oat-flags ""
469 adb shell setprop persist.sys.dalvik.vm.lib.1 libart.so
470 adb shell start
471
472.PHONY: use-art-interpret-only
473use-art-interpret-only:
474 adb root && sleep 3
475 adb shell stop
476 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.dex
477 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.oat
478 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.art
479 adb shell setprop dalvik.vm.dex2oat-flags "--compiler-filter=interpret-only"
480 adb shell setprop dalvik.vm.image-dex2oat-flags "--compiler-filter=interpret-only"
481 adb shell setprop persist.sys.dalvik.vm.lib.1 libart.so
482 adb shell start
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700483
Jeff Hao4a200f52014-04-01 14:58:49 -0700484.PHONY: use-art-verify-none
485use-art-verify-none:
486 adb root && sleep 3
487 adb shell stop
488 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.dex
489 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.oat
490 adb shell rm $(ART_DALVIK_CACHE_DIR)/*.art
491 adb shell setprop dalvik.vm.dex2oat-flags "--compiler-filter=verify-none"
492 adb shell setprop dalvik.vm.image-dex2oat-flags "--compiler-filter=verify-none"
493 adb shell setprop persist.sys.dalvik.vm.lib.1 libart.so
494 adb shell start
495
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700496########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700497
Brian Carlstrom62e3ee32012-06-18 14:58:55 -0700498endif # !art_dont_bother