summaryrefslogtreecommitdiffstats
path: root/build/Android.executable.mk
blob: 5f139ee9fd16ecc3601961892c6629ab6ee940ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#
# Copyright (C) 2011 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

ART_HOST_EXECUTABLES :=
ART_TARGET_EXECUTABLES :=

ART_EXECUTABLES_CFLAGS :=
ifeq ($(ART_USE_LLVM_COMPILER),true)
  ART_EXECUTABLES_CFLAGS += -DART_USE_LLVM_COMPILER=1
endif

# $(1): executable ("d" will be appended for debug version)
# $(2): source
# $(3): target or host
# $(4): ndebug or debug
define build-art-executable
  ifneq ($(3),target)
    ifneq ($(3),host)
      $$(error expected target or host for argument 3, received $(3))
    endif
  endif
  ifneq ($(4),ndebug)
    ifneq ($(4),debug)
      $$(error expected ndebug or debug for argument 4, received $(4))
    endif
  endif

  art_executable := $(1)
  art_source := $(2)
  art_target_or_host := $(3)
  art_ndebug_or_debug := $(4)

  include $(CLEAR_VARS)
  ifeq ($$(art_target_or_host),target)
    include external/stlport/libstlport.mk
  endif

  LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
  LOCAL_MODULE_TAGS := optional
  LOCAL_SRC_FILES := $$(art_source)
  LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
  LOCAL_SHARED_LIBRARIES := libnativehelper

  ifeq ($$(art_ndebug_or_debug),ndebug)
    LOCAL_MODULE := $$(art_executable)
  else #debug
    LOCAL_MODULE := $$(art_executable)d
  endif

  LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS)
  ifeq ($$(art_target_or_host),target)
    LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
    ifeq ($$(art_ndebug_or_debug),debug)
      LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
    else
      LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
    endif
  else # host
    LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
    ifeq ($$(art_ndebug_or_debug),debug)
      LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
    else
      LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
    endif
  endif

  ifeq ($$(art_ndebug_or_debug),ndebug)
    LOCAL_SHARED_LIBRARIES += libart
  else # debug
    LOCAL_SHARED_LIBRARIES += libartd
    ifeq ($$(art_target_or_host),target)
      LOCAL_SHARED_LIBRARIES += libdynamic_annotations
    else
      LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host
    endif
  endif

  ifeq ($$(art_target_or_host),target)
    LOCAL_SHARED_LIBRARIES += libstlport
  endif

  ifeq ($$(art_target_or_host),target)
    include $(BUILD_EXECUTABLE)
    ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
  else # host
    include $(BUILD_HOST_EXECUTABLE)
    ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
  endif

endef

ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,ndebug))
  $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,ndebug))
  $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,ndebug))
endif
ifeq ($(ART_BUILD_TARGET_DEBUG),true)
  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,debug))
  $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,debug))
  $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug))
endif
ifeq ($(ART_BUILD_HOST_NDEBUG),true)
  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug))
  $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,ndebug))
  $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug))
endif
ifeq ($(ART_BUILD_HOST_DEBUG),true)
  $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug))
  $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,debug))
  $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug))
endif