blob: 49e73841e4c149e6250991d9eefa3077cd4e281d [file] [log] [blame]
Brian Carlstrom69b15fb2011-09-03 12:25:21 -07001#
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
Brian Carlstrom7940e442013-07-12 13:46:57 -070017include art/build/Android.common.mk
Brian Carlstrom51c24672013-07-11 16:00:56 -070018
Brian Carlstromfa50baa2013-08-02 01:00:27 -070019ART_HOST_EXECUTABLES ?=
20ART_TARGET_EXECUTABLES ?=
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070021
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080022ART_EXECUTABLES_CFLAGS :=
buzbeec531cef2012-10-18 07:09:20 -070023ifeq ($(ART_USE_PORTABLE_COMPILER),true)
24 ART_EXECUTABLES_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -070025endif
26
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070027# $(1): executable ("d" will be appended for debug version)
28# $(2): source
Brian Carlstrom7940e442013-07-12 13:46:57 -070029# $(3): extra shared libraries
30# $(4): extra include directories
31# $(5): target or host
32# $(6): ndebug or debug
Colin Crossd7475432014-03-20 12:55:13 -070033# $(7): value for LOCAL_MULTILIB (empty means default)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070034define build-art-executable
Brian Carlstrom7940e442013-07-12 13:46:57 -070035 ifneq ($(5),target)
36 ifneq ($(5),host)
37 $$(error expected target or host for argument 5, received $(5))
Brian Carlstrom0796af02011-10-12 14:31:45 -070038 endif
39 endif
Brian Carlstrom7940e442013-07-12 13:46:57 -070040 ifneq ($(6),ndebug)
41 ifneq ($(6),debug)
42 $$(error expected ndebug or debug for argument 6, received $(6))
Brian Carlstrom0796af02011-10-12 14:31:45 -070043 endif
44 endif
45
46 art_executable := $(1)
47 art_source := $(2)
Brian Carlstrom51c24672013-07-11 16:00:56 -070048 art_shared_libraries := $(3)
Brian Carlstrom7940e442013-07-12 13:46:57 -070049 art_c_includes := $(4)
50 art_target_or_host := $(5)
51 art_ndebug_or_debug := $(6)
Colin Crossd7475432014-03-20 12:55:13 -070052 art_multilib := $(7)
Brian Carlstrom0796af02011-10-12 14:31:45 -070053
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070054 include $(CLEAR_VARS)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070055 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070056 LOCAL_MODULE_TAGS := optional
Brian Carlstrom0796af02011-10-12 14:31:45 -070057 LOCAL_SRC_FILES := $$(art_source)
Brian Carlstrom7940e442013-07-12 13:46:57 -070058 LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime $$(art_c_includes)
Ian Rogersba0c51f2014-05-16 12:26:00 -070059 LOCAL_SHARED_LIBRARIES += $$(art_shared_libraries)
Brian Carlstrom0796af02011-10-12 14:31:45 -070060
61 ifeq ($$(art_ndebug_or_debug),ndebug)
62 LOCAL_MODULE := $$(art_executable)
63 else #debug
64 LOCAL_MODULE := $$(art_executable)d
Elliott Hughes1d3f1142011-09-13 12:00:00 -070065 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070066
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080067 LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS)
Brian Carlstrom89521892011-12-07 22:05:07 -080068 ifeq ($$(art_target_or_host),target)
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -070069 $(call set-target-local-clang-vars)
70 $(call set-target-local-cflags-vars,$(6))
Brian Carlstrom0796af02011-10-12 14:31:45 -070071 else # host
Ian Rogerscd5d0422013-05-17 15:54:01 -070072 LOCAL_CLANG := $(ART_HOST_CLANG)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080073 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070074 ifeq ($$(art_ndebug_or_debug),debug)
Brian Carlstrom86927212011-09-15 11:31:11 -070075 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070076 else
77 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
Brian Carlstrom86927212011-09-15 11:31:11 -070078 endif
Andrew Hsiehcae10f72014-04-01 11:52:01 +080079 LOCAL_LDLIBS += -lpthread
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070080 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070081
82 ifeq ($$(art_ndebug_or_debug),ndebug)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070083 LOCAL_SHARED_LIBRARIES += libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070084 else # debug
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070085 LOCAL_SHARED_LIBRARIES += libartd
86 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070087
Brian Carlstrom7940e442013-07-12 13:46:57 -070088 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk
89 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.executable.mk
Brian Carlstromfa42b442013-06-17 12:53:45 -070090
Brian Carlstrom0796af02011-10-12 14:31:45 -070091 ifeq ($$(art_target_or_host),target)
Colin Crossdc781a12014-02-04 16:22:03 -080092 LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH)
Colin Crossd7475432014-03-20 12:55:13 -070093 LOCAL_MULTILIB := $$(art_multilib)
Colin Crossdc781a12014-02-04 16:22:03 -080094 endif
95
Dan Albert2a0e9542014-05-21 14:55:02 -070096 include external/libcxx/libcxx.mk
Colin Crossdc781a12014-02-04 16:22:03 -080097 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070098 include $(BUILD_EXECUTABLE)
Brian Carlstrom0796af02011-10-12 14:31:45 -070099 ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
100 else # host
Ian Rogersbd5ea6a2014-04-16 16:34:44 -0700101 LOCAL_IS_HOST_MODULE := true
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700102 include $(BUILD_HOST_EXECUTABLE)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700103 ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700104 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -0700105
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700106endef