Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 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 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 17 | include art/build/Android.common.mk |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 18 | |
Brian Carlstrom | fa50baa | 2013-08-02 01:00:27 -0700 | [diff] [blame] | 19 | ART_HOST_EXECUTABLES ?= |
| 20 | ART_TARGET_EXECUTABLES ?= |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 21 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 22 | ART_EXECUTABLES_CFLAGS := |
buzbee | c531cef | 2012-10-18 07:09:20 -0700 | [diff] [blame] | 23 | ifeq ($(ART_USE_PORTABLE_COMPILER),true) |
| 24 | ART_EXECUTABLES_CFLAGS += -DART_USE_PORTABLE_COMPILER=1 |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 25 | endif |
| 26 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 27 | # $(1): executable ("d" will be appended for debug version) |
| 28 | # $(2): source |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 29 | # $(3): extra shared libraries |
| 30 | # $(4): extra include directories |
| 31 | # $(5): target or host |
| 32 | # $(6): ndebug or debug |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 33 | define build-art-executable |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 34 | ifneq ($(5),target) |
| 35 | ifneq ($(5),host) |
| 36 | $$(error expected target or host for argument 5, received $(5)) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 37 | endif |
| 38 | endif |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 39 | ifneq ($(6),ndebug) |
| 40 | ifneq ($(6),debug) |
| 41 | $$(error expected ndebug or debug for argument 6, received $(6)) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 42 | endif |
| 43 | endif |
| 44 | |
| 45 | art_executable := $(1) |
| 46 | art_source := $(2) |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 47 | art_shared_libraries := $(3) |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 48 | art_c_includes := $(4) |
| 49 | art_target_or_host := $(5) |
| 50 | art_ndebug_or_debug := $(6) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 51 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 52 | include $(CLEAR_VARS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 53 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 54 | include external/stlport/libstlport.mk |
| 55 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 56 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 57 | LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 58 | LOCAL_MODULE_TAGS := optional |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 59 | LOCAL_SRC_FILES := $$(art_source) |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 60 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime $$(art_c_includes) |
Elliott Hughes | 025218c | 2013-07-30 17:13:06 -0700 | [diff] [blame] | 61 | LOCAL_SHARED_LIBRARIES += $$(art_shared_libraries) # libnativehelper |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 62 | |
| 63 | ifeq ($$(art_ndebug_or_debug),ndebug) |
| 64 | LOCAL_MODULE := $$(art_executable) |
| 65 | else #debug |
| 66 | LOCAL_MODULE := $$(art_executable)d |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 67 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 68 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 69 | LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS) |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 70 | ifeq ($$(art_target_or_host),target) |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 71 | LOCAL_CLANG := $(ART_TARGET_CLANG) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 72 | LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) |
Colin Cross | dc781a1 | 2014-02-04 16:22:03 -0800 | [diff] [blame^] | 73 | LOCAL_CFLAGS_x86 += $(ART_TARGET_CFLAGS_x86) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 74 | ifeq ($$(art_ndebug_or_debug),debug) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 75 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 76 | else |
| 77 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 78 | endif |
| 79 | else # host |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 80 | LOCAL_CLANG := $(ART_HOST_CLANG) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 81 | LOCAL_CFLAGS += $(ART_HOST_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 82 | ifeq ($$(art_ndebug_or_debug),debug) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 83 | LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 84 | else |
| 85 | LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 86 | endif |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 87 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 88 | |
| 89 | ifeq ($$(art_ndebug_or_debug),ndebug) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 90 | LOCAL_SHARED_LIBRARIES += libart |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 91 | else # debug |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 92 | LOCAL_SHARED_LIBRARIES += libartd |
| 93 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 94 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 95 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk |
| 96 | LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.executable.mk |
Brian Carlstrom | fa42b44 | 2013-06-17 12:53:45 -0700 | [diff] [blame] | 97 | |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 98 | ifeq ($$(art_target_or_host),target) |
Colin Cross | dc781a1 | 2014-02-04 16:22:03 -0800 | [diff] [blame^] | 99 | LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH) |
| 100 | endif |
| 101 | |
| 102 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 103 | include $(BUILD_EXECUTABLE) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 104 | ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE) |
| 105 | else # host |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 106 | include $(BUILD_HOST_EXECUTABLE) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 107 | ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 108 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 109 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 110 | endef |