blob: 4eac005f3788fa30e33d47ba5ad6bf94d5c12859 [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 Carlstrom4b620ff2011-09-11 01:11:01 -070019# These can be overridden via the environment or by editing to
20# enable/disable certain build configuration.
Brian Carlstromcb91f1a2013-02-01 12:55:09 -080021#
22# For example, to disable everything but the host debug build you use:
23#
24# (export ART_BUILD_TARGET_NDEBUG=false && export ART_BUILD_TARGET_DEBUG=false && export ART_BUILD_HOST_NDEBUG=false && ...)
25#
26# Beware that tests may use the non-debug build for performance, notable 055-enum-performance
27#
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070028ART_BUILD_TARGET_NDEBUG ?= true
29ART_BUILD_TARGET_DEBUG ?= true
Brian Carlstrom8ce86472011-12-15 13:50:38 -080030ART_BUILD_HOST_NDEBUG ?= true
31ART_BUILD_HOST_DEBUG ?= true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070032
Brian Carlstromcb91f1a2013-02-01 12:55:09 -080033ifeq ($(ART_BUILD_TARGET_NDEBUG),false)
34$(info Disabling ART_BUILD_TARGET_NDEBUG)
35endif
36ifeq ($(ART_BUILD_TARGET_DEBUG),false)
37$(info Disabling ART_BUILD_TARGET_DEBUG)
38endif
39ifeq ($(ART_BUILD_HOST_NDEBUG),false)
40$(info Disabling ART_BUILD_HOST_NDEBUG)
41endif
42ifeq ($(ART_BUILD_HOST_DEBUG),false)
43$(info Disabling ART_BUILD_HOST_DEBUG)
44endif
45
Elliott Hughesf1eedca2012-04-20 16:00:32 -070046ART_HOST_SHLIB_EXTENSION := $(HOST_SHLIB_SUFFIX)
47ART_HOST_SHLIB_EXTENSION ?= .so
48
Carl Shapiro0e6d1972011-07-06 19:17:39 -070049build_path := $(LOCAL_PATH)/build
Brian Carlstromcdc8de42011-07-19 14:23:17 -070050include $(build_path)/Android.common.mk
51
Brian Carlstromb2793372012-03-17 18:27:16 -070052########################################################################
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070053# clean-oat targets
54#
55
56# following the example of build's dont_bother for clean targets
57ifneq (,$(filter clean-oat,$(MAKECMDGOALS)))
58art_dont_bother := true
59endif
60ifneq (,$(filter clean-oat-host,$(MAKECMDGOALS)))
61art_dont_bother := true
62endif
63ifneq (,$(filter clean-oat-target,$(MAKECMDGOALS)))
64art_dont_bother := true
65endif
66
67.PHONY: clean-oat
68clean-oat: clean-oat-host clean-oat-target
69
70.PHONY: clean-oat-host
71clean-oat-host:
Brian Carlstrom999cd432013-06-22 23:08:53 -070072 rm -f $(ART_NATIVETEST_OUT)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070073 rm -f $(ART_NATIVETEST_OUT)/*.oat
74 rm -f $(ART_NATIVETEST_OUT)/*.art
Brian Carlstrom999cd432013-06-22 23:08:53 -070075 rm -f $(ART_TEST_OUT)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070076 rm -f $(ART_TEST_OUT)/*.oat
77 rm -f $(ART_TEST_OUT)/*.art
Brian Carlstrom30e2ea42013-06-19 23:25:37 -070078 rm -f $(DALVIK_CACHE_OUT)/*@classes.dex
Brian Carlstrom7675e162013-06-10 16:18:04 -070079 rm -f $(DALVIK_CACHE_OUT)/*.oat
80 rm -f $(DALVIK_CACHE_OUT)/*.art
Brian Carlstrom999cd432013-06-22 23:08:53 -070081 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070082 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.oat
83 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.art
Brian Carlstrom999cd432013-06-22 23:08:53 -070084 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070085 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.oat
86 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.art
Brian Carlstrom999cd432013-06-22 23:08:53 -070087 rm -f $(TARGET_OUT_UNSTRIPPED)/system/framework/*.odex
Brian Carlstrom1d6848c2013-03-06 15:03:52 -080088 rm -f $(TARGET_OUT_UNSTRIPPED)/system/framework/*.oat
Brian Carlstrom999cd432013-06-22 23:08:53 -070089 rm -f $(TARGET_OUT_APPS)/*.odex
Brian Carlstrom30e2ea42013-06-19 23:25:37 -070090 rm -f $(TARGET_OUT_INTERMEDIATES)/JAVA_LIBRARIES/*_intermediates/javalib.odex
91 rm -f $(TARGET_OUT_INTERMEDIATES)/APPS/*_intermediates/*.odex
92 rm -rf /tmp/test-*/dalvik-cache/*@classes.dex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070093
94.PHONY: clean-oat-target
95clean-oat-target:
96 adb remount
Brian Carlstrom30e2ea42013-06-19 23:25:37 -070097 adb shell rm $(ART_NATIVETEST_DIR)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070098 adb shell rm $(ART_NATIVETEST_DIR)/*.oat
99 adb shell rm $(ART_NATIVETEST_DIR)/*.art
Brian Carlstrom30e2ea42013-06-19 23:25:37 -0700100 adb shell rm $(ART_TEST_DIR)/*.odex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -0700101 adb shell rm $(ART_TEST_DIR)/*.oat
102 adb shell rm $(ART_TEST_DIR)/*.art
Brian Carlstrom30e2ea42013-06-19 23:25:37 -0700103 adb shell rm $(DALVIK_CACHE_DIR)/*.dex
Brian Carlstrom7675e162013-06-10 16:18:04 -0700104 adb shell rm $(DALVIK_CACHE_DIR)/*.oat
105 adb shell rm $(DALVIK_CACHE_DIR)/*.art
Brian Carlstrom62e3ee32012-06-18 14:58:55 -0700106 adb shell rm $(DEXPREOPT_BOOT_JAR_DIR)/*.oat
107 adb shell rm $(DEXPREOPT_BOOT_JAR_DIR)/*.art
Brian Carlstrom30e2ea42013-06-19 23:25:37 -0700108 adb shell rm system/app/*.odex
109 adb shell rm data/run-test/test-*/dalvik-cache/*@classes.dex
Brian Carlstrom62e3ee32012-06-18 14:58:55 -0700110
Brian Carlstrom35bd61a2013-06-18 14:49:30 -0700111# we aren't building most of art on darwin right now, but we do need to build new dalvikvm
Brian Carlstrom13aebfc2013-05-22 10:15:25 -0700112ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-x86)
113art_dont_bother := true
Brian Carlstrom35bd61a2013-06-18 14:49:30 -0700114include $(LOCAL_PATH)/dalvikvm/Android.mk
Brian Carlstrom13aebfc2013-05-22 10:15:25 -0700115endif
116
Brian Carlstrom62e3ee32012-06-18 14:58:55 -0700117ifneq ($(art_dont_bother),true)
118
119########################################################################
Brian Carlstromb2793372012-03-17 18:27:16 -0700120# product targets
Carl Shapiro0e6d1972011-07-06 19:17:39 -0700121include $(build_path)/Android.libart.mk
Elliott Hughesb3bd5f02012-03-08 21:05:27 -0800122include $(build_path)/Android.libart-compiler.mk
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700123include $(build_path)/Android.executable.mk
Brian Carlstromb2793372012-03-17 18:27:16 -0700124include $(build_path)/Android.oat.mk
Carl Shapiro7b216702011-06-17 15:09:26 -0700125
Brian Carlstromb2793372012-03-17 18:27:16 -0700126# ART_HOST_DEPENDENCIES depends on Android.executable.mk above for ART_HOST_EXECUTABLES
Brian Carlstrom15803792012-03-13 00:53:08 -0700127ART_HOST_DEPENDENCIES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_JAVA_LIBRARIES)/core-hostdex.jar
Elliott Hughesf1eedca2012-04-20 16:00:32 -0700128ART_HOST_DEPENDENCIES += $(HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION)
Brian Carlstrom15803792012-03-13 00:53:08 -0700129ART_TARGET_DEPENDENCIES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_JAVA_LIBRARIES)/core.jar $(TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so
130
Brian Carlstromb2793372012-03-17 18:27:16 -0700131########################################################################
132# test targets
Brian Carlstrom15803792012-03-13 00:53:08 -0700133
Brian Carlstromb2793372012-03-17 18:27:16 -0700134include $(build_path)/Android.oattest.mk
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700135include $(build_path)/Android.gtest.mk
Brian Carlstromb2793372012-03-17 18:27:16 -0700136
137# The ART_*_TEST_DEPENDENCIES definitions:
138# - depend on Android.oattest.mk above for ART_TEST_*_DEX_FILES
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700139# - depend on Android.gtest.mk above for ART_*_TEST_EXECUTABLES
Brian Carlstromb2793372012-03-17 18:27:16 -0700140ART_HOST_TEST_DEPENDENCIES := $(ART_HOST_DEPENDENCIES) $(ART_HOST_TEST_EXECUTABLES) $(ART_TEST_HOST_DEX_FILES) $(HOST_CORE_IMG_OUT)
141ART_TARGET_TEST_DEPENDENCIES := $(ART_TARGET_DEPENDENCIES) $(ART_TARGET_TEST_EXECUTABLES) $(ART_TEST_TARGET_DEX_FILES) $(TARGET_CORE_IMG_OUT)
Brian Carlstrom16192862011-09-12 17:50:06 -0700142
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700143include $(build_path)/Android.libarttest.mk
Brian Carlstrom934486c2011-07-12 23:42:50 -0700144
145# "m build-art" for quick minimal build
146.PHONY: build-art
147build-art: \
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700148 $(ART_TARGET_EXECUTABLES) \
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -0700149 $(ART_TARGET_TEST_EXECUTABLES) \
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700150 $(ART_HOST_EXECUTABLES) \
Carl Shapiro47940d62011-08-13 22:21:30 -0700151 $(ART_HOST_TEST_EXECUTABLES)
Brian Carlstrom934486c2011-07-12 23:42:50 -0700152
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700153# "mm test-art" to build and run all tests on host and device
154.PHONY: test-art
155test-art: test-art-host test-art-target
Brian Carlstrom395520e2011-09-25 19:35:00 -0700156 @echo test-art PASSED
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700157
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700158.PHONY: test-art-gtest
Brian Carlstromb2793372012-03-17 18:27:16 -0700159test-art-gtest: test-art-host-gtest test-art-target-gtest
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700160 @echo test-art-gtest PASSED
161
Brian Carlstromb2793372012-03-17 18:27:16 -0700162.PHONY: test-art-oat
Ian Rogers85d9ba62013-01-16 22:32:12 -0800163test-art-oat: test-art-host-oat test-art-target-oat test-art-host-interpreter-oat
Brian Carlstromb2793372012-03-17 18:27:16 -0700164 @echo test-art-oat PASSED
Elliott Hughes2cae5a22011-08-14 14:27:25 -0700165
Brian Carlstrom08981ab2012-05-25 18:40:15 -0700166.PHONY: test-art-run-test
Ian Rogers85d9ba62013-01-16 22:32:12 -0800167test-art-run-test: test-art-host-run-test test-art-target-run-test test-art-host-interpreter-run-test
Brian Carlstrom08981ab2012-05-25 18:40:15 -0700168 @echo test-art-run-test PASSED
169
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700170########################################################################
171# host test targets
172
Brian Carlstrom934486c2011-07-12 23:42:50 -0700173# "mm test-art-host" to build and run all host tests
174.PHONY: test-art-host
Ian Rogers85d9ba62013-01-16 22:32:12 -0800175test-art-host: test-art-host-gtest test-art-host-oat test-art-host-run-test test-art-host-interpreter
Brian Carlstrom395520e2011-09-25 19:35:00 -0700176 @echo test-art-host PASSED
Brian Carlstrom59848da2011-07-23 20:35:19 -0700177
Ian Rogers85d9ba62013-01-16 22:32:12 -0800178.PHONY: test-art-host-interpreter
179test-art-host-interpreter: test-art-host-interpreter-oat test-art-host-interpreter-run-test
180 @echo test-art-host-interpreter PASSED
181
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700182.PHONY: test-art-host-dependencies
Brian Carlstrom58805e42013-03-31 01:19:24 -0700183test-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 -0700184
Brian Carlstromb2793372012-03-17 18:27:16 -0700185.PHONY: test-art-host-gtest
186test-art-host-gtest: $(ART_HOST_TEST_TARGETS)
187 @echo test-art-host-gtest PASSED
Elliott Hughes2cae5a22011-08-14 14:27:25 -0700188
Brian Carlstromb2793372012-03-17 18:27:16 -0700189define run-host-gtests-with
190 $(foreach file,$(sort $(ART_HOST_TEST_EXECUTABLES)),$(1) $(file) &&) true
191endef
192
193# "mm valgrind-test-art-host-gtest" to build and run the host gtests under valgrind.
194.PHONY: valgrind-test-art-host-gtest
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700195valgrind-test-art-host-gtest: test-art-host-dependencies
Brian Carlstromb2793372012-03-17 18:27:16 -0700196 $(call run-host-gtests-with,valgrind --leak-check=full)
197 @echo valgrind-test-art-host-gtest PASSED
198
Brian Carlstromb2793372012-03-17 18:27:16 -0700199.PHONY: test-art-host-oat
200test-art-host-oat: $(ART_TEST_HOST_OAT_TARGETS)
201 @echo test-art-host-oat PASSED
Elliott Hughes5511f212011-08-12 18:07:45 -0700202
Ian Rogers85d9ba62013-01-16 22:32:12 -0800203.PHONY: test-art-host-interpreter-oat
204test-art-host-interpreter-oat: $(ART_TEST_HOST_INTERPRETER_OAT_TARGETS)
205 @echo test-art-host-interpreter-oat PASSED
206
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700207define declare-test-art-host-run-test
208.PHONY: test-art-host-run-test-$(1)
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700209test-art-host-run-test-$(1): test-art-host-dependencies
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700210 art/test/run-test --host $(1)
211 @echo test-art-host-run-test-$(1) PASSED
212
213TEST_ART_HOST_RUN_TEST_TARGETS += test-art-host-run-test-$(1)
Ian Rogers27cedf82012-11-21 11:42:43 -0800214
215.PHONY: test-art-host-interpreter-run-test-$(1)
216test-art-host-interpreter-run-test-$(1): test-art-host-dependencies
217 art/test/run-test --host --interpreter $(1)
218 @echo test-art-host-interpreter-run-test-$(1) PASSED
219
220TEST_ART_HOST_INTERPRETER_RUN_TEST_TARGETS += test-art-host-interpreter-run-test-$(1)
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700221endef
222
Elliott Hughes84a5bb42012-05-16 17:52:15 -0700223$(foreach test, $(wildcard art/test/[0-9]*), $(eval $(call declare-test-art-host-run-test,$(notdir $(test)))))
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700224
225.PHONY: test-art-host-run-test
226test-art-host-run-test: $(TEST_ART_HOST_RUN_TEST_TARGETS)
227 @echo test-art-host-run-test PASSED
228
Ian Rogers27cedf82012-11-21 11:42:43 -0800229.PHONY: test-art-host-interpreter-run-test
230test-art-host-interpreter-run-test: $(TEST_ART_HOST_INTERPRETER_RUN_TEST_TARGETS)
231 @echo test-art-host-interpreter-run-test PASSED
232
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700233########################################################################
234# target test targets
235
236# "mm test-art-target" to build and run all target tests
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700237.PHONY: test-art-target
Brian Carlstrome24fa612011-09-29 00:53:55 -0700238test-art-target: test-art-target-gtest test-art-target-oat test-art-target-run-test
Brian Carlstrom395520e2011-09-25 19:35:00 -0700239 @echo test-art-target PASSED
Brian Carlstrom86927212011-09-15 11:31:11 -0700240
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700241.PHONY: test-art-target-dependencies
242test-art-target-dependencies: $(ART_TARGET_TEST_DEPENDENCIES) $(ART_TEST_OUT)/libarttest.so
243
Brian Carlstrom86927212011-09-15 11:31:11 -0700244.PHONY: test-art-target-sync
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700245test-art-target-sync: test-art-target-dependencies
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700246 adb remount
247 adb sync
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700248 adb shell mkdir -p $(ART_TEST_DIR)
Brian Carlstrom86927212011-09-15 11:31:11 -0700249
250.PHONY: test-art-target-gtest
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700251test-art-target-gtest: $(ART_TARGET_TEST_TARGETS)
Brian Carlstrom86927212011-09-15 11:31:11 -0700252
253.PHONY: test-art-target-oat
Brian Carlstromb2793372012-03-17 18:27:16 -0700254test-art-target-oat: $(ART_TEST_TARGET_OAT_TARGETS)
Brian Carlstrom395520e2011-09-25 19:35:00 -0700255 @echo test-art-target-oat PASSED
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700256
Brian Carlstrom37c44442012-03-06 22:21:18 -0800257define declare-test-art-target-run-test
258.PHONY: test-art-target-run-test-$(1)
259test-art-target-run-test-$(1): test-art-target-sync
260 art/test/run-test $(1)
261 @echo test-art-target-run-test-$(1) PASSED
Brian Carlstrome24fa612011-09-29 00:53:55 -0700262
Brian Carlstrom37c44442012-03-06 22:21:18 -0800263TEST_ART_TARGET_RUN_TEST_TARGETS += test-art-target-run-test-$(1)
264endef
265
Elliott Hughes84a5bb42012-05-16 17:52:15 -0700266$(foreach test, $(wildcard art/test/[0-9]*), $(eval $(call declare-test-art-target-run-test,$(notdir $(test)))))
Brian Carlstrom37c44442012-03-06 22:21:18 -0800267
268.PHONY: test-art-target-run-test
269test-art-target-run-test: $(TEST_ART_TARGET_RUN_TEST_TARGETS)
270 @echo test-art-target-run-test PASSED
Brian Carlstrome24fa612011-09-29 00:53:55 -0700271
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700272########################################################################
Brian Carlstrom04941d92012-02-19 01:47:51 -0800273# oat-target and oat-target-sync targets
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700274
Brian Carlstrom04941d92012-02-19 01:47:51 -0800275OAT_TARGET_TARGETS :=
276
277# $(1): input jar or apk target location
278define declare-oat-target-target
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700279ifneq (,$(filter $(1),$(addprefix system/app/,$(addsuffix .apk,$(PRODUCT_DEX_PREOPT_PACKAGES_IN_DATA)))))
Brian Carlstrom999cd432013-06-22 23:08:53 -0700280OUT_OAT_FILE := $(call dalvik-cache-out,$(1)/classes.dex)
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700281else
Brian Carlstrom999cd432013-06-22 23:08:53 -0700282OUT_OAT_FILE := $(PRODUCT_OUT)/$(basename $(1)).odex
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700283endif
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700284
285ifeq ($(ONE_SHOT_MAKEFILE),)
Brian Carlstrom90e27412013-03-13 21:51:47 -0700286# ONE_SHOT_MAKEFILE is empty for a top level build and we don't want
287# to define the oat-target-* rules there because they will conflict
288# with the build/core/dex_preopt.mk defined rules.
Brian Carlstrom04941d92012-02-19 01:47:51 -0800289.PHONY: oat-target-$(1)
Brian Carlstrom90e27412013-03-13 21:51:47 -0700290oat-target-$(1):
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700291
292else
293.PHONY: oat-target-$(1)
Shih-wei Liao7eea0e82012-05-28 23:56:21 -0700294oat-target-$(1): $$(OUT_OAT_FILE)
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700295
Shih-wei Liao7eea0e82012-05-28 23:56:21 -0700296$$(OUT_OAT_FILE): $(PRODUCT_OUT)/$(1) $(TARGET_BOOT_IMG_OUT) $(DEX2OAT_DEPENDENCY)
Brian Carlstrom90e27412013-03-13 21:51:47 -0700297 @mkdir -p $$(dir $$@)
Brian Carlstrom3f47c122013-03-07 00:02:40 -0800298 $(DEX2OAT) $(PARALLEL_ART_COMPILE_JOBS) --runtime-arg -Xms64m --runtime-arg -Xmx64m --boot-image=$(TARGET_BOOT_IMG_OUT) --dex-file=$(PRODUCT_OUT)/$(1) --dex-location=/$(1) --oat-file=$$@ --host-prefix=$(PRODUCT_OUT) --instruction-set=$(TARGET_ARCH) --android-root=$(PRODUCT_OUT)/system
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700299
300endif
Brian Carlstrom04941d92012-02-19 01:47:51 -0800301
302OAT_TARGET_TARGETS += oat-target-$(1)
Brian Carlstroma9f19782011-10-13 00:14:47 -0700303endef
304
Brian Carlstrombd411022012-02-07 12:09:09 -0800305$(foreach file,\
306 $(filter-out\
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700307 $(addprefix $(TARGET_OUT_JAVA_LIBRARIES)/,$(addsuffix .jar,$(TARGET_BOOT_JARS))),\
Brian Carlstrombd411022012-02-07 12:09:09 -0800308 $(wildcard $(TARGET_OUT_APPS)/*.apk) $(wildcard $(TARGET_OUT_JAVA_LIBRARIES)/*.jar)),\
Brian Carlstrom04941d92012-02-19 01:47:51 -0800309 $(eval $(call declare-oat-target-target,$(subst $(PRODUCT_OUT)/,,$(file)))))
310
311.PHONY: oat-target
312oat-target: $(ART_TARGET_DEPENDENCIES) $(TARGET_BOOT_OAT_OUT) $(OAT_TARGET_TARGETS)
Ian Rogersbeb60e22012-01-31 10:40:40 -0800313
Brian Carlstroma6cc8932012-01-04 14:44:07 -0800314.PHONY: oat-target-sync
Brian Carlstrom04941d92012-02-19 01:47:51 -0800315oat-target-sync: oat-target
Brian Carlstrom0796af02011-10-12 14:31:45 -0700316 adb remount
317 adb sync
318
Brian Carlstrom76aa0c02011-10-11 15:29:43 -0700319########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700320# oatdump targets
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700321
Brian Carlstrom395520e2011-09-25 19:35:00 -0700322.PHONY: dump-oat
Ian Rogers62d6c772013-02-27 08:32:07 -0800323dump-oat: dump-oat-core dump-oat-boot
Brian Carlstrom395520e2011-09-25 19:35:00 -0700324
Brian Carlstrome10b6972011-09-26 13:49:03 -0700325.PHONY: dump-oat-core
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700326dump-oat-core: dump-oat-core-host dump-oat-core-target
327
328.PHONY: dump-oat-core-host
Brian Carlstrom265091e2013-01-30 14:08:26 -0800329ifeq ($(ART_BUILD_HOST),true)
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700330dump-oat-core-host: $(HOST_CORE_IMG_OUT) $(OATDUMP)
331 $(OATDUMP) --image=$(HOST_CORE_IMG_OUT) --output=/tmp/core.host.oatdump.txt --host-prefix=""
332 @echo Output in /tmp/core.host.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800333endif
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700334
335.PHONY: dump-oat-core-target
Brian Carlstrom265091e2013-01-30 14:08:26 -0800336ifeq ($(ART_BUILD_TARGET),true)
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700337dump-oat-core-target: $(TARGET_CORE_IMG_OUT) $(OATDUMP)
338 $(OATDUMP) --image=$(TARGET_CORE_IMG_OUT) --output=/tmp/core.target.oatdump.txt
339 @echo Output in /tmp/core.target.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800340endif
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700341
Brian Carlstrome10b6972011-09-26 13:49:03 -0700342.PHONY: dump-oat-boot
Brian Carlstrom265091e2013-01-30 14:08:26 -0800343ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700344dump-oat-boot: $(TARGET_BOOT_IMG_OUT) $(OATDUMP)
Brian Carlstromfe487d02012-02-29 18:49:16 -0800345 $(OATDUMP) --image=$(TARGET_BOOT_IMG_OUT) --output=/tmp/boot.oatdump.txt
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700346 @echo Output in /tmp/boot.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800347endif
Brian Carlstrom78128a62011-09-15 17:21:19 -0700348
Brian Carlstrom2e92fd62012-10-18 00:04:10 -0700349.PHONY: dump-oat-Calculator
Brian Carlstrom265091e2013-01-30 14:08:26 -0800350ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Brian Carlstrom30e2ea42013-06-19 23:25:37 -0700351dump-oat-Calculator: $(TARGET_OUT_APPS)/Calculator.odex $(TARGET_BOOT_IMG_OUT) $(OATDUMP)
Brian Carlstrom2e92fd62012-10-18 00:04:10 -0700352 $(OATDUMP) --oat-file=$< --output=/tmp/Calculator.oatdump.txt
353 @echo Output in /tmp/Calculator.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800354endif
Brian Carlstrom2e92fd62012-10-18 00:04:10 -0700355
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700356########################################################################
357# cpplint target
358
Brian Carlstrom59848da2011-07-23 20:35:19 -0700359# "mm cpplint-art" to style check art source files
360.PHONY: cpplint-art
361cpplint-art:
Elliott Hughesa51a3dd2011-10-17 15:19:26 -0700362 ./art/tools/cpplint.py \
Elliott Hughesb25c3f62012-03-26 16:35:06 -0700363 --filter=-whitespace/comments,-whitespace/line_length,-build/include,-build/header_guard,-readability/function,-readability/streams,-readability/todo,-runtime/references \
Elliott Hughes362f9bc2011-10-17 18:56:41 -0700364 $(ANDROID_BUILD_TOP)/art/src/*.h $(ANDROID_BUILD_TOP)/art/src/*.cc
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700365
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700366########################################################################
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700367# targets to switch back and forth from libdvm to libart
368
369.PHONY: use-art
370use-art:
371 adb root && sleep 3
372 adb shell "echo dalvik.vm.lib=libart.so > /data/local.prop"
373 adb shell chmod 644 /data/local.prop
374 adb reboot
375
376.PHONY: use-artd
377use-artd:
378 adb root && sleep 3
379 adb shell "echo dalvik.vm.lib=libartd.so > /data/local.prop"
380 adb shell chmod 644 /data/local.prop
381 adb reboot
382
383.PHONY: use-dalvik
384use-dalvik:
385 adb root && sleep 3
386 adb shell "echo dalvik.vm.lib=libdvm.so > /data/local.prop"
387 adb shell chmod 644 /data/local.prop
388 adb reboot
389
390########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700391
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700392include $(call all-makefiles-under,$(LOCAL_PATH))
Brian Carlstrom62e3ee32012-06-18 14:58:55 -0700393
394endif # !art_dont_bother