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
17LOCAL_PATH := $(call my-dir)
18
19########################################################################
20# oatdump targets
21
22ART_DUMP_OAT_PATH ?= $(OUT_DIR)
23
24OATDUMP := $(HOST_OUT_EXECUTABLES)/oatdump$(HOST_EXECUTABLE_SUFFIX)
25OATDUMPD := $(HOST_OUT_EXECUTABLES)/oatdumpd$(HOST_EXECUTABLE_SUFFIX)
26# TODO: for now, override with debug version for better error reporting
27OATDUMP := $(OATDUMPD)
28
29.PHONY: dump-oat
30dump-oat: dump-oat-core dump-oat-boot
31
32.PHONY: dump-oat-core
33dump-oat-core: dump-oat-core-host dump-oat-core-target
34
35.PHONY: dump-oat-core-host
36ifeq ($(ART_BUILD_HOST),true)
37dump-oat-core-host: $(HOST_CORE_IMG_OUTS) $(OATDUMP)
38	$(OATDUMP) --image=$(HOST_CORE_IMG_LOCATION) --output=$(ART_DUMP_OAT_PATH)/core.host.oatdump.txt
39	@echo Output in $(ART_DUMP_OAT_PATH)/core.host.oatdump.txt
40endif
41
42.PHONY: dump-oat-core-target-$(TARGET_ARCH)
43ifeq ($(ART_BUILD_TARGET),true)
44dump-oat-core-target-$(TARGET_ARCH): $(TARGET_CORE_IMAGE_default_$(ART_PHONY_TEST_TARGET_SUFFIX)) $(OATDUMP)
45	$(OATDUMP) --image=$(TARGET_CORE_IMG_LOCATION) \
46	  --output=$(ART_DUMP_OAT_PATH)/core.target.$(TARGET_ARCH).oatdump.txt --instruction-set=$(TARGET_ARCH)
47	@echo Output in $(ART_DUMP_OAT_PATH)/core.target.$(TARGET_ARCH).oatdump.txt
48endif
49
50ifdef TARGET_2ND_ARCH
51.PHONY: dump-oat-core-target-$(TARGET_2ND_ARCH)
52ifeq ($(ART_BUILD_TARGET),true)
53dump-oat-core-target-$(TARGET_2ND_ARCH): $(TARGET_CORE_IMAGE_default_$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)) $(OATDUMP)
54	$(OATDUMP) --image=$(TARGET_CORE_IMG_LOCATION) \
55	  --output=$(ART_DUMP_OAT_PATH)/core.target.$(TARGET_2ND_ARCH).oatdump.txt --instruction-set=$(TARGET_2ND_ARCH)
56	@echo Output in $(ART_DUMP_OAT_PATH)/core.target.$(TARGET_2ND_ARCH).oatdump.txt
57endif
58endif
59
60.PHONY: dump-oat-core-target
61dump-oat-core-target: dump-oat-core-target-$(TARGET_ARCH)
62ifdef TARGET_2ND_ARCH
63dump-oat-core-target: dump-oat-core-target-$(TARGET_2ND_ARCH)
64endif
65
66.PHONY: dump-oat-boot-$(TARGET_ARCH)
67ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
68dump-oat-boot-$(TARGET_ARCH): $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) $(OATDUMP)
69	$(OATDUMP) $(addprefix --image=,$(DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION)) \
70	  --output=$(ART_DUMP_OAT_PATH)/boot.$(TARGET_ARCH).oatdump.txt --instruction-set=$(TARGET_ARCH)
71	@echo Output in $(ART_DUMP_OAT_PATH)/boot.$(TARGET_ARCH).oatdump.txt
72endif
73
74ifdef TARGET_2ND_ARCH
75dump-oat-boot-$(TARGET_2ND_ARCH): $(2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) $(OATDUMP)
76	$(OATDUMP) $(addprefix --image=,$(2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION)) \
77	  --output=$(ART_DUMP_OAT_PATH)/boot.$(TARGET_2ND_ARCH).oatdump.txt --instruction-set=$(TARGET_2ND_ARCH)
78	@echo Output in $(ART_DUMP_OAT_PATH)/boot.$(TARGET_2ND_ARCH).oatdump.txt
79endif
80
81.PHONY: dump-oat-boot
82dump-oat-boot: dump-oat-boot-$(TARGET_ARCH)
83ifdef TARGET_2ND_ARCH
84dump-oat-boot: dump-oat-boot-$(TARGET_2ND_ARCH)
85endif
86
87.PHONY: dump-oat-Calculator
88ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
89dump-oat-Calculator: $(TARGET_OUT_APPS)/Calculator.odex $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) $(OATDUMP)
90	$(OATDUMP) --oat-file=$< --output=$(ART_DUMP_OAT_PATH)/Calculator.oatdump.txt
91	@echo Output in $(ART_DUMP_OAT_PATH)/Calculator.oatdump.txt
92endif
93