Carl Shapiro | 7b21670 | 2011-06-17 15:09:26 -0700 | [diff] [blame] | 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) |
Carl Shapiro | 7b21670 | 2011-06-17 15:09:26 -0700 | [diff] [blame] | 18 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 19 | # These can be overridden via the environment or by editing to |
| 20 | # enable/disable certain build configuration. |
| 21 | ART_BUILD_TARGET_NDEBUG ?= true |
| 22 | ART_BUILD_TARGET_DEBUG ?= true |
Brian Carlstrom | 56778d8 | 2011-09-11 14:08:17 -0700 | [diff] [blame] | 23 | ifeq ($(HOST_OS),linux) |
| 24 | ART_BUILD_HOST_NDEBUG ?= true |
| 25 | ART_BUILD_HOST_DEBUG ?= true |
| 26 | else |
| 27 | ART_BUILD_HOST_NDEBUG ?= false |
| 28 | ART_BUILD_HOST_DEBUG ?= false |
| 29 | endif |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 30 | |
Carl Shapiro | 0e6d197 | 2011-07-06 19:17:39 -0700 | [diff] [blame] | 31 | build_path := $(LOCAL_PATH)/build |
Brian Carlstrom | cdc8de4 | 2011-07-19 14:23:17 -0700 | [diff] [blame] | 32 | include $(build_path)/Android.common.mk |
| 33 | |
Carl Shapiro | 0e6d197 | 2011-07-06 19:17:39 -0700 | [diff] [blame] | 34 | include $(build_path)/Android.libart.mk |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 35 | include $(build_path)/Android.executable.mk |
Carl Shapiro | 7b21670 | 2011-06-17 15:09:26 -0700 | [diff] [blame] | 36 | |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 37 | include $(build_path)/Android.oat.mk |
| 38 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 39 | include $(build_path)/Android.libarttest.mk |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 40 | include $(build_path)/Android.gtest.mk |
| 41 | include $(build_path)/Android.oattest.mk |
Brian Carlstrom | 934486c | 2011-07-12 23:42:50 -0700 | [diff] [blame] | 42 | |
| 43 | # "m build-art" for quick minimal build |
| 44 | .PHONY: build-art |
| 45 | build-art: \ |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 46 | $(ART_TARGET_EXECUTABLES) \ |
Brian Carlstrom | 8ecd08c | 2011-07-27 17:50:51 -0700 | [diff] [blame] | 47 | $(ART_TARGET_TEST_EXECUTABLES) \ |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 48 | $(ART_HOST_EXECUTABLES) \ |
Carl Shapiro | 47940d6 | 2011-08-13 22:21:30 -0700 | [diff] [blame] | 49 | $(ART_HOST_TEST_EXECUTABLES) |
Brian Carlstrom | 934486c | 2011-07-12 23:42:50 -0700 | [diff] [blame] | 50 | |
Brian Carlstrom | 4a96b60 | 2011-07-26 16:40:23 -0700 | [diff] [blame] | 51 | # "mm test-art" to build and run all tests on host and device |
| 52 | .PHONY: test-art |
| 53 | test-art: test-art-host test-art-target |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 54 | @echo test-art PASSED |
Brian Carlstrom | 4a96b60 | 2011-07-26 16:40:23 -0700 | [diff] [blame] | 55 | |
Elliott Hughes | 2cae5a2 | 2011-08-14 14:27:25 -0700 | [diff] [blame] | 56 | define run-host-tests-with |
Elliott Hughes | b465ab0 | 2011-08-24 11:21:21 -0700 | [diff] [blame] | 57 | $(foreach file,$(sort $(ART_HOST_TEST_EXECUTABLES)),$(1) $(file) &&) true |
Elliott Hughes | 2cae5a2 | 2011-08-14 14:27:25 -0700 | [diff] [blame] | 58 | endef |
| 59 | |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 60 | ART_HOST_TEST_DEPENDENCIES := $(ART_HOST_TEST_EXECUTABLES) $(ANDROID_HOST_OUT)/framework/core-hostdex.jar $(ART_TEST_OAT_FILES) |
| 61 | ART_TARGET_TEST_DEPENDENCIES := $(ART_TARGET_TEST_EXECUTABLES) $(ANDROID_PRODUCT_OUT)/system/framework/core.jar $(ART_TEST_OAT_FILES) |
Brian Carlstrom | 9f30b38 | 2011-08-28 22:41:38 -0700 | [diff] [blame] | 62 | |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 63 | ART_TARGET_TEST_DEPENDENCIES += $(TARGET_OUT_EXECUTABLES)/oat_process $(TARGET_OUT_EXECUTABLES)/oat_processd |
| 64 | |
| 65 | ######################################################################## |
| 66 | # host test targets |
| 67 | |
Brian Carlstrom | 934486c | 2011-07-12 23:42:50 -0700 | [diff] [blame] | 68 | # "mm test-art-host" to build and run all host tests |
| 69 | .PHONY: test-art-host |
Brian Carlstrom | 9f30b38 | 2011-08-28 22:41:38 -0700 | [diff] [blame] | 70 | test-art-host: $(ART_HOST_TEST_DEPENDENCIES) |
Elliott Hughes | 2cae5a2 | 2011-08-14 14:27:25 -0700 | [diff] [blame] | 71 | $(call run-host-tests-with,) |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 72 | @echo test-art-host PASSED |
Brian Carlstrom | 59848da | 2011-07-23 20:35:19 -0700 | [diff] [blame] | 73 | |
Elliott Hughes | 5511f21 | 2011-08-12 18:07:45 -0700 | [diff] [blame] | 74 | # "mm valgrind-art-host" to build and run all host tests under valgrind. |
| 75 | .PHONY: valgrind-art-host |
Brian Carlstrom | 9f30b38 | 2011-08-28 22:41:38 -0700 | [diff] [blame] | 76 | valgrind-art-host: $(ART_HOST_TEST_DEPENDENCIES) |
Elliott Hughes | 2cae5a2 | 2011-08-14 14:27:25 -0700 | [diff] [blame] | 77 | $(call run-host-tests-with,"valgrind") |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 78 | @echo valgrind-art-host PASSED |
Elliott Hughes | 2cae5a2 | 2011-08-14 14:27:25 -0700 | [diff] [blame] | 79 | |
| 80 | # "mm tsan-art-host" to build and run all host tests under tsan. |
| 81 | .PHONY: tsan-art-host |
Brian Carlstrom | 9f30b38 | 2011-08-28 22:41:38 -0700 | [diff] [blame] | 82 | tsan-art-host: $(ART_HOST_TEST_DEPENDENCIES) |
Elliott Hughes | 2cae5a2 | 2011-08-14 14:27:25 -0700 | [diff] [blame] | 83 | $(call run-host-tests-with,"tsan") |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 84 | @echo tsan-art-host PASSED |
Elliott Hughes | 5511f21 | 2011-08-12 18:07:45 -0700 | [diff] [blame] | 85 | |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 86 | ######################################################################## |
| 87 | # target test targets |
| 88 | |
| 89 | # "mm test-art-target" to build and run all target tests |
Brian Carlstrom | 4a96b60 | 2011-07-26 16:40:23 -0700 | [diff] [blame] | 90 | .PHONY: test-art-target |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 91 | test-art-target: test-art-target-gtest test-art-target-oat |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 92 | @echo test-art-target PASSED |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 93 | |
| 94 | .PHONY: test-art-target-sync |
| 95 | test-art-target-sync: $(ART_TARGET_TEST_DEPENDENCIES) |
Brian Carlstrom | 4a96b60 | 2011-07-26 16:40:23 -0700 | [diff] [blame] | 96 | adb remount |
| 97 | adb sync |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 98 | |
| 99 | .PHONY: test-art-target-gtest |
| 100 | test-art-target-gtest: test-art-target-sync |
| 101 | adb shell touch /sdcard/test-art-target-gtest |
| 102 | adb shell rm /sdcard/test-art-target-gtest |
| 103 | adb shell sh -c "$(foreach file,$(sort $(ART_TARGET_TEST_EXECUTABLES)), /system/bin/$(notdir $(file)) &&) touch /sdcard/test-art-target-gtest" |
Brian Carlstrom | f867b6f | 2011-09-16 12:17:25 -0700 | [diff] [blame] | 104 | $(hide) (adb pull /sdcard/test-art-target-gtest /tmp/ && echo test-art-target-gtest PASSED) || echo test-art-target-gtest FAILED |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 105 | $(hide) rm /tmp/test-art-target-gtest |
| 106 | |
| 107 | .PHONY: test-art-target-oat |
Brian Carlstrom | bbf1e41 | 2011-09-18 14:14:51 -0700 | [diff] [blame] | 108 | test-art-target-oat: $(ART_TEST_OAT_TARGETS) |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 109 | @echo test-art-target-oat PASSED |
Brian Carlstrom | 4a96b60 | 2011-07-26 16:40:23 -0700 | [diff] [blame] | 110 | |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 111 | ######################################################################## |
| 112 | # oat_process test targets |
| 113 | |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 114 | # $(1): name |
| 115 | define build-art-framework-oat |
| 116 | $(call build-art-oat,$(1),$(TARGET_BOOT_OAT),$(TARGET_BOOT_DEX)) |
| 117 | endef |
| 118 | |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 119 | .PHONY: test-art-target-oat-process |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 120 | test-art-target-oat-process: test-art-target-oat-process-am # test-art-target-oat-process-Calculator |
| 121 | |
| 122 | $(eval $(call build-art-framework-oat,$(TARGET_OUT_JAVA_LIBRARIES)/am.jar)) |
| 123 | |
| 124 | .PHONY: test-art-target-oat-process-am |
| 125 | test-art-target-oat-process-am: $(TARGET_OUT_JAVA_LIBRARIES)/am.oat test-art-target-sync |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 126 | adb remount |
| 127 | adb sync |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 128 | adb shell sh -c "export CLASSPATH=/system/framework/am.jar && oat_processd /system/bin/app_process -Xbootimage:/system/framework/boot.oat -Ximage:/system/framework/am.oat /system/bin com.android.commands.am.Am start http://android.com && touch /sdcard/test-art-target-process-am" |
| 129 | $(hide) (adb pull /sdcard/test-art-target-process-am /tmp/ && echo test-art-target-process-am PASSED) || echo test-art-target-process-am FAILED |
| 130 | $(hide) rm /tmp/test-art-target-process-am |
| 131 | |
| 132 | $(eval $(call build-art-framework-oat,$(TARGET_OUT_APPS)/Calculator.apk)) |
| 133 | |
| 134 | .PHONY: test-art-target-oat-process-Calculator |
| 135 | # Note that using this instead of "adb shell am start" make sure that the /data/art-cache is up-to-date |
Brian Carlstrom | 65ca077 | 2011-09-24 16:03:08 -0700 | [diff] [blame] | 136 | test-art-target-oat-process-Calculator: $(TARGET_OUT_APPS)/Calculator.oat $(TARGET_OUT_JAVA_LIBRARIES)/am.oat test-art-target-sync |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 137 | mkdir -p $(TARGET_OUT_DATA)/art-cache |
| 138 | unzip $(TARGET_OUT_APPS)/Calculator.apk classes.dex -d $(TARGET_OUT_DATA)/art-cache |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 139 | mv $(TARGET_OUT_DATA)/art-cache/classes.dex $(TARGET_OUT_DATA)/art-cache/system@app@Calculator.apk@classes.dex.`unzip -lv $(TARGET_OUT_APPS)/Calculator.apk classes.dex | grep classes.dex | sed -E 's/.* ([0-9a-f]+) classes.dex/\1/'` # note this is extracting the crc32 that is needed as the file extension |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 140 | adb remount |
| 141 | adb sync |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 142 | if [ "`adb shell getprop wrap.com.android.calculator2 | tr -d '\r'`" = "oat_processd" ]; then \ |
| 143 | echo wrap.com.android.calculator2 already set; \ |
| 144 | else \ |
| 145 | echo Setting wrap.com.android.calculator2 and restarting runtime; \ |
| 146 | adb shell setprop wrap.com.android.calculator2 "oat_processd"; \ |
| 147 | adb shell stop; \ |
| 148 | adb shell start; \ |
| 149 | sleep 30; \ |
| 150 | fi |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 151 | adb shell sh -c "export CLASSPATH=/system/framework/am.jar && oat_processd /system/bin/app_process -Xbootimage:/system/framework/boot.oat -Ximage:/system/framework/am.oat /system/bin com.android.commands.am.Am start -a android.intent.action.MAIN -n com.android.calculator2/.Calculator && touch /sdcard/test-art-target-process-Calculator" |
| 152 | $(hide) (adb pull /sdcard/test-art-target-process-Calculator /tmp/ && echo test-art-target-process-Calculator PASSED) || echo test-art-target-process-Calculator FAILED |
| 153 | $(hide) rm /tmp/test-art-target-process-Calculator |
| 154 | |
| 155 | ######################################################################## |
| 156 | # oatdump targets |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 157 | |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 158 | .PHONY: dump-oat |
Brian Carlstrom | e10b697 | 2011-09-26 13:49:03 -0700 | [diff] [blame^] | 159 | dump-oat: dump-oat-core dump-oat-boot |
Brian Carlstrom | 395520e | 2011-09-25 19:35:00 -0700 | [diff] [blame] | 160 | |
Brian Carlstrom | e10b697 | 2011-09-26 13:49:03 -0700 | [diff] [blame^] | 161 | .PHONY: dump-oat-core |
| 162 | dump-oat-core: $(TARGET_CORE_OAT) $(OATDUMP) |
| 163 | $(OATDUMP) $(addprefix --dex-file=,$(TARGET_CORE_DEX)) --image=$< --strip-prefix=$(PRODUCT_OUT) --output=/tmp/core.oatdump.txt |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 164 | @echo Output in /tmp/core.oatdump.txt |
| 165 | |
Brian Carlstrom | e10b697 | 2011-09-26 13:49:03 -0700 | [diff] [blame^] | 166 | .PHONY: dump-oat-boot |
| 167 | dump-oat-boot: $(TARGET_BOOT_OAT) $(OATDUMP) |
| 168 | $(OATDUMP) $(addprefix --dex-file=,$(TARGET_BOOT_DEX)) --image=$< --strip-prefix=$(PRODUCT_OUT) --output=/tmp/boot.oatdump.txt |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 169 | @echo Output in /tmp/boot.oatdump.txt |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 170 | |
Brian Carlstrom | e10b697 | 2011-09-26 13:49:03 -0700 | [diff] [blame^] | 171 | .PHONY: dump-oat-Calculator |
| 172 | dump-oat-Calculator: $(TARGET_OUT_APPS)/Calculator.oat $(TARGET_BOOT_OAT) $(OATDUMP) |
| 173 | $(OATDUMP) --dex-file=$(TARGET_OUT_APPS)/Calculator.apk --image=$< $(addprefix --boot-dex-file=,$(TARGET_BOOT_DEX)) --boot=$(TARGET_BOOT_OAT) --strip-prefix=$(PRODUCT_OUT) --output=/tmp/Calculator.oatdump.txt |
| 174 | @echo Output in /tmp/Calculator.oatdump.txt |
| 175 | |
| 176 | |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 177 | ######################################################################## |
| 178 | # cpplint target |
| 179 | |
Brian Carlstrom | 59848da | 2011-07-23 20:35:19 -0700 | [diff] [blame] | 180 | # "mm cpplint-art" to style check art source files |
| 181 | .PHONY: cpplint-art |
| 182 | cpplint-art: |
| 183 | $(LOCAL_PATH)/tools/cpplint.py $(LOCAL_PATH)/src/*.h $(LOCAL_PATH)/src/*.cc |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 184 | |
Brian Carlstrom | bc2f3e3 | 2011-09-22 17:16:54 -0700 | [diff] [blame] | 185 | ######################################################################## |
| 186 | |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 187 | include $(call all-makefiles-under,$(LOCAL_PATH)) |