Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -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 | |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 17 | ######################################################################## |
Brian Carlstrom | 7ab763c | 2013-12-09 00:38:02 -0800 | [diff] [blame] | 18 | # Rules to build a smaller "core" image to support core libraries |
| 19 | # (that is, non-Android frameworks) testing on the host and target |
| 20 | # |
| 21 | # The main rules to build the default "boot" image are in |
| 22 | # build/core/dex_preopt_libart.mk |
Brian Carlstrom | 3b010aa | 2013-06-25 23:06:36 -0700 | [diff] [blame] | 23 | TARGET_CORE_JARS := core-libart conscrypt okhttp core-junit bouncycastle |
Brian Carlstrom | 87587cb | 2012-03-08 11:42:50 -0800 | [diff] [blame] | 24 | HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS)) |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 25 | |
Brian Carlstrom | a004aa9 | 2012-02-08 18:05:09 -0800 | [diff] [blame] | 26 | HOST_CORE_DEX_LOCATIONS := $(foreach jar,$(HOST_CORE_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar) |
| 27 | TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar) |
| 28 | |
| 29 | HOST_CORE_DEX_FILES := $(foreach jar,$(HOST_CORE_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar) |
| 30 | TARGET_CORE_DEX_FILES := $(foreach jar,$(TARGET_CORE_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar), ,COMMON)/javalib.jar) |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 31 | |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 32 | HOST_CORE_OAT := $(HOST_OUT_JAVA_LIBRARIES)/core.oat |
Brian Carlstrom | a004aa9 | 2012-02-08 18:05:09 -0800 | [diff] [blame] | 33 | TARGET_CORE_OAT := $(ART_TEST_DIR)/core.oat |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame^] | 34 | 2ND_TARGET_CORE_OAT := $(2ND_ART_TEST_DIR)/core.oat |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 35 | |
Brian Carlstrom | a004aa9 | 2012-02-08 18:05:09 -0800 | [diff] [blame] | 36 | HOST_CORE_OAT_OUT := $(HOST_OUT_JAVA_LIBRARIES)/core.oat |
| 37 | TARGET_CORE_OAT_OUT := $(ART_TEST_OUT)/core.oat |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame^] | 38 | 2ND_TARGET_CORE_OAT_OUT := $(2ND_ART_TEST_OUT)/core.oat |
Brian Carlstrom | e24fa61 | 2011-09-29 00:53:55 -0700 | [diff] [blame] | 39 | |
Brian Carlstrom | a004aa9 | 2012-02-08 18:05:09 -0800 | [diff] [blame] | 40 | HOST_CORE_IMG_OUT := $(HOST_OUT_JAVA_LIBRARIES)/core.art |
| 41 | TARGET_CORE_IMG_OUT := $(ART_TEST_OUT)/core.art |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame^] | 42 | 2ND_TARGET_CORE_IMG_OUT := $(2ND_ART_TEST_OUT)/core.art |
Brian Carlstrom | a004aa9 | 2012-02-08 18:05:09 -0800 | [diff] [blame] | 43 | |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 44 | TARGET_INSTRUCTION_SET_FEATURES := $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) |
| 45 | |
TDYa127 | 58e63f9 | 2012-04-24 13:16:47 -0700 | [diff] [blame] | 46 | $(HOST_CORE_IMG_OUT): $(HOST_CORE_DEX_FILES) $(DEX2OAT_DEPENDENCY) |
Shih-wei Liao | 8cfa882 | 2012-04-21 01:54:10 -0700 | [diff] [blame] | 47 | @echo "host dex2oat: $@ ($?)" |
| 48 | @mkdir -p $(dir $@) |
Brian Carlstrom | 7ab763c | 2013-12-09 00:38:02 -0800 | [diff] [blame] | 49 | $(hide) $(DEX2OAT) --runtime-arg -Xms16m --runtime-arg -Xmx16m --image-classes=$(PRELOADED_CLASSES) $(addprefix \ |
Dave Allison | 7020278 | 2013-10-22 17:52:19 -0700 | [diff] [blame] | 50 | --dex-file=,$(HOST_CORE_DEX_FILES)) $(addprefix --dex-location=,$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$(HOST_CORE_OAT_OUT) \ |
Brian Carlstrom | 7ab763c | 2013-12-09 00:38:02 -0800 | [diff] [blame] | 51 | --oat-location=$(HOST_CORE_OAT) --image=$(HOST_CORE_IMG_OUT) --base=$(LIBART_IMG_HOST_BASE_ADDRESS) \ |
Andreas Gampe | 922141a | 2014-03-12 10:59:26 -0700 | [diff] [blame] | 52 | --instruction-set=$(ART_HOST_ARCH) --host --android-root=$(HOST_OUT) |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 53 | |
Brian Carlstrom | 73666be | 2012-03-10 20:25:10 -0800 | [diff] [blame] | 54 | $(HOST_CORE_OAT_OUT): $(HOST_CORE_IMG_OUT) |
Brian Carlstrom | 2b7cdf4 | 2011-10-13 11:18:28 -0700 | [diff] [blame] | 55 | |
Andreas Gampe | afbaa1a | 2014-03-25 18:09:32 -0700 | [diff] [blame^] | 56 | define create-oat-target-targets |
| 57 | $$($(1)TARGET_CORE_IMG_OUT): $$($(1)TARGET_CORE_DEX_FILES) $$(DEX2OAT_DEPENDENCY) |
| 58 | @echo "target dex2oat: $$@ ($$?)" |
| 59 | @mkdir -p $$(dir $$@) |
| 60 | $$(hide) $$(DEX2OAT) --runtime-arg -Xms16m --runtime-arg -Xmx16m --image-classes=$$(PRELOADED_CLASSES) $$(addprefix \ |
| 61 | --dex-file=,$$(TARGET_CORE_DEX_FILES)) $$(addprefix --dex-location=,$$(TARGET_CORE_DEX_LOCATIONS)) --oat-file=$$($(1)TARGET_CORE_OAT_OUT) \ |
| 62 | --oat-location=$$($(1)TARGET_CORE_OAT) --image=$$($(1)TARGET_CORE_IMG_OUT) --base=$$(LIBART_IMG_TARGET_BASE_ADDRESS) \ |
| 63 | --instruction-set=$$($(1)TARGET_ARCH) --instruction-set-features=$$(TARGET_INSTRUCTION_SET_FEATURES) --android-root=$$(PRODUCT_OUT)/system |
| 64 | |
| 65 | $$($(1)TARGET_CORE_OAT_OUT): $$($(1)TARGET_CORE_IMG_OUT) |
| 66 | endef |
| 67 | |
| 68 | ifdef TARGET_2ND_ARCH |
| 69 | $(eval $(call create-oat-target-targets,2ND_)) |
| 70 | endif |
| 71 | $(eval $(call create-oat-target-targets,)) |
| 72 | |
Brian Carlstrom | 2b7cdf4 | 2011-10-13 11:18:28 -0700 | [diff] [blame] | 73 | |
Brian Carlstrom | cb91f1a | 2013-02-01 12:55:09 -0800 | [diff] [blame] | 74 | ifeq ($(ART_BUILD_HOST),true) |
Brian Carlstrom | 85545cd | 2012-06-27 14:28:06 -0700 | [diff] [blame] | 75 | include $(CLEAR_VARS) |
| 76 | LOCAL_MODULE := core.art-host |
| 77 | LOCAL_MODULE_TAGS := optional |
Brian Carlstrom | c0ee650 | 2013-07-12 18:09:50 -0700 | [diff] [blame] | 78 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk |
| 79 | LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 80 | LOCAL_ADDITIONAL_DEPENDENCIES += $(HOST_CORE_IMG_OUT) |
Brian Carlstrom | 85545cd | 2012-06-27 14:28:06 -0700 | [diff] [blame] | 81 | include $(BUILD_PHONY_PACKAGE) |
Brian Carlstrom | 660f8f0 | 2014-01-28 16:05:27 -0800 | [diff] [blame] | 82 | endif # ART_BUILD_HOST |
Brian Carlstrom | 85545cd | 2012-06-27 14:28:06 -0700 | [diff] [blame] | 83 | |
Brian Carlstrom | 2b07096 | 2013-10-29 13:35:25 -0700 | [diff] [blame] | 84 | # If we aren't building the host toolchain, skip building the target core.art. |
| 85 | ifeq ($(WITH_HOST_DALVIK),true) |
Brian Carlstrom | dc959ea | 2013-10-28 00:44:49 -0700 | [diff] [blame] | 86 | ifeq ($(ART_BUILD_TARGET),true) |
| 87 | include $(CLEAR_VARS) |
| 88 | LOCAL_MODULE := core.art |
| 89 | LOCAL_MODULE_TAGS := optional |
| 90 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk |
| 91 | LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.oat.mk |
| 92 | LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_CORE_IMG_OUT) |
| 93 | include $(BUILD_PHONY_PACKAGE) |
Brian Carlstrom | 660f8f0 | 2014-01-28 16:05:27 -0800 | [diff] [blame] | 94 | endif # ART_BUILD_TARGET |
| 95 | endif # WITH_HOST_DALVIK |