Android.executable.mk revision dc781a13ddb4dabf646bb45d0c53b65cab948e5b
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    LOCAL_CFLAGS_x86 += $(ART_TARGET_CFLAGS_x86)
74    ifeq ($$(art_ndebug_or_debug),debug)
75      LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
76    else
77      LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
78    endif
79  else # host
80    LOCAL_CLANG := $(ART_HOST_CLANG)
81    LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
82    ifeq ($$(art_ndebug_or_debug),debug)
83      LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
84    else
85      LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
86    endif
87  endif
88
89  ifeq ($$(art_ndebug_or_debug),ndebug)
90    LOCAL_SHARED_LIBRARIES += libart
91  else # debug
92    LOCAL_SHARED_LIBRARIES += libartd
93  endif
94
95  LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk
96  LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.executable.mk
97
98  ifeq ($$(art_target_or_host),target)
99    LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH)
100  endif
101
102  ifeq ($$(art_target_or_host),target)
103    include $(BUILD_EXECUTABLE)
104    ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
105  else # host
106    include $(BUILD_HOST_EXECUTABLE)
107    ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
108  endif
109
110endef
111