blob: 2dd2d8f8cc3129d6a7cd0b0678479cdc33a04f1b [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
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070030include $(build_path)/Android.executable.mk
Carl Shapiro7b216702011-06-17 15:09:26 -070031
Brian Carlstrom16192862011-09-12 17:50:06 -070032include $(build_path)/Android.oat.mk
33
Brian Carlstrom07d579f2011-07-27 13:31:51 -070034include $(build_path)/Android.libarttest.mk
Brian Carlstrombbf1e412011-09-18 14:14:51 -070035include $(build_path)/Android.gtest.mk
36include $(build_path)/Android.oattest.mk
Brian Carlstrom934486c2011-07-12 23:42:50 -070037
38# "m build-art" for quick minimal build
39.PHONY: build-art
40build-art: \
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070041 $(ART_TARGET_EXECUTABLES) \
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -070042 $(ART_TARGET_TEST_EXECUTABLES) \
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070043 $(ART_HOST_EXECUTABLES) \
Carl Shapiro47940d62011-08-13 22:21:30 -070044 $(ART_HOST_TEST_EXECUTABLES)
Brian Carlstrom934486c2011-07-12 23:42:50 -070045
Brian Carlstrom4a96b602011-07-26 16:40:23 -070046# "mm test-art" to build and run all tests on host and device
47.PHONY: test-art
48test-art: test-art-host test-art-target
Brian Carlstrom395520e2011-09-25 19:35:00 -070049 @echo test-art PASSED
Brian Carlstrom4a96b602011-07-26 16:40:23 -070050
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -070051.PHONY: test-art-gtest
52test-art-gtest: test-art-host test-art-target-gtest
53 @echo test-art-gtest PASSED
54
Elliott Hughes2cae5a22011-08-14 14:27:25 -070055define run-host-tests-with
Elliott Hughesb465ab02011-08-24 11:21:21 -070056 $(foreach file,$(sort $(ART_HOST_TEST_EXECUTABLES)),$(1) $(file) &&) true
Elliott Hughes2cae5a22011-08-14 14:27:25 -070057endef
58
Elliott Hughes6cc332e2012-01-20 22:59:20 -080059ART_HOST_DEPENDENCIES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_JAVA_LIBRARIES)/core-hostdex.jar
60ifeq ($(HOST_OS),linux)
61 ART_HOST_DEPENDENCIES += $(HOST_OUT_SHARED_LIBRARIES)/libjavacore.so
62else
63 ART_HOST_DEPENDENCIES += $(HOST_OUT_SHARED_LIBRARIES)/libjavacore.dylib
64endif
65
66ART_TARGET_DEPENDENCIES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_JAVA_LIBRARIES)/core.jar $(TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so
Brian Carlstrom0796af02011-10-12 14:31:45 -070067
Brian Carlstrom04941d92012-02-19 01:47:51 -080068ART_HOST_TEST_DEPENDENCIES := $(ART_HOST_DEPENDENCIES) $(ART_HOST_TEST_EXECUTABLES) $(ART_TEST_DEX_FILES)
69ART_TARGET_TEST_DEPENDENCIES := $(ART_TARGET_DEPENDENCIES) $(ART_TARGET_TEST_EXECUTABLES) $(ART_TEST_DEX_FILES)
Brian Carlstrom9f30b382011-08-28 22:41:38 -070070
Brian Carlstrombc2f3e32011-09-22 17:16:54 -070071########################################################################
72# host test targets
73
Brian Carlstrom934486c2011-07-12 23:42:50 -070074# "mm test-art-host" to build and run all host tests
75.PHONY: test-art-host
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -070076test-art-host: $(ART_HOST_TEST_DEPENDENCIES) $(ART_HOST_TEST_TARGETS)
Brian Carlstrom395520e2011-09-25 19:35:00 -070077 @echo test-art-host PASSED
Brian Carlstrom59848da2011-07-23 20:35:19 -070078
Elliott Hughes5511f212011-08-12 18:07:45 -070079# "mm valgrind-art-host" to build and run all host tests under valgrind.
80.PHONY: valgrind-art-host
Brian Carlstrom9f30b382011-08-28 22:41:38 -070081valgrind-art-host: $(ART_HOST_TEST_DEPENDENCIES)
Elliott Hughes4d6850c2012-01-18 15:55:06 -080082 $(call run-host-tests-with,valgrind --leak-check=full)
Brian Carlstrom395520e2011-09-25 19:35:00 -070083 @echo valgrind-art-host PASSED
Elliott Hughes2cae5a22011-08-14 14:27:25 -070084
85# "mm tsan-art-host" to build and run all host tests under tsan.
86.PHONY: tsan-art-host
Brian Carlstrom9f30b382011-08-28 22:41:38 -070087tsan-art-host: $(ART_HOST_TEST_DEPENDENCIES)
Elliott Hughes2cae5a22011-08-14 14:27:25 -070088 $(call run-host-tests-with,"tsan")
Brian Carlstrom395520e2011-09-25 19:35:00 -070089 @echo tsan-art-host PASSED
Elliott Hughes5511f212011-08-12 18:07:45 -070090
Brian Carlstrombc2f3e32011-09-22 17:16:54 -070091########################################################################
92# target test targets
93
94# "mm test-art-target" to build and run all target tests
Brian Carlstrom4a96b602011-07-26 16:40:23 -070095.PHONY: test-art-target
Brian Carlstrome24fa612011-09-29 00:53:55 -070096test-art-target: test-art-target-gtest test-art-target-oat test-art-target-run-test
Brian Carlstrom395520e2011-09-25 19:35:00 -070097 @echo test-art-target PASSED
Brian Carlstrom86927212011-09-15 11:31:11 -070098
99.PHONY: test-art-target-sync
Brian Carlstromb9cc1ca2012-01-27 00:57:42 -0800100test-art-target-sync: $(ART_TARGET_TEST_DEPENDENCIES) $(ART_TEST_OUT)/libarttest.so
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700101 adb remount
102 adb sync
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700103 adb shell mkdir -p $(ART_TEST_DIR)
Brian Carlstrom86927212011-09-15 11:31:11 -0700104
105.PHONY: test-art-target-gtest
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700106test-art-target-gtest: $(ART_TARGET_TEST_TARGETS)
Brian Carlstrom86927212011-09-15 11:31:11 -0700107
108.PHONY: test-art-target-oat
Brian Carlstrombbf1e412011-09-18 14:14:51 -0700109test-art-target-oat: $(ART_TEST_OAT_TARGETS)
Brian Carlstrom395520e2011-09-25 19:35:00 -0700110 @echo test-art-target-oat PASSED
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700111
Brian Carlstrome24fa612011-09-29 00:53:55 -0700112.PHONY: test-art-target-run-test
113test-art-target-run-test: test-art-target-run-test-002
114 @echo test-art-target-run-test PASSED
115
116.PHONY: test-art-target-run-test-002
Brian Carlstrom58ae9412011-10-04 00:56:06 -0700117test-art-target-run-test-002: test-art-target-sync
Brian Carlstrome24fa612011-09-29 00:53:55 -0700118 art/test/run-test 002
119 @echo test-art-target-run-test-002 PASSED
120
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700121########################################################################
Brian Carlstrom04941d92012-02-19 01:47:51 -0800122# oat-target and oat-target-sync targets
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700123
Brian Carlstrom04941d92012-02-19 01:47:51 -0800124OAT_TARGET_TARGETS :=
125
126# $(1): input jar or apk target location
127define declare-oat-target-target
128.PHONY: oat-target-$(1)
129oat-target-$(1): $(PRODUCT_OUT)/$(1) $(TARGET_BOOT_IMG_OUT) $(DEX2OAT_DEPENDENCY)
Brian Carlstrombf2cb162012-02-27 17:49:19 -0800130 $(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 -0800131
132OAT_TARGET_TARGETS += oat-target-$(1)
Brian Carlstroma9f19782011-10-13 00:14:47 -0700133endef
134
Brian Carlstrombd411022012-02-07 12:09:09 -0800135$(foreach file,\
136 $(filter-out\
137 $(TARGET_BOOT_DEX),\
138 $(wildcard $(TARGET_OUT_APPS)/*.apk) $(wildcard $(TARGET_OUT_JAVA_LIBRARIES)/*.jar)),\
Brian Carlstrom04941d92012-02-19 01:47:51 -0800139 $(eval $(call declare-oat-target-target,$(subst $(PRODUCT_OUT)/,,$(file)))))
140
141.PHONY: oat-target
142oat-target: $(ART_TARGET_DEPENDENCIES) $(TARGET_BOOT_OAT_OUT) $(OAT_TARGET_TARGETS)
Ian Rogersbeb60e22012-01-31 10:40:40 -0800143
Brian Carlstroma6cc8932012-01-04 14:44:07 -0800144.PHONY: oat-target-sync
Brian Carlstrom04941d92012-02-19 01:47:51 -0800145oat-target-sync: oat-target
Brian Carlstrom0796af02011-10-12 14:31:45 -0700146 adb remount
147 adb sync
148
Brian Carlstrom76aa0c02011-10-11 15:29:43 -0700149########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700150# oatdump targets
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700151
Brian Carlstrom395520e2011-09-25 19:35:00 -0700152.PHONY: dump-oat
Brian Carlstrom03a20ba2011-10-13 10:24:13 -0700153dump-oat: dump-oat-core dump-oat-boot dump-oat-Calculator
Brian Carlstrom395520e2011-09-25 19:35:00 -0700154
Brian Carlstrome10b6972011-09-26 13:49:03 -0700155.PHONY: dump-oat-core
Brian Carlstroma004aa92012-02-08 18:05:09 -0800156dump-oat-core: $(TARGET_CORE_OAT_OUT) $(OATDUMP)
157 $(OATDUMP) --image=$(TARGET_CORE_IMG_OUT) --host-prefix=$(PRODUCT_OUT) --output=/tmp/core.oatdump.txt
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700158 @echo Output in /tmp/core.oatdump.txt
159
Brian Carlstrome10b6972011-09-26 13:49:03 -0700160.PHONY: dump-oat-boot
Brian Carlstroma004aa92012-02-08 18:05:09 -0800161dump-oat-boot: $(TARGET_BOOT_OAT_OUT) $(OATDUMP)
162 $(OATDUMP) --image=$(TARGET_BOOT_IMG_OUT) --host-prefix=$(PRODUCT_OUT) --output=/tmp/boot.oatdump.txt
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700163 @echo Output in /tmp/boot.oatdump.txt
Brian Carlstrom78128a62011-09-15 17:21:19 -0700164
Brian Carlstrome10b6972011-09-26 13:49:03 -0700165.PHONY: dump-oat-Calculator
Brian Carlstroma004aa92012-02-08 18:05:09 -0800166dump-oat-Calculator: $(call art-cache-oat,system/app/Calculator.apk) $(TARGET_BOOT_OAT_OUT) $(OATDUMP)
Brian Carlstroma6cc8932012-01-04 14:44:07 -0800167 $(OATDUMP) --oat-file=$< --boot-image=$(TARGET_BOOT_IMG) --host-prefix=$(PRODUCT_OUT) --output=/tmp/Calculator.oatdump.txt
Brian Carlstrome10b6972011-09-26 13:49:03 -0700168 @echo Output in /tmp/Calculator.oatdump.txt
169
170
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700171########################################################################
Brian Carlstromfab62932011-10-27 21:47:49 -0700172# clean-oat target
173#
174
175.PHONY: clean-oat
176clean-oat:
Brian Carlstroma004aa92012-02-08 18:05:09 -0800177 rm -f $(ART_NATIVETEST_OUT)/*.oat
178 rm -f $(ART_NATIVETEST_OUT)/*.art
Brian Carlstromfab62932011-10-27 21:47:49 -0700179 rm -f $(ART_TEST_OUT)/*.oat
Elliott Hughes55124a52011-12-08 15:52:52 -0800180 rm -f $(ART_TEST_OUT)/*.art
Brian Carlstromfab62932011-10-27 21:47:49 -0700181 rm -f $(ART_CACHE_OUT)/*.oat
Elliott Hughes55124a52011-12-08 15:52:52 -0800182 rm -f $(ART_CACHE_OUT)/*.art
Brian Carlstroma004aa92012-02-08 18:05:09 -0800183 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.oat
184 rm -f $(HOST_OUT_JAVA_LIBRARIES)/*.art
185 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.oat
186 rm -f $(TARGET_OUT_JAVA_LIBRARIES)/*.art
187 rm -f $(TARGET_OUT_APPS)/*.oat
188 adb shell rm $(ART_NATIVETEST_DIR)/*.oat
189 adb shell rm $(ART_NATIVETEST_DIR)/*.art
Brian Carlstromfab62932011-10-27 21:47:49 -0700190 adb shell rm $(ART_TEST_DIR)/*.oat
Elliott Hughes55124a52011-12-08 15:52:52 -0800191 adb shell rm $(ART_TEST_DIR)/*.art
Brian Carlstromfab62932011-10-27 21:47:49 -0700192 adb shell rm $(ART_CACHE_DIR)/*.oat
Elliott Hughes55124a52011-12-08 15:52:52 -0800193 adb shell rm $(ART_CACHE_DIR)/*.art
Brian Carlstroma004aa92012-02-08 18:05:09 -0800194 adb shell rm $(DEXPREOPT_BOOT_JAR_DIR)/*.oat
195 adb shell rm $(DEXPREOPT_BOOT_JAR_DIR)/*.art
196 adb shell rm system/app/*.oat
Brian Carlstromfab62932011-10-27 21:47:49 -0700197
198########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700199# cpplint target
200
Brian Carlstrom59848da2011-07-23 20:35:19 -0700201# "mm cpplint-art" to style check art source files
202.PHONY: cpplint-art
203cpplint-art:
Elliott Hughesa51a3dd2011-10-17 15:19:26 -0700204 ./art/tools/cpplint.py \
205 --filter=-whitespace/comments,-whitespace/line_length,-build/include,-build/header_guard,-readability/streams,-readability/todo,-runtime/references \
Elliott Hughes362f9bc2011-10-17 18:56:41 -0700206 $(ANDROID_BUILD_TOP)/art/src/*.h $(ANDROID_BUILD_TOP)/art/src/*.cc
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700207
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700208########################################################################
209
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700210include $(call all-makefiles-under,$(LOCAL_PATH))