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 | |
| 17 | ART_HOST_EXECUTABLES := |
| 18 | ART_TARGET_EXECUTABLES := |
| 19 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 20 | ART_EXECUTABLES_CFLAGS := |
| 21 | ifeq ($(ART_USE_LLVM_COMPILER),true) |
| 22 | ART_EXECUTABLES_CFLAGS += -DART_USE_LLVM_COMPILER=1 |
Shih-wei Liao | 21d28f5 | 2012-06-12 05:55:00 -0700 | [diff] [blame] | 23 | ifeq ($(ART_USE_DEXLANG_FRONTEND),true) |
| 24 | ART_EXECUTABLES_CFLAGS += -DART_USE_DEXLANG_FRONTEND=1 |
| 25 | endif |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 26 | endif |
| 27 | |
Shih-wei Liao | e94d9b2 | 2012-05-22 09:01:24 -0700 | [diff] [blame] | 28 | ifeq ($(ART_USE_GREENLAND_COMPILER),true) |
| 29 | ART_EXECUTABLES_CFLAGS += -DART_USE_GREENLAND_COMPILER=1 |
| 30 | endif |
| 31 | |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 32 | ifeq ($(ART_USE_QUICK_COMPILER),true) |
| 33 | ART_EXECUTABLES_CFLAGS += -DART_USE_QUICK_COMPILER=1 |
| 34 | endif |
| 35 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 36 | # $(1): executable ("d" will be appended for debug version) |
| 37 | # $(2): source |
| 38 | # $(3): target or host |
| 39 | # $(4): ndebug or debug |
| 40 | define build-art-executable |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 41 | ifneq ($(3),target) |
| 42 | ifneq ($(3),host) |
| 43 | $$(error expected target or host for argument 3, received $(3)) |
| 44 | endif |
| 45 | endif |
| 46 | ifneq ($(4),ndebug) |
| 47 | ifneq ($(4),debug) |
| 48 | $$(error expected ndebug or debug for argument 4, received $(4)) |
| 49 | endif |
| 50 | endif |
| 51 | |
| 52 | art_executable := $(1) |
| 53 | art_source := $(2) |
| 54 | art_target_or_host := $(3) |
| 55 | art_ndebug_or_debug := $(4) |
| 56 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 57 | include $(CLEAR_VARS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 58 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 59 | include external/stlport/libstlport.mk |
| 60 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 61 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 62 | LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 63 | LOCAL_MODULE_TAGS := optional |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 64 | LOCAL_SRC_FILES := $$(art_source) |
| 65 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) |
| 66 | LOCAL_SHARED_LIBRARIES := libnativehelper |
| 67 | |
| 68 | ifeq ($$(art_ndebug_or_debug),ndebug) |
| 69 | LOCAL_MODULE := $$(art_executable) |
| 70 | else #debug |
| 71 | LOCAL_MODULE := $$(art_executable)d |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 72 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 73 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 74 | LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS) |
Brian Carlstrom | 8952189 | 2011-12-07 22:05:07 -0800 | [diff] [blame] | 75 | ifeq ($$(art_target_or_host),target) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 76 | LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 77 | ifeq ($$(art_ndebug_or_debug),debug) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 78 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 79 | else |
| 80 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 81 | endif |
| 82 | else # host |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 83 | LOCAL_CFLAGS += $(ART_HOST_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 84 | ifeq ($$(art_ndebug_or_debug),debug) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 85 | LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 86 | else |
| 87 | LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 88 | endif |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 89 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 90 | |
| 91 | ifeq ($$(art_ndebug_or_debug),ndebug) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 92 | LOCAL_SHARED_LIBRARIES += libart |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 93 | else # debug |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 94 | LOCAL_SHARED_LIBRARIES += libartd |
Elliott Hughes | 06e3ad4 | 2012-02-07 14:51:57 -0800 | [diff] [blame] | 95 | ifeq ($$(art_target_or_host),target) |
| 96 | LOCAL_SHARED_LIBRARIES += libdynamic_annotations |
| 97 | else |
| 98 | LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host |
| 99 | endif |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 100 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 101 | |
| 102 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 103 | LOCAL_SHARED_LIBRARIES += libstlport |
| 104 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 105 | |
| 106 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 107 | include $(BUILD_EXECUTABLE) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 108 | ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE) |
| 109 | else # host |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 110 | include $(BUILD_HOST_EXECUTABLE) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 111 | ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 112 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 113 | |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 114 | endef |
| 115 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 116 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 117 | $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,ndebug)) |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 118 | $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,ndebug)) |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 119 | $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,ndebug)) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 120 | endif |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 121 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 122 | $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,debug)) |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 123 | $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,debug)) |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 124 | $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug)) |
| 125 | endif |
| 126 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
| 127 | $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug)) |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 128 | $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,ndebug)) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 129 | $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug)) |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 130 | endif |
| 131 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
| 132 | $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug)) |
Brian Carlstrom | 78128a6 | 2011-09-15 17:21:19 -0700 | [diff] [blame] | 133 | $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,debug)) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 134 | $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug)) |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 135 | endif |