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 17include art/build/Android.common.mk 18 19ART_HOST_EXECUTABLES ?= 20ART_TARGET_EXECUTABLES ?= 21 22ART_EXECUTABLES_CFLAGS := 23ifeq ($(ART_USE_PORTABLE_COMPILER),true) 24 ART_EXECUTABLES_CFLAGS += -DART_USE_PORTABLE_COMPILER=1 25endif 26 27# $(1): executable ("d" will be appended for debug version) 28# $(2): source 29# $(3): extra shared libraries 30# $(4): extra include directories 31# $(5): target or host 32# $(6): ndebug or debug 33define build-art-executable 34 ifneq ($(5),target) 35 ifneq ($(5),host) 36 $$(error expected target or host for argument 5, received $(5)) 37 endif 38 endif 39 ifneq ($(6),ndebug) 40 ifneq ($(6),debug) 41 $$(error expected ndebug or debug for argument 6, received $(6)) 42 endif 43 endif 44 45 art_executable := $(1) 46 art_source := $(2) 47 art_shared_libraries := $(3) 48 art_c_includes := $(4) 49 art_target_or_host := $(5) 50 art_ndebug_or_debug := $(6) 51 52 include $(CLEAR_VARS) 53 ifeq ($$(art_target_or_host),target) 54 include external/stlport/libstlport.mk 55 endif 56 57 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) 58 LOCAL_MODULE_TAGS := optional 59 LOCAL_SRC_FILES := $$(art_source) 60 LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime $$(art_c_includes) 61 LOCAL_SHARED_LIBRARIES += $$(art_shared_libraries) # libnativehelper 62 63 ifeq ($$(art_ndebug_or_debug),ndebug) 64 LOCAL_MODULE := $$(art_executable) 65 else #debug 66 LOCAL_MODULE := $$(art_executable)d 67 endif 68 69 LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS) 70 ifeq ($$(art_target_or_host),target) 71 LOCAL_CLANG := $(ART_TARGET_CLANG) 72 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) 73 ifeq ($$(art_ndebug_or_debug),debug) 74 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) 75 else 76 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) 77 endif 78 else # host 79 LOCAL_CLANG := $(ART_HOST_CLANG) 80 LOCAL_CFLAGS += $(ART_HOST_CFLAGS) 81 ifeq ($$(art_ndebug_or_debug),debug) 82 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) 83 else 84 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) 85 endif 86 endif 87 88 ifeq ($$(art_ndebug_or_debug),ndebug) 89 LOCAL_SHARED_LIBRARIES += libart 90 else # debug 91 LOCAL_SHARED_LIBRARIES += libartd 92 endif 93 94 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk 95 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.executable.mk 96 97 ifeq ($$(art_target_or_host),target) 98 include $(BUILD_EXECUTABLE) 99 ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE) 100 else # host 101 include $(BUILD_HOST_EXECUTABLE) 102 ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE) 103 endif 104 105endef 106