blob: 8ecd0f341e0a6804a3fb6d2de574cc1c679d134e [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.
21ART_BUILD_TARGET_NDEBUG ?= true
22ART_BUILD_TARGET_DEBUG ?= true
Brian Carlstrom8ce86472011-12-15 13:50:38 -080023ART_BUILD_HOST_NDEBUG ?= true
24ART_BUILD_HOST_DEBUG ?= true
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070025
Carl Shapiro0e6d1972011-07-06 19:17:39 -070026build_path := $(LOCAL_PATH)/build
Brian Carlstromcdc8de42011-07-19 14:23:17 -070027include $(build_path)/Android.common.mk
28
Carl Shapiro0e6d1972011-07-06 19:17:39 -070029include $(build_path)/Android.libart.mk
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080030include $(build_path)/Android.libart-compiler.mk
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070031include $(build_path)/Android.executable.mk
Carl Shapiro7b216702011-06-17 15:09:26 -070032
Brian Carlstrom15803792012-03-13 00:53:08 -070033# *_DEPENDENCIES depend on Android.executable.mk and are needed by Android.gtest.mk
34ART_HOST_DEPENDENCIES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_JAVA_LIBRARIES)/core-hostdex.jar
35ifeq ($(HOST_OS),linux)
36 ART_HOST_DEPENDENCIES += $(HOST_OUT_SHARED_LIBRARIES)/libjavacore.so
37else
38 ART_HOST_DEPENDENCIES += $(HOST_OUT_SHARED_LIBRARIES)/libjavacore.dylib
39endif
40ART_TARGET_DEPENDENCIES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_JAVA_LIBRARIES)/core.jar $(TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so
41
42ART_HOST_TEST_DEPENDENCIES := $(ART_HOST_DEPENDENCIES) $(ART_HOST_TEST_EXECUTABLES) $(ART_TEST_DEX_FILES)
43ART_TARGET_TEST_DEPENDENCIES := $(ART_TARGET_DEPENDENCIES) $(ART_TARGET_TEST_EXECUTABLES) $(ART_TEST_DEX_FILES)
44
Brian Carlstrom16192862011-09-12 17:50:06 -070045include $(build_path)/Android.oat.mk
46
Brian Carlstrom07d579f2011-07-27 13:31:51 -070047include $(build_path)/Android.libarttest.mk
Brian Carlstrombbf1e412011-09-18 14:14:51 -070048include $(build_path)/Android.gtest.mk
49include $(build_path)/Android.oattest.mk
Brian Carlstrom934486c2011-07-12 23:42:50 -070050
51# "m build-art" for quick minimal build
52.PHONY: build-art
53build-art: \
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070054 $(ART_TARGET_EXECUTABLES) \
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -070055 $(ART_TARGET_TEST_EXECUTABLES) \
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070056 $(ART_HOST_EXECUTABLES) \
Carl Shapiro47940d62011-08-13 22:21:30 -070057 $(ART_HOST_TEST_EXECUTABLES)
Brian Carlstrom934486c2011-07-12 23:42:50 -070058
Brian Carlstrom4a96b602011-07-26 16:40:23 -070059# "mm test-art" to build and run all tests on host and device
60.PHONY: test-art
61test-art: test-art-host test-art-target
Brian Carlstrom395520e2011-09-25 19:35:00 -070062 @echo test-art PASSED
Brian Carlstrom4a96b602011-07-26 16:40:23 -070063
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -070064.PHONY: test-art-gtest
65test-art-gtest: test-art-host test-art-target-gtest
66 @echo test-art-gtest PASSED
67
Elliott Hughes2cae5a22011-08-14 14:27:25 -070068define run-host-tests-with
Elliott Hughesb465ab02011-08-24 11:21:21 -070069 $(foreach file,$(sort $(ART_HOST_TEST_EXECUTABLES)),$(1) $(file) &&) true
Elliott Hughes2cae5a22011-08-14 14:27:25 -070070endef
71
Brian Carlstrombc2f3e32011-09-22 17:16:54 -070072########################################################################
73# host test targets
74
Brian Carlstrom934486c2011-07-12 23:42:50 -070075# "mm test-art-host" to build and run all host tests
76.PHONY: test-art-host
Brian Carlstrom15803792012-03-13 00:53:08 -070077test-art-host: $(ART_HOST_TEST_TARGETS)
Brian Carlstrom395520e2011-09-25 19:35:00 -070078 @echo test-art-host PASSED
Brian Carlstrom59848da2011-07-23 20:35:19 -070079
Elliott Hughes5511f212011-08-12 18:07:45 -070080# "mm valgrind-art-host" to build and run all host tests under valgrind.
81.PHONY: valgrind-art-host
Brian Carlstrom9f30b382011-08-28 22:41:38 -070082valgrind-art-host: $(ART_HOST_TEST_DEPENDENCIES)
Elliott Hughes4d6850c2012-01-18 15:55:06 -080083 $(call run-host-tests-with,valgrind --leak-check=full)
Brian Carlstrom395520e2011-09-25 19:35:00 -070084 @echo valgrind-art-host PASSED
Elliott Hughes2cae5a22011-08-14 14:27:25 -070085
86# "mm tsan-art-host" to build and run all host tests under tsan.
87.PHONY: tsan-art-host
Brian Carlstrom9f30b382011-08-28 22:41:38 -070088tsan-art-host: $(ART_HOST_TEST_DEPENDENCIES)
Elliott Hughes2cae5a22011-08-14 14:27:25 -070089 $(call run-host-tests-with,"tsan")
Brian Carlstrom395520e2011-09-25 19:35:00 -070090 @echo tsan-art-host PASSED
Elliott Hughes5511f212011-08-12 18:07:45 -070091
Brian Carlstrombc2f3e32011-09-22 17:16:54 -070092########################################################################
93# target test targets
94
95# "mm test-art-target" to build and run all target tests
Brian Carlstrom4a96b602011-07-26 16:40:23 -070096.PHONY: test-art-target
Brian Carlstrome24fa612011-09-29 00:53:55 -070097test-art-target: test-art-target-gtest test-art-target-oat test-art-target-run-test
Brian Carlstrom395520e2011-09-25 19:35:00 -070098 @echo test-art-target PASSED
Brian Carlstrom86927212011-09-15 11:31:11 -070099
100.PHONY: test-art-target-sync
Brian Carlstromb9cc1ca2012-01-27 00:57:42 -0800101test-art-target-sync: $(ART_TARGET_TEST_DEPENDENCIES) $(ART_TEST_OUT)/libarttest.so
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700102 adb remount
103 adb sync
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700104 adb shell mkdir -p $(ART_TEST_DIR)
Brian Carlstrom86927212011-09-15 11:31:11 -0700105
106.PHONY: test-art-target-gtest
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700107test-art-target-gtest: $(ART_TARGET_TEST_TARGETS)
Brian Carlstrom86927212011-09-15 11:31:11 -0700108
109.PHONY: test-art-target-oat
Brian Carlstrombbf1e412011-09-18 14:14:51 -0700110test-art-target-oat: $(ART_TEST_OAT_TARGETS)
Brian Carlstrom395520e2011-09-25 19:35:00 -0700111 @echo test-art-target-oat PASSED
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700112
Brian Carlstrom37c44442012-03-06 22:21:18 -0800113define declare-test-art-target-run-test
114.PHONY: test-art-target-run-test-$(1)
115test-art-target-run-test-$(1): test-art-target-sync
116 art/test/run-test $(1)
117 @echo test-art-target-run-test-$(1) PASSED
Brian Carlstrome24fa612011-09-29 00:53:55 -0700118
Brian Carlstrom37c44442012-03-06 22:21:18 -0800119TEST_ART_TARGET_RUN_TEST_TARGETS += test-art-target-run-test-$(1)
120endef
121
122$(foreach test, $(wildcard art/test/0*), $(eval $(call declare-test-art-target-run-test,$(notdir $(test)))))
123
124.PHONY: test-art-target-run-test
125test-art-target-run-test: $(TEST_ART_TARGET_RUN_TEST_TARGETS)
126 @echo test-art-target-run-test PASSED
Brian Carlstrome24fa612011-09-29 00:53:55 -0700127
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700128########################################################################
Brian Carlstrom04941d92012-02-19 01:47:51 -0800129# oat-target and oat-target-sync targets
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700130
Brian Carlstrom04941d92012-02-19 01:47:51 -0800131OAT_TARGET_TARGETS :=
132
133# $(1): input jar or apk target location
134define declare-oat-target-target
135.PHONY: oat-target-$(1)
136oat-target-$(1): $(PRODUCT_OUT)/$(1) $(TARGET_BOOT_IMG_OUT) $(DEX2OAT_DEPENDENCY)
Brian Carlstrombf2cb162012-02-27 17:49:19 -0800137 $(DEX2OAT) --runtime-arg -Xms64m --runtime-arg -Xmx64m --boot-image=$(TARGET_BOOT_IMG_OUT) --dex-file=$(PRODUCT_OUT)/$(1) --dex-location=/$(1) --oat-file=$(call art-cache-out,$(1).oat) --host-prefix=$(PRODUCT_OUT)
Brian Carlstrom04941d92012-02-19 01:47:51 -0800138
139OAT_TARGET_TARGETS += oat-target-$(1)
Brian Carlstroma9f19782011-10-13 00:14:47 -0700140endef
141
Brian Carlstrombd411022012-02-07 12:09:09 -0800142$(foreach file,\
143 $(filter-out\
144 $(TARGET_BOOT_DEX),\
145 $(wildcard $(TARGET_OUT_APPS)/*.apk) $(wildcard $(TARGET_OUT_JAVA_LIBRARIES)/*.jar)),\
Brian Carlstrom04941d92012-02-19 01:47:51 -0800146 $(eval $(call declare-oat-target-target,$(subst $(PRODUCT_OUT)/,,$(file)))))
147
148.PHONY: oat-target
149oat-target: $(ART_TARGET_DEPENDENCIES) $(TARGET_BOOT_OAT_OUT) $(OAT_TARGET_TARGETS)
Ian Rogersbeb60e22012-01-31 10:40:40 -0800150
Brian Carlstroma6cc8932012-01-04 14:44:07 -0800151.PHONY: oat-target-sync
Brian Carlstrom04941d92012-02-19 01:47:51 -0800152oat-target-sync: oat-target
Brian Carlstrom0796af02011-10-12 14:31:45 -0700153 adb remount
154 adb sync
155
Brian Carlstrom76aa0c02011-10-11 15:29:43 -0700156########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700157# oatdump targets
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700158
Brian Carlstrom395520e2011-09-25 19:35:00 -0700159.PHONY: dump-oat
Brian Carlstrom03a20ba2011-10-13 10:24:13 -0700160dump-oat: dump-oat-core dump-oat-boot dump-oat-Calculator
Brian Carlstrom395520e2011-09-25 19:35:00 -0700161
Brian Carlstrome10b6972011-09-26 13:49:03 -0700162.PHONY: dump-oat-core
Brian Carlstroma004aa92012-02-08 18:05:09 -0800163dump-oat-core: $(TARGET_CORE_OAT_OUT) $(OATDUMP)
Brian Carlstromfe487d02012-02-29 18:49:16 -0800164 $(OATDUMP) --image=$(TARGET_CORE_IMG_OUT) --output=/tmp/core.oatdump.txt
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700165 @echo Output in /tmp/core.oatdump.txt
166
Brian Carlstrome10b6972011-09-26 13:49:03 -0700167.PHONY: dump-oat-boot
Brian Carlstroma004aa92012-02-08 18:05:09 -0800168dump-oat-boot: $(TARGET_BOOT_OAT_OUT) $(OATDUMP)
Brian Carlstromfe487d02012-02-29 18:49:16 -0800169 $(OATDUMP) --image=$(TARGET_BOOT_IMG_OUT) --output=/tmp/boot.oatdump.txt
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700170 @echo Output in /tmp/boot.oatdump.txt
Brian Carlstrom78128a62011-09-15 17:21:19 -0700171
Brian Carlstrome10b6972011-09-26 13:49:03 -0700172.PHONY: dump-oat-Calculator
Brian Carlstromfe487d02012-02-29 18:49:16 -0800173dump-oat-Calculator: $(call art-cache-out,system/app/Calculator.apk.oat) $(TARGET_BOOT_IMG_OUT) $(OATDUMP)
174 $(OATDUMP) --oat-file=$< --output=/tmp/Calculator.oatdump.txt
Brian Carlstrome10b6972011-09-26 13:49:03 -0700175 @echo Output in /tmp/Calculator.oatdump.txt
176
177
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700178########################################################################
Brian Carlstromfab62932011-10-27 21:47:49 -0700179# clean-oat target
180#
181
182.PHONY: clean-oat
183clean-oat:
Brian Carlstroma004aa92012-02-08 18:05:09 -0800184 rm -f $(ART_NATIVETEST_OUT)/*.oat
185 rm -f $(ART_NATIVETEST_OUT)/*.art
Brian Carlstromfab62932011-10-27 21:47:49 -0700186 rm -f $(ART_TEST_OUT)/*.oat
Elliott Hughes55124a52011-12-08 15:52:52 -0800187 rm -f $(ART_TEST_OUT)/*.art
Brian Carlstromfab62932011-10-27 21:47:49 -0700188 rm -f $(ART_CACHE_OUT)/*.oat
Elliott Hughes55124a52011-12-08 15:52:52 -0800189 rm -f $(ART_CACHE_OUT)/*.art
Brian Carlstroma004aa92012-02-08 18:05:09 -0800190 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.oat
191 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.art
192 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.oat
193 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.art
194 rm -f $(TARGET_OUT_APPS)/*.oat
195 adb shell rm $(ART_NATIVETEST_DIR)/*.oat
196 adb shell rm $(ART_NATIVETEST_DIR)/*.art
Brian Carlstromfab62932011-10-27 21:47:49 -0700197 adb shell rm $(ART_TEST_DIR)/*.oat
Elliott Hughes55124a52011-12-08 15:52:52 -0800198 adb shell rm $(ART_TEST_DIR)/*.art
Brian Carlstromfab62932011-10-27 21:47:49 -0700199 adb shell rm $(ART_CACHE_DIR)/*.oat
Elliott Hughes55124a52011-12-08 15:52:52 -0800200 adb shell rm $(ART_CACHE_DIR)/*.art
Brian Carlstroma004aa92012-02-08 18:05:09 -0800201 adb shell rm $(DEXPREOPT_BOOT_JAR_DIR)/*.oat
202 adb shell rm $(DEXPREOPT_BOOT_JAR_DIR)/*.art
203 adb shell rm system/app/*.oat
Brian Carlstromfab62932011-10-27 21:47:49 -0700204
205########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700206# cpplint target
207
Brian Carlstrom59848da2011-07-23 20:35:19 -0700208# "mm cpplint-art" to style check art source files
209.PHONY: cpplint-art
210cpplint-art:
Elliott Hughesa51a3dd2011-10-17 15:19:26 -0700211 ./art/tools/cpplint.py \
212 --filter=-whitespace/comments,-whitespace/line_length,-build/include,-build/header_guard,-readability/streams,-readability/todo,-runtime/references \
Elliott Hughes362f9bc2011-10-17 18:56:41 -0700213 $(ANDROID_BUILD_TOP)/art/src/*.h $(ANDROID_BUILD_TOP)/art/src/*.cc
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700214
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700215########################################################################
216
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700217include $(call all-makefiles-under,$(LOCAL_PATH))