Android.executable.mk revision 21d28f510eb590f52810c83f1f3f37fe5f4adf46
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 17ART_HOST_EXECUTABLES := 18ART_TARGET_EXECUTABLES := 19 20ART_EXECUTABLES_CFLAGS := 21ifeq ($(ART_USE_LLVM_COMPILER),true) 22 ART_EXECUTABLES_CFLAGS += -DART_USE_LLVM_COMPILER=1 23 ifeq ($(ART_USE_DEXLANG_FRONTEND),true) 24 ART_EXECUTABLES_CFLAGS += -DART_USE_DEXLANG_FRONTEND=1 25 endif 26endif 27 28ifeq ($(ART_USE_GREENLAND_COMPILER),true) 29 ART_EXECUTABLES_CFLAGS += -DART_USE_GREENLAND_COMPILER=1 30endif 31 32ifeq ($(ART_USE_QUICK_COMPILER),true) 33 ART_EXECUTABLES_CFLAGS += -DART_USE_QUICK_COMPILER=1 34endif 35 36# $(1): executable ("d" will be appended for debug version) 37# $(2): source 38# $(3): target or host 39# $(4): ndebug or debug 40define build-art-executable 41 ifneq ($(3),target) 42 ifneq ($(3),host) 43 $$(error expected target or host for argument 3, received $(3)) 44 endif 45 endif 46 ifneq ($(4),ndebug) 47 ifneq ($(4),debug) 48 $$(error expected ndebug or debug for argument 4, received $(4)) 49 endif 50 endif 51 52 art_executable := $(1) 53 art_source := $(2) 54 art_target_or_host := $(3) 55 art_ndebug_or_debug := $(4) 56 57 include $(CLEAR_VARS) 58 ifeq ($$(art_target_or_host),target) 59 include external/stlport/libstlport.mk 60 endif 61 62 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) 63 LOCAL_MODULE_TAGS := optional 64 LOCAL_SRC_FILES := $$(art_source) 65 LOCAL_C_INCLUDES += $(ART_C_INCLUDES) 66 LOCAL_SHARED_LIBRARIES := libnativehelper 67 68 ifeq ($$(art_ndebug_or_debug),ndebug) 69 LOCAL_MODULE := $$(art_executable) 70 else #debug 71 LOCAL_MODULE := $$(art_executable)d 72 endif 73 74 LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS) 75 ifeq ($$(art_target_or_host),target) 76 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) 77 ifeq ($$(art_ndebug_or_debug),debug) 78 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) 79 else 80 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) 81 endif 82 else # host 83 LOCAL_CFLAGS += $(ART_HOST_CFLAGS) 84 ifeq ($$(art_ndebug_or_debug),debug) 85 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) 86 else 87 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) 88 endif 89 endif 90 91 ifeq ($$(art_ndebug_or_debug),ndebug) 92 LOCAL_SHARED_LIBRARIES += libart 93 else # debug 94 LOCAL_SHARED_LIBRARIES += libartd 95 ifeq ($$(art_target_or_host),target) 96 LOCAL_SHARED_LIBRARIES += libdynamic_annotations 97 else 98 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host 99 endif 100 endif 101 102 ifeq ($$(art_target_or_host),target) 103 LOCAL_SHARED_LIBRARIES += libstlport 104 endif 105 106 ifeq ($$(art_target_or_host),target) 107 include $(BUILD_EXECUTABLE) 108 ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE) 109 else # host 110 include $(BUILD_HOST_EXECUTABLE) 111 ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE) 112 endif 113 114endef 115 116ifeq ($(ART_BUILD_TARGET_NDEBUG),true) 117 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,ndebug)) 118 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,ndebug)) 119 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,ndebug)) 120endif 121ifeq ($(ART_BUILD_TARGET_DEBUG),true) 122 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,debug)) 123 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,debug)) 124 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug)) 125endif 126ifeq ($(ART_BUILD_HOST_NDEBUG),true) 127 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug)) 128 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,ndebug)) 129 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug)) 130endif 131ifeq ($(ART_BUILD_HOST_DEBUG),true) 132 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug)) 133 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,debug)) 134 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug)) 135endif 136