• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 include art/build/Android.common_build.mk
18 
19 ART_HOST_EXECUTABLES ?=
20 ART_TARGET_EXECUTABLES ?=
21 
22 ART_EXECUTABLES_CFLAGS :=
23 ifeq ($(ART_USE_PORTABLE_COMPILER),true)
24   ART_EXECUTABLES_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
25 endif
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
33 # $(7): value for LOCAL_MULTILIB (empty means default)
34 define build-art-executable
35   ifneq ($(5),target)
36     ifneq ($(5),host)
37       $$(error expected target or host for argument 5, received $(5))
38     endif
39   endif
40   ifneq ($(6),ndebug)
41     ifneq ($(6),debug)
42       $$(error expected ndebug or debug for argument 6, received $(6))
43     endif
44   endif
45 
46   art_executable := $(1)
47   art_source := $(2)
48   art_shared_libraries := $(3)
49   art_c_includes := $(4)
50   art_target_or_host := $(5)
51   art_ndebug_or_debug := $(6)
52   art_multilib := $(7)
53 
54   include $(CLEAR_VARS)
55   LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
56   LOCAL_MODULE_TAGS := optional
57   LOCAL_SRC_FILES := $$(art_source)
58   LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime $$(art_c_includes)
59   LOCAL_SHARED_LIBRARIES += $$(art_shared_libraries)
60 
61   ifeq ($$(art_ndebug_or_debug),ndebug)
62     LOCAL_MODULE := $$(art_executable)
63   else #debug
64     LOCAL_MODULE := $$(art_executable)d
65   endif
66 
67   LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS)
68   ifeq ($$(art_target_or_host),target)
69   	$(call set-target-local-clang-vars)
70   	$(call set-target-local-cflags-vars,$(6))
71   else # host
72     LOCAL_CLANG := $(ART_HOST_CLANG)
73     LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
74     ifeq ($$(art_ndebug_or_debug),debug)
75       LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
76     else
77       LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
78     endif
79     LOCAL_LDLIBS += -lpthread
80   endif
81 
82   ifeq ($$(art_ndebug_or_debug),ndebug)
83     LOCAL_SHARED_LIBRARIES += libart
84   else # debug
85     LOCAL_SHARED_LIBRARIES += libartd
86   endif
87 
88   LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
89   LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.executable.mk
90 
91   ifeq ($$(art_target_or_host),target)
92     LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH)
93   endif
94   LOCAL_MULTILIB := $$(art_multilib)
95 
96   include external/libcxx/libcxx.mk
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     LOCAL_IS_HOST_MODULE := true
102     include $(BUILD_HOST_EXECUTABLE)
103     ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
104   endif
105 
106 endef
107