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 |
Colin Cross | d747543 | 2014-03-20 12:55:13 -0700 | [diff] [blame] | 33 | # $(7): value for LOCAL_MULTILIB (empty means default) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 34 | define build-art-executable |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 35 | ifneq ($(5),target) |
| 36 | ifneq ($(5),host) |
| 37 | $$(error expected target or host for argument 5, received $(5)) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 38 | endif |
| 39 | endif |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 40 | ifneq ($(6),ndebug) |
| 41 | ifneq ($(6),debug) |
| 42 | $$(error expected ndebug or debug for argument 6, received $(6)) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 43 | endif |
| 44 | endif |
| 45 | |
| 46 | art_executable := $(1) |
| 47 | art_source := $(2) |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 48 | art_shared_libraries := $(3) |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 49 | art_c_includes := $(4) |
| 50 | art_target_or_host := $(5) |
| 51 | art_ndebug_or_debug := $(6) |
Colin Cross | d747543 | 2014-03-20 12:55:13 -0700 | [diff] [blame] | 52 | art_multilib := $(7) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 53 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 54 | include $(CLEAR_VARS) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 55 | LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 56 | LOCAL_MODULE_TAGS := optional |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 57 | LOCAL_SRC_FILES := $$(art_source) |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 58 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime $$(art_c_includes) |
Ian Rogers | ba0c51f | 2014-05-16 12:26:00 -0700 | [diff] [blame] | 59 | LOCAL_SHARED_LIBRARIES += $$(art_shared_libraries) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 60 | |
| 61 | ifeq ($$(art_ndebug_or_debug),ndebug) |
| 62 | LOCAL_MODULE := $$(art_executable) |
| 63 | else #debug |
| 64 | LOCAL_MODULE := $$(art_executable)d |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 65 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 66 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 67 | LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS) |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 68 | ifeq ($$(art_target_or_host),target) |
Andreas Gampe | 5ca4eaa | 2014-05-29 02:09:33 -0700 | [diff] [blame] | 69 | $(call set-target-local-clang-vars) |
| 70 | $(call set-target-local-cflags-vars,$(6)) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 71 | else # host |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 72 | LOCAL_CLANG := $(ART_HOST_CLANG) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 73 | LOCAL_CFLAGS += $(ART_HOST_CFLAGS) |
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_HOST_DEBUG_CFLAGS) |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 76 | else |
| 77 | LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 78 | endif |
Andrew Hsieh | cae10f7 | 2014-04-01 11:52:01 +0800 | [diff] [blame] | 79 | LOCAL_LDLIBS += -lpthread |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 80 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 81 | |
| 82 | ifeq ($$(art_ndebug_or_debug),ndebug) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 83 | LOCAL_SHARED_LIBRARIES += libart |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 84 | else # debug |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 85 | LOCAL_SHARED_LIBRARIES += libartd |
| 86 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 87 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 88 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk |
| 89 | LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.executable.mk |
Brian Carlstrom | fa42b44 | 2013-06-17 12:53:45 -0700 | [diff] [blame] | 90 | |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 91 | ifeq ($$(art_target_or_host),target) |
Colin Cross | dc781a1 | 2014-02-04 16:22:03 -0800 | [diff] [blame] | 92 | LOCAL_MODULE_TARGET_ARCH := $(ART_SUPPORTED_ARCH) |
Colin Cross | d747543 | 2014-03-20 12:55:13 -0700 | [diff] [blame] | 93 | LOCAL_MULTILIB := $$(art_multilib) |
Colin Cross | dc781a1 | 2014-02-04 16:22:03 -0800 | [diff] [blame] | 94 | endif |
| 95 | |
Dan Albert | 2a0e954 | 2014-05-21 14:55:02 -0700 | [diff] [blame] | 96 | include external/libcxx/libcxx.mk |
Colin Cross | dc781a1 | 2014-02-04 16:22:03 -0800 | [diff] [blame] | 97 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 98 | include $(BUILD_EXECUTABLE) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 99 | ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE) |
| 100 | else # host |
Ian Rogers | bd5ea6a | 2014-04-16 16:34:44 -0700 | [diff] [blame] | 101 | LOCAL_IS_HOST_MODULE := true |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 102 | include $(BUILD_HOST_EXECUTABLE) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 103 | ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 104 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 105 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 106 | endef |