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