Home | History | Annotate | Download | only in art
      1 #
      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 
     17 LOCAL_PATH := $(call my-dir)
     18 
     19 art_path := $(LOCAL_PATH)
     20 
     21 ########################################################################
     22 # clean-oat rules
     23 #
     24 
     25 include $(art_path)/build/Android.common_path.mk
     26 include $(art_path)/build/Android.oat.mk
     27 
     28 # Following the example of build's dont_bother for clean targets.
     29 art_dont_bother := false
     30 ifneq (,$(filter clean-oat%,$(MAKECMDGOALS)))
     31   art_dont_bother := true
     32 endif
     33 
     34 # Don't bother with tests unless there is a test-art*, build-art*, or related target.
     35 art_test_bother := false
     36 ifneq (,$(filter tests test-art% valgrind-test-art% build-art% checkbuild,$(MAKECMDGOALS)))
     37   art_test_bother := true
     38 endif
     39 
     40 .PHONY: clean-oat
     41 clean-oat: clean-oat-host clean-oat-target
     42 
     43 .PHONY: clean-oat-host
     44 clean-oat-host:
     45 	find $(OUT_DIR) -name "*.oat" -o -name "*.odex" -o -name "*.art" | xargs rm -f
     46 ifneq ($(TMPDIR),)
     47 	rm -rf $(TMPDIR)/$(USER)/test-*/dalvik-cache/*
     48 	rm -rf $(TMPDIR)/android-data/dalvik-cache/*
     49 else
     50 	rm -rf /tmp/$(USER)/test-*/dalvik-cache/*
     51 	rm -rf /tmp/android-data/dalvik-cache/*
     52 endif
     53 
     54 .PHONY: clean-oat-target
     55 clean-oat-target:
     56 	adb root
     57 	adb wait-for-device remount
     58 	adb shell rm -rf $(ART_TARGET_NATIVETEST_DIR)
     59 	adb shell rm -rf $(ART_TARGET_TEST_DIR)
     60 	adb shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/*/*
     61 	adb shell rm -rf $(DEXPREOPT_BOOT_JAR_DIR)/$(DEX2OAT_TARGET_ARCH)
     62 	adb shell rm -rf system/app/$(DEX2OAT_TARGET_ARCH)
     63 ifdef TARGET_2ND_ARCH
     64 	adb shell rm -rf $(DEXPREOPT_BOOT_JAR_DIR)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)
     65 	adb shell rm -rf system/app/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)
     66 endif
     67 	adb shell rm -rf data/run-test/test-*/dalvik-cache/*
     68 
     69 ifneq ($(art_dont_bother),true)
     70 
     71 ########################################################################
     72 # cpplint rules to style check art source files
     73 
     74 include $(art_path)/build/Android.cpplint.mk
     75 
     76 ########################################################################
     77 # product rules
     78 
     79 include $(art_path)/runtime/Android.mk
     80 include $(art_path)/runtime/simulator/Android.mk
     81 include $(art_path)/compiler/Android.mk
     82 include $(art_path)/dexdump/Android.mk
     83 include $(art_path)/dexlist/Android.mk
     84 include $(art_path)/dex2oat/Android.mk
     85 include $(art_path)/disassembler/Android.mk
     86 include $(art_path)/oatdump/Android.mk
     87 include $(art_path)/imgdiag/Android.mk
     88 include $(art_path)/patchoat/Android.mk
     89 include $(art_path)/profman/Android.mk
     90 include $(art_path)/dalvikvm/Android.mk
     91 include $(art_path)/tools/Android.mk
     92 include $(art_path)/tools/ahat/Android.mk
     93 include $(art_path)/tools/dexfuzz/Android.mk
     94 include $(art_path)/tools/dmtracedump/Android.mk
     95 include $(art_path)/sigchainlib/Android.mk
     96 include $(art_path)/libart_fake/Android.mk
     97 
     98 
     99 # ART_HOST_DEPENDENCIES depends on Android.executable.mk above for ART_HOST_EXECUTABLES
    100 ART_HOST_DEPENDENCIES := \
    101 	$(ART_HOST_EXECUTABLES) \
    102 	$(HOST_OUT_JAVA_LIBRARIES)/core-libart-hostdex.jar \
    103 	$(HOST_OUT_JAVA_LIBRARIES)/core-oj-hostdex.jar \
    104 	$(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
    105 	$(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
    106 	$(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvm$(ART_HOST_SHLIB_EXTENSION)
    107 ART_TARGET_DEPENDENCIES := \
    108 	$(ART_TARGET_EXECUTABLES) \
    109 	$(TARGET_OUT_JAVA_LIBRARIES)/core-libart.jar \
    110 	$(TARGET_OUT_JAVA_LIBRARIES)/core-oj.jar \
    111 	$(TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so \
    112 	$(TARGET_OUT_SHARED_LIBRARIES)/libopenjdk.so \
    113 	$(TARGET_OUT_SHARED_LIBRARIES)/libopenjdkjvm.so
    114 ifdef TARGET_2ND_ARCH
    115 ART_TARGET_DEPENDENCIES += $(2ND_TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so
    116 ART_TARGET_DEPENDENCIES += $(2ND_TARGET_OUT_SHARED_LIBRARIES)/libopenjdk.so
    117 ART_TARGET_DEPENDENCIES += $(2ND_TARGET_OUT_SHARED_LIBRARIES)/libopenjdkjvm.so
    118 endif
    119 ifdef HOST_2ND_ARCH
    120 ART_HOST_DEPENDENCIES += $(2ND_HOST_OUT_SHARED_LIBRARIES)/libjavacore.so
    121 ART_HOST_DEPENDENCIES += $(2ND_HOST_OUT_SHARED_LIBRARIES)/libopenjdk.so
    122 ART_HOST_DEPENDENCIES += $(2ND_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvm.so
    123 endif
    124 
    125 ########################################################################
    126 # test rules
    127 
    128 ifeq ($(art_test_bother),true)
    129 
    130 # All the dependencies that must be built ahead of sync-ing them onto the target device.
    131 TEST_ART_TARGET_SYNC_DEPS :=
    132 
    133 include $(art_path)/build/Android.common_test.mk
    134 include $(art_path)/build/Android.gtest.mk
    135 include $(art_path)/test/Android.run-test.mk
    136 include $(art_path)/benchmark/Android.mk
    137 
    138 TEST_ART_ADB_ROOT_AND_REMOUNT := \
    139     (adb root && \
    140      adb wait-for-device remount && \
    141      ((adb shell touch /system/testfile && \
    142        (adb shell rm /system/testfile || true)) || \
    143       (adb disable-verity && \
    144        adb reboot && \
    145        adb wait-for-device root && \
    146        adb wait-for-device remount)))
    147 
    148 # Sync test files to the target, depends upon all things that must be pushed to the target.
    149 .PHONY: test-art-target-sync
    150 # Check if we need to sync. In case ART_TEST_ANDROID_ROOT is not empty,
    151 # the code below uses 'adb push' instead of 'adb sync', which does not
    152 # check if the files on the device have changed.
    153 ifneq ($(ART_TEST_NO_SYNC),true)
    154 ifeq ($(ART_TEST_ANDROID_ROOT),)
    155 test-art-target-sync: $(TEST_ART_TARGET_SYNC_DEPS)
    156 	$(TEST_ART_ADB_ROOT_AND_REMOUNT)
    157 	adb sync
    158 else
    159 test-art-target-sync: $(TEST_ART_TARGET_SYNC_DEPS)
    160 	$(TEST_ART_ADB_ROOT_AND_REMOUNT)
    161 	adb wait-for-device push $(ANDROID_PRODUCT_OUT)/system $(ART_TEST_ANDROID_ROOT)
    162 # Push the contents of the `data` dir into `/data` on the device.  If
    163 # `/data` already exists on the device, it is not overwritten, but its
    164 # contents are updated.
    165 	adb push $(ANDROID_PRODUCT_OUT)/data /
    166 endif
    167 endif
    168 
    169 # "mm test-art" to build and run all tests on host and device
    170 .PHONY: test-art
    171 test-art: test-art-host test-art-target
    172 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    173 
    174 .PHONY: test-art-gtest
    175 test-art-gtest: test-art-host-gtest test-art-target-gtest
    176 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    177 
    178 .PHONY: test-art-run-test
    179 test-art-run-test: test-art-host-run-test test-art-target-run-test
    180 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    181 
    182 ########################################################################
    183 # host test rules
    184 
    185 VIXL_TEST_DEPENDENCY :=
    186 # We can only run the vixl tests on 64-bit hosts (vixl testing issue) when its a
    187 # top-level build (to declare the vixl test rule).
    188 ifneq ($(HOST_PREFER_32_BIT),true)
    189 ifeq ($(ONE_SHOT_MAKEFILE),)
    190 VIXL_TEST_DEPENDENCY := run-vixl-tests
    191 endif
    192 endif
    193 
    194 .PHONY: test-art-host-vixl
    195 test-art-host-vixl: $(VIXL_TEST_DEPENDENCY)
    196 
    197 # "mm test-art-host" to build and run all host tests.
    198 .PHONY: test-art-host
    199 test-art-host: test-art-host-gtest test-art-host-run-test \
    200                test-art-host-vixl test-art-host-dexdump
    201 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    202 
    203 # All host tests that run solely with the default compiler.
    204 .PHONY: test-art-host-default
    205 test-art-host-default: test-art-host-run-test-default
    206 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    207 
    208 # All host tests that run solely with the optimizing compiler.
    209 .PHONY: test-art-host-optimizing
    210 test-art-host-optimizing: test-art-host-run-test-optimizing
    211 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    212 
    213 # All host tests that run solely on the interpreter.
    214 .PHONY: test-art-host-interpreter
    215 test-art-host-interpreter: test-art-host-run-test-interpreter
    216 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    217 
    218 # All host tests that run solely on the jit.
    219 .PHONY: test-art-host-jit
    220 test-art-host-jit: test-art-host-run-test-jit
    221 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    222 
    223 # Primary host architecture variants:
    224 .PHONY: test-art-host$(ART_PHONY_TEST_HOST_SUFFIX)
    225 test-art-host$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-gtest$(ART_PHONY_TEST_HOST_SUFFIX) \
    226     test-art-host-run-test$(ART_PHONY_TEST_HOST_SUFFIX)
    227 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    228 
    229 .PHONY: test-art-host-default$(ART_PHONY_TEST_HOST_SUFFIX)
    230 test-art-host-default$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-default$(ART_PHONY_TEST_HOST_SUFFIX)
    231 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    232 
    233 .PHONY: test-art-host-optimizing$(ART_PHONY_TEST_HOST_SUFFIX)
    234 test-art-host-optimizing$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-optimizing$(ART_PHONY_TEST_HOST_SUFFIX)
    235 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    236 
    237 .PHONY: test-art-host-interpreter$(ART_PHONY_TEST_HOST_SUFFIX)
    238 test-art-host-interpreter$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-interpreter$(ART_PHONY_TEST_HOST_SUFFIX)
    239 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    240 
    241 .PHONY: test-art-host-jit$(ART_PHONY_TEST_HOST_SUFFIX)
    242 test-art-host-jit$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-jit$(ART_PHONY_TEST_HOST_SUFFIX)
    243 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    244 
    245 # Secondary host architecture variants:
    246 ifneq ($(HOST_PREFER_32_BIT),true)
    247 .PHONY: test-art-host$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    248 test-art-host$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-gtest$(2ND_ART_PHONY_TEST_HOST_SUFFIX) \
    249     test-art-host-run-test$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    250 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    251 
    252 .PHONY: test-art-host-default$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    253 test-art-host-default$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-default$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    254 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    255 
    256 .PHONY: test-art-host-optimizing$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    257 test-art-host-optimizing$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-optimizing$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    258 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    259 
    260 .PHONY: test-art-host-interpreter$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    261 test-art-host-interpreter$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-interpreter$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    262 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    263 
    264 .PHONY: test-art-host-jit$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    265 test-art-host-jit$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-jit$(2ND_ART_PHONY_TEST_HOST_SUFFIX)
    266 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    267 endif
    268 
    269 # Dexdump/list regression test.
    270 .PHONY: test-art-host-dexdump
    271 test-art-host-dexdump: $(addprefix $(HOST_OUT_EXECUTABLES)/, dexdump2 dexlist)
    272 	ANDROID_HOST_OUT=$(realpath $(HOST_OUT)) art/test/dexdump/run-all-tests
    273 
    274 # Valgrind.
    275 .PHONY: valgrind-test-art-host
    276 valgrind-test-art-host: valgrind-test-art-host-gtest
    277 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    278 
    279 .PHONY: valgrind-test-art-host32
    280 valgrind-test-art-host32: valgrind-test-art-host-gtest32
    281 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    282 
    283 .PHONY: valgrind-test-art-host64
    284 valgrind-test-art-host64: valgrind-test-art-host-gtest64
    285 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    286 
    287 ########################################################################
    288 # target test rules
    289 
    290 # "mm test-art-target" to build and run all target tests.
    291 .PHONY: test-art-target
    292 test-art-target: test-art-target-gtest test-art-target-run-test
    293 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    294 
    295 # All target tests that run solely with the default compiler.
    296 .PHONY: test-art-target-default
    297 test-art-target-default: test-art-target-run-test-default
    298 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    299 
    300 # All target tests that run solely with the optimizing compiler.
    301 .PHONY: test-art-target-optimizing
    302 test-art-target-optimizing: test-art-target-run-test-optimizing
    303 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    304 
    305 # All target tests that run solely on the interpreter.
    306 .PHONY: test-art-target-interpreter
    307 test-art-target-interpreter: test-art-target-run-test-interpreter
    308 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    309 
    310 # All target tests that run solely on the jit.
    311 .PHONY: test-art-target-jit
    312 test-art-target-jit: test-art-target-run-test-jit
    313 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    314 
    315 # Primary target architecture variants:
    316 .PHONY: test-art-target$(ART_PHONY_TEST_TARGET_SUFFIX)
    317 test-art-target$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-gtest$(ART_PHONY_TEST_TARGET_SUFFIX) \
    318     test-art-target-run-test$(ART_PHONY_TEST_TARGET_SUFFIX)
    319 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    320 
    321 .PHONY: test-art-target-default$(ART_PHONY_TEST_TARGET_SUFFIX)
    322 test-art-target-default$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-default$(ART_PHONY_TEST_TARGET_SUFFIX)
    323 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    324 
    325 .PHONY: test-art-target-optimizing$(ART_PHONY_TEST_TARGET_SUFFIX)
    326 test-art-target-optimizing$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-optimizing$(ART_PHONY_TEST_TARGET_SUFFIX)
    327 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    328 
    329 .PHONY: test-art-target-interpreter$(ART_PHONY_TEST_TARGET_SUFFIX)
    330 test-art-target-interpreter$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-interpreter$(ART_PHONY_TEST_TARGET_SUFFIX)
    331 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    332 
    333 .PHONY: test-art-target-jit$(ART_PHONY_TEST_TARGET_SUFFIX)
    334 test-art-target-jit$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-jit$(ART_PHONY_TEST_TARGET_SUFFIX)
    335 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    336 
    337 # Secondary target architecture variants:
    338 ifdef TARGET_2ND_ARCH
    339 .PHONY: test-art-target$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    340 test-art-target$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-gtest$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) \
    341     test-art-target-run-test$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    342 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    343 
    344 .PHONY: test-art-target-default$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    345 test-art-target-default$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-default$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    346 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    347 
    348 .PHONY: test-art-target-optimizing$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    349 test-art-target-optimizing$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-optimizing$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    350 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    351 
    352 .PHONY: test-art-target-interpreter$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    353 test-art-target-interpreter$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-interpreter$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    354 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    355 
    356 .PHONY: test-art-target-jit$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    357 test-art-target-jit$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-jit$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
    358 	$(hide) $(call ART_TEST_PREREQ_FINISHED,$@)
    359 endif
    360 
    361 endif  # art_test_bother
    362 
    363 ########################################################################
    364 # oat-target and oat-target-sync rules
    365 
    366 OAT_TARGET_RULES :=
    367 
    368 # $(1): input jar or apk target location
    369 define declare-oat-target-target
    370 OUT_OAT_FILE := $(PRODUCT_OUT)/$(basename $(1)).odex
    371 
    372 ifeq ($(ONE_SHOT_MAKEFILE),)
    373 # ONE_SHOT_MAKEFILE is empty for a top level build and we don't want
    374 # to define the oat-target-* rules there because they will conflict
    375 # with the build/core/dex_preopt.mk defined rules.
    376 .PHONY: oat-target-$(1)
    377 oat-target-$(1):
    378 
    379 else
    380 .PHONY: oat-target-$(1)
    381 oat-target-$(1): $$(OUT_OAT_FILE)
    382 
    383 $$(OUT_OAT_FILE): $(PRODUCT_OUT)/$(1) $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) $(DEX2OAT_DEPENDENCY)
    384 	@mkdir -p $$(dir $$@)
    385 	$(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
    386 		--boot-image=$(DEFAULT_DEX_PREOPT_BUILT_IMAGE) --dex-file=$(PRODUCT_OUT)/$(1) \
    387 		--dex-location=/$(1) --oat-file=$$@ \
    388 		--instruction-set=$(DEX2OAT_TARGET_ARCH) \
    389 		--instruction-set-variant=$(DEX2OAT_TARGET_CPU_VARIANT) \
    390 		--instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
    391 		--android-root=$(PRODUCT_OUT)/system --include-patch-information \
    392 		--runtime-arg -Xnorelocate
    393 
    394 endif
    395 
    396 OAT_TARGET_RULES += oat-target-$(1)
    397 endef
    398 
    399 $(foreach file,\
    400   $(filter-out\
    401     $(addprefix $(TARGET_OUT_JAVA_LIBRARIES)/,$(addsuffix .jar,$(LIBART_TARGET_BOOT_JARS))),\
    402     $(wildcard $(TARGET_OUT_APPS)/*.apk) $(wildcard $(TARGET_OUT_JAVA_LIBRARIES)/*.jar)),\
    403   $(eval $(call declare-oat-target-target,$(subst $(PRODUCT_OUT)/,,$(file)))))
    404 
    405 .PHONY: oat-target
    406 oat-target: $(ART_TARGET_DEPENDENCIES) $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) $(OAT_TARGET_RULES)
    407 
    408 .PHONY: oat-target-sync
    409 oat-target-sync: oat-target
    410 	$(TEST_ART_ADB_ROOT_AND_REMOUNT)
    411 	adb sync
    412 
    413 ####################################################################################################
    414 # Fake packages to ensure generation of libopenjdkd when one builds with mm/mmm/mmma.
    415 #
    416 # The library is required for starting a runtime in debug mode, but libartd does not depend on it
    417 # (dependency cycle otherwise).
    418 #
    419 # Note: * As the package is phony to create a dependency the package name is irrelevant.
    420 #       * We make MULTILIB explicit to "both," just to state here that we want both libraries on
    421 #         64-bit systems, even if it is the default.
    422 
    423 # ART on the host.
    424 ifeq ($(ART_BUILD_HOST_DEBUG),true)
    425 include $(CLEAR_VARS)
    426 LOCAL_MODULE := art-libartd-libopenjdkd-host-dependency
    427 LOCAL_MULTILIB := both
    428 LOCAL_REQUIRED_MODULES := libopenjdkd
    429 LOCAL_IS_HOST_MODULE := true
    430 include $(BUILD_PHONY_PACKAGE)
    431 endif
    432 
    433 # ART on the target.
    434 ifeq ($(ART_BUILD_TARGET_DEBUG),true)
    435 include $(CLEAR_VARS)
    436 LOCAL_MODULE := art-libartd-libopenjdkd-target-dependency
    437 LOCAL_MULTILIB := both
    438 LOCAL_REQUIRED_MODULES := libopenjdkd
    439 include $(BUILD_PHONY_PACKAGE)
    440 endif
    441 
    442 ########################################################################
    443 # "m build-art" for quick minimal build
    444 .PHONY: build-art
    445 build-art: build-art-host build-art-target
    446 
    447 .PHONY: build-art-host
    448 build-art-host:   $(HOST_OUT_EXECUTABLES)/art $(ART_HOST_DEPENDENCIES) $(HOST_CORE_IMG_OUTS)
    449 
    450 .PHONY: build-art-target
    451 build-art-target: $(TARGET_OUT_EXECUTABLES)/art $(ART_TARGET_DEPENDENCIES) $(TARGET_CORE_IMG_OUTS)
    452 
    453 ########################################################################
    454 # Rules for building all dependencies for tests.
    455 
    456 .PHONY: build-art-host-tests
    457 build-art-host-tests:   build-art-host $(TEST_ART_RUN_TEST_DEPENDENCIES) $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES) $(ART_TEST_HOST_GTEST_DEPENDENCIES) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES)
    458 
    459 .PHONY: build-art-target-tests
    460 build-art-target-tests:   build-art-target $(TEST_ART_RUN_TEST_DEPENDENCIES) $(TEST_ART_TARGET_SYNC_DEPS) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES)
    461 
    462 ########################################################################
    463 # targets to switch back and forth from libdvm to libart
    464 
    465 .PHONY: use-art
    466 use-art:
    467 	adb root
    468 	adb wait-for-device shell stop
    469 	adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
    470 	adb shell start
    471 
    472 .PHONY: use-artd
    473 use-artd:
    474 	adb root
    475 	adb wait-for-device shell stop
    476 	adb shell setprop persist.sys.dalvik.vm.lib.2 libartd.so
    477 	adb shell start
    478 
    479 .PHONY: use-dalvik
    480 use-dalvik:
    481 	adb root
    482 	adb wait-for-device shell stop
    483 	adb shell setprop persist.sys.dalvik.vm.lib.2 libdvm.so
    484 	adb shell start
    485 
    486 .PHONY: use-art-full
    487 use-art-full:
    488 	adb root
    489 	adb wait-for-device shell stop
    490 	adb shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/*
    491 	adb shell setprop dalvik.vm.dex2oat-filter \"\"
    492 	adb shell setprop dalvik.vm.image-dex2oat-filter \"\"
    493 	adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
    494 	adb shell setprop dalvik.vm.usejit false
    495 	adb shell start
    496 
    497 .PHONY: use-artd-full
    498 use-artd-full:
    499 	adb root
    500 	adb wait-for-device shell stop
    501 	adb shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/*
    502 	adb shell setprop dalvik.vm.dex2oat-filter \"\"
    503 	adb shell setprop dalvik.vm.image-dex2oat-filter \"\"
    504 	adb shell setprop persist.sys.dalvik.vm.lib.2 libartd.so
    505 	adb shell setprop dalvik.vm.usejit false
    506 	adb shell start
    507 
    508 .PHONY: use-art-jit
    509 use-art-jit:
    510 	adb root
    511 	adb wait-for-device shell stop
    512 	adb shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/*
    513 	adb shell setprop dalvik.vm.dex2oat-filter "verify-at-runtime"
    514 	adb shell setprop dalvik.vm.image-dex2oat-filter "verify-at-runtime"
    515 	adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
    516 	adb shell setprop dalvik.vm.usejit true
    517 	adb shell start
    518 
    519 .PHONY: use-art-interpret-only
    520 use-art-interpret-only:
    521 	adb root
    522 	adb wait-for-device shell stop
    523 	adb shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/*
    524 	adb shell setprop dalvik.vm.dex2oat-filter "interpret-only"
    525 	adb shell setprop dalvik.vm.image-dex2oat-filter "interpret-only"
    526 	adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
    527 	adb shell setprop dalvik.vm.usejit false
    528 	adb shell start
    529 
    530 .PHONY: use-artd-interpret-only
    531 use-artd-interpret-only:
    532 	adb root
    533 	adb wait-for-device shell stop
    534 	adb shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/*
    535 	adb shell setprop dalvik.vm.dex2oat-filter "interpret-only"
    536 	adb shell setprop dalvik.vm.image-dex2oat-filter "interpret-only"
    537 	adb shell setprop persist.sys.dalvik.vm.lib.2 libartd.so
    538 	adb shell setprop dalvik.vm.usejit false
    539 	adb shell start
    540 
    541 .PHONY: use-art-verify-none
    542 use-art-verify-none:
    543 	adb root
    544 	adb wait-for-device shell stop
    545 	adb shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/*
    546 	adb shell setprop dalvik.vm.dex2oat-filter "verify-none"
    547 	adb shell setprop dalvik.vm.image-dex2oat-filter "verify-none"
    548 	adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
    549 	adb shell setprop dalvik.vm.usejit false
    550 	adb shell start
    551 
    552 ########################################################################
    553 
    554 endif # !art_dont_bother
    555 
    556 # Clear locally used variables.
    557 art_dont_bother :=
    558 art_test_bother :=
    559 TEST_ART_TARGET_SYNC_DEPS :=
    560 
    561 include $(art_path)/runtime/openjdkjvm/Android.mk
    562 
    563 # Helper target that depends on boot image creation.
    564 #
    565 # Can be used, for example, to dump initialization failures:
    566 #   m art-boot-image ART_BOOT_IMAGE_EXTRA_ARGS=--dump-init-failures=fails.txt
    567 .PHONY: art-boot-image
    568 art-boot-image: $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
    569