blob: d06b200b1211465af59c411bfb299f055ead5c45 [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
17ART_HOST_EXECUTABLES :=
18ART_TARGET_EXECUTABLES :=
19
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080020ART_EXECUTABLES_CFLAGS :=
21ifeq ($(ART_USE_LLVM_COMPILER),true)
22 ART_EXECUTABLES_CFLAGS += -DART_USE_LLVM_COMPILER=1
23endif
buzbeec531cef2012-10-18 07:09:20 -070024ifeq ($(ART_USE_PORTABLE_COMPILER),true)
25 ART_EXECUTABLES_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -070026endif
27
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070028# $(1): executable ("d" will be appended for debug version)
29# $(2): source
30# $(3): target or host
31# $(4): ndebug or debug
32define build-art-executable
Brian Carlstrom0796af02011-10-12 14:31:45 -070033 ifneq ($(3),target)
34 ifneq ($(3),host)
35 $$(error expected target or host for argument 3, received $(3))
36 endif
37 endif
38 ifneq ($(4),ndebug)
39 ifneq ($(4),debug)
40 $$(error expected ndebug or debug for argument 4, received $(4))
41 endif
42 endif
43
44 art_executable := $(1)
45 art_source := $(2)
46 art_target_or_host := $(3)
47 art_ndebug_or_debug := $(4)
48
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070049 include $(CLEAR_VARS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070050 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070051 include external/stlport/libstlport.mk
52 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070053
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070054 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070055 LOCAL_MODULE_TAGS := optional
Brian Carlstrom0796af02011-10-12 14:31:45 -070056 LOCAL_SRC_FILES := $$(art_source)
57 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
58 LOCAL_SHARED_LIBRARIES := libnativehelper
59
60 ifeq ($$(art_ndebug_or_debug),ndebug)
61 LOCAL_MODULE := $$(art_executable)
62 else #debug
63 LOCAL_MODULE := $$(art_executable)d
Elliott Hughes1d3f1142011-09-13 12:00:00 -070064 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070065
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080066 LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS)
Brian Carlstrom89521892011-12-07 22:05:07 -080067 ifeq ($$(art_target_or_host),target)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080068 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070069 ifeq ($$(art_ndebug_or_debug),debug)
Brian Carlstrom86927212011-09-15 11:31:11 -070070 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070071 else
72 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070073 endif
74 else # host
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080075 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070076 ifeq ($$(art_ndebug_or_debug),debug)
Brian Carlstrom86927212011-09-15 11:31:11 -070077 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070078 else
79 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
Brian Carlstrom86927212011-09-15 11:31:11 -070080 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070081 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070082
83 ifeq ($$(art_ndebug_or_debug),ndebug)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070084 LOCAL_SHARED_LIBRARIES += libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070085 else # debug
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070086 LOCAL_SHARED_LIBRARIES += libartd
Elliott Hughes06e3ad42012-02-07 14:51:57 -080087 ifeq ($$(art_target_or_host),target)
88 LOCAL_SHARED_LIBRARIES += libdynamic_annotations
89 else
90 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host
91 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070092 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070093
94 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070095 LOCAL_SHARED_LIBRARIES += libstlport
96 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070097
98 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070099 include $(BUILD_EXECUTABLE)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700100 ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
101 else # host
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
107
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700108ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
109 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,ndebug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700110 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700111 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700112endif
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700113ifeq ($(ART_BUILD_TARGET_DEBUG),true)
114 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,debug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700115 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,debug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700116 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug))
117endif
118ifeq ($(ART_BUILD_HOST_NDEBUG),true)
119 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700120 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700121 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700122endif
123ifeq ($(ART_BUILD_HOST_DEBUG),true)
124 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700125 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700126 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700127endif