blob: 3f0280bb3931df5bebcb2b75e9ca42e6685b679b [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
24
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070025ifeq ($(ART_USE_GREENLAND_COMPILER),true)
26 ART_EXECUTABLES_CFLAGS += -DART_USE_GREENLAND_COMPILER=1
27endif
28
buzbee2cfc6392012-05-07 14:51:40 -070029ifeq ($(ART_USE_QUICK_COMPILER),true)
30 ART_EXECUTABLES_CFLAGS += -DART_USE_QUICK_COMPILER=1
31endif
32
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070033# $(1): executable ("d" will be appended for debug version)
34# $(2): source
35# $(3): target or host
36# $(4): ndebug or debug
37define build-art-executable
Brian Carlstrom0796af02011-10-12 14:31:45 -070038 ifneq ($(3),target)
39 ifneq ($(3),host)
40 $$(error expected target or host for argument 3, received $(3))
41 endif
42 endif
43 ifneq ($(4),ndebug)
44 ifneq ($(4),debug)
45 $$(error expected ndebug or debug for argument 4, received $(4))
46 endif
47 endif
48
49 art_executable := $(1)
50 art_source := $(2)
51 art_target_or_host := $(3)
52 art_ndebug_or_debug := $(4)
53
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070054 include $(CLEAR_VARS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070055 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070056 include external/stlport/libstlport.mk
57 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070058
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070059 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070060 LOCAL_MODULE_TAGS := optional
Brian Carlstrom0796af02011-10-12 14:31:45 -070061 LOCAL_SRC_FILES := $$(art_source)
62 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
63 LOCAL_SHARED_LIBRARIES := libnativehelper
64
65 ifeq ($$(art_ndebug_or_debug),ndebug)
66 LOCAL_MODULE := $$(art_executable)
67 else #debug
68 LOCAL_MODULE := $$(art_executable)d
Elliott Hughes1d3f1142011-09-13 12:00:00 -070069 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070070
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080071 LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS)
Brian Carlstrom89521892011-12-07 22:05:07 -080072 ifeq ($$(art_target_or_host),target)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080073 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070074 ifeq ($$(art_ndebug_or_debug),debug)
Brian Carlstrom86927212011-09-15 11:31:11 -070075 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070076 else
77 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070078 endif
79 else # host
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080080 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070081 ifeq ($$(art_ndebug_or_debug),debug)
Brian Carlstrom86927212011-09-15 11:31:11 -070082 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070083 else
84 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
Brian Carlstrom86927212011-09-15 11:31:11 -070085 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070086 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070087
88 ifeq ($$(art_ndebug_or_debug),ndebug)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070089 LOCAL_SHARED_LIBRARIES += libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070090 else # debug
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070091 LOCAL_SHARED_LIBRARIES += libartd
Elliott Hughes06e3ad42012-02-07 14:51:57 -080092 ifeq ($$(art_target_or_host),target)
93 LOCAL_SHARED_LIBRARIES += libdynamic_annotations
94 else
95 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host
96 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070097 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070098
99 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700100 LOCAL_SHARED_LIBRARIES += libstlport
101 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -0700102
103 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700104 include $(BUILD_EXECUTABLE)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700105 ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
106 else # host
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700107 include $(BUILD_HOST_EXECUTABLE)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700108 ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700109 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -0700110
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700111endef
112
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700113ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
114 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,ndebug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700115 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700116 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700117endif
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700118ifeq ($(ART_BUILD_TARGET_DEBUG),true)
119 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,debug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700120 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,debug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700121 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug))
122endif
123ifeq ($(ART_BUILD_HOST_NDEBUG),true)
124 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700125 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700126 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700127endif
128ifeq ($(ART_BUILD_HOST_DEBUG),true)
129 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700130 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700131 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700132endif