blob: a7d41d751659a75a73f29d2f87fb312a44bd9e9a [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)
18include $(CLEAR_VARS)
19
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070020# These can be overridden via the environment or by editing to
21# enable/disable certain build configuration.
22ART_BUILD_TARGET_NDEBUG ?= true
23ART_BUILD_TARGET_DEBUG ?= true
Brian Carlstrom56778d82011-09-11 14:08:17 -070024ifeq ($(HOST_OS),linux)
25 ART_BUILD_HOST_NDEBUG ?= true
26 ART_BUILD_HOST_DEBUG ?= true
27else
28 ART_BUILD_HOST_NDEBUG ?= false
29 ART_BUILD_HOST_DEBUG ?= false
30endif
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070031
Carl Shapiro0e6d1972011-07-06 19:17:39 -070032build_path := $(LOCAL_PATH)/build
Brian Carlstromcdc8de42011-07-19 14:23:17 -070033include $(build_path)/Android.common.mk
34
Carl Shapiro0e6d1972011-07-06 19:17:39 -070035include $(build_path)/Android.libart.mk
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070036include $(build_path)/Android.executable.mk
Carl Shapiro7b216702011-06-17 15:09:26 -070037
Brian Carlstrom16192862011-09-12 17:50:06 -070038include $(build_path)/Android.oat.mk
39
Brian Carlstrom07d579f2011-07-27 13:31:51 -070040include $(build_path)/Android.libarttest.mk
Brian Carlstrombbf1e412011-09-18 14:14:51 -070041include $(build_path)/Android.gtest.mk
42include $(build_path)/Android.oattest.mk
Brian Carlstrom934486c2011-07-12 23:42:50 -070043
44# "m build-art" for quick minimal build
45.PHONY: build-art
46build-art: \
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070047 $(ART_TARGET_EXECUTABLES) \
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -070048 $(ART_TARGET_TEST_EXECUTABLES) \
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070049 $(ART_HOST_EXECUTABLES) \
Carl Shapiro47940d62011-08-13 22:21:30 -070050 $(ART_HOST_TEST_EXECUTABLES)
Brian Carlstrom934486c2011-07-12 23:42:50 -070051
Brian Carlstrom4a96b602011-07-26 16:40:23 -070052# "mm test-art" to build and run all tests on host and device
53.PHONY: test-art
54test-art: test-art-host test-art-target
55
Elliott Hughes2cae5a22011-08-14 14:27:25 -070056define run-host-tests-with
Elliott Hughesb465ab02011-08-24 11:21:21 -070057 $(foreach file,$(sort $(ART_HOST_TEST_EXECUTABLES)),$(1) $(file) &&) true
Elliott Hughes2cae5a22011-08-14 14:27:25 -070058endef
59
Brian Carlstrom16192862011-09-12 17:50:06 -070060ART_HOST_TEST_DEPENDENCIES := $(ART_HOST_TEST_EXECUTABLES) $(ANDROID_HOST_OUT)/framework/core-hostdex.jar $(ART_TEST_OAT_FILES)
61ART_TARGET_TEST_DEPENDENCIES := $(ART_TARGET_TEST_EXECUTABLES) $(ANDROID_PRODUCT_OUT)/system/framework/core.jar $(ART_TEST_OAT_FILES)
Brian Carlstrom9f30b382011-08-28 22:41:38 -070062
Brian Carlstrom934486c2011-07-12 23:42:50 -070063# "mm test-art-host" to build and run all host tests
64.PHONY: test-art-host
Brian Carlstrom9f30b382011-08-28 22:41:38 -070065test-art-host: $(ART_HOST_TEST_DEPENDENCIES)
Elliott Hughes2cae5a22011-08-14 14:27:25 -070066 $(call run-host-tests-with,)
Brian Carlstrom59848da2011-07-23 20:35:19 -070067
Elliott Hughes5511f212011-08-12 18:07:45 -070068# "mm valgrind-art-host" to build and run all host tests under valgrind.
69.PHONY: valgrind-art-host
Brian Carlstrom9f30b382011-08-28 22:41:38 -070070valgrind-art-host: $(ART_HOST_TEST_DEPENDENCIES)
Elliott Hughes2cae5a22011-08-14 14:27:25 -070071 $(call run-host-tests-with,"valgrind")
72
73# "mm tsan-art-host" to build and run all host tests under tsan.
74.PHONY: tsan-art-host
Brian Carlstrom9f30b382011-08-28 22:41:38 -070075tsan-art-host: $(ART_HOST_TEST_DEPENDENCIES)
Elliott Hughes2cae5a22011-08-14 14:27:25 -070076 $(call run-host-tests-with,"tsan")
Elliott Hughes5511f212011-08-12 18:07:45 -070077
Brian Carlstrom4a96b602011-07-26 16:40:23 -070078# "mm test-art-device" to build and run all target tests
79.PHONY: test-art-target
Brian Carlstrom86927212011-09-15 11:31:11 -070080test-art-target: test-art-target-gtest test-art-target-oat
81
82.PHONY: test-art-target-sync
83test-art-target-sync: $(ART_TARGET_TEST_DEPENDENCIES)
Brian Carlstrom4a96b602011-07-26 16:40:23 -070084 adb remount
85 adb sync
Brian Carlstrom86927212011-09-15 11:31:11 -070086
87.PHONY: test-art-target-gtest
88test-art-target-gtest: test-art-target-sync
89 adb shell touch /sdcard/test-art-target-gtest
90 adb shell rm /sdcard/test-art-target-gtest
91 adb shell sh -c "$(foreach file,$(sort $(ART_TARGET_TEST_EXECUTABLES)), /system/bin/$(notdir $(file)) &&) touch /sdcard/test-art-target-gtest"
Brian Carlstromf867b6f2011-09-16 12:17:25 -070092 $(hide) (adb pull /sdcard/test-art-target-gtest /tmp/ && echo test-art-target-gtest PASSED) || echo test-art-target-gtest FAILED
Brian Carlstrom86927212011-09-15 11:31:11 -070093 $(hide) rm /tmp/test-art-target-gtest
94
95.PHONY: test-art-target-oat
Brian Carlstrombbf1e412011-09-18 14:14:51 -070096test-art-target-oat: $(ART_TEST_OAT_TARGETS)
Brian Carlstrom4a96b602011-07-26 16:40:23 -070097
Brian Carlstrom78128a62011-09-15 17:21:19 -070098.PHONY: dump-boot-oat
99dump-boot-oat: $(TARGET_BOOT_OAT) $(OATDUMP)
100 $(OATDUMP) $(addprefix --dex-file=,$(TARGET_BOOT_DEX)) --image=$(TARGET_BOOT_OAT) --strip-prefix=$(PRODUCT_OUT)
101
Brian Carlstrom59848da2011-07-23 20:35:19 -0700102# "mm cpplint-art" to style check art source files
103.PHONY: cpplint-art
104cpplint-art:
105 $(LOCAL_PATH)/tools/cpplint.py $(LOCAL_PATH)/src/*.h $(LOCAL_PATH)/src/*.cc