blob: e74645cb30820f63eafbbeaf5fd0cc2296720d44 [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
Brian Carlstrom51c24672013-07-11 16:00:56 -070017DEX2OAT_SRC_FILES := \
18 src/dex2oat.cc
19
20OATDUMP_SRC_FILES := \
21 src/oatdump.cc
22
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070023ART_HOST_EXECUTABLES :=
24ART_TARGET_EXECUTABLES :=
25
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080026ART_EXECUTABLES_CFLAGS :=
buzbeec531cef2012-10-18 07:09:20 -070027ifeq ($(ART_USE_PORTABLE_COMPILER),true)
28 ART_EXECUTABLES_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -070029endif
30
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070031# $(1): executable ("d" will be appended for debug version)
32# $(2): source
Brian Carlstrom51c24672013-07-11 16:00:56 -070033# $(3): shared libraries
34# $(4): target or host
35# $(5): ndebug or debug
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070036define build-art-executable
Brian Carlstrom51c24672013-07-11 16:00:56 -070037 ifneq ($(4),target)
38 ifneq ($(4),host)
39 $$(error expected target or host for argument 4, received $(4))
Brian Carlstrom0796af02011-10-12 14:31:45 -070040 endif
41 endif
Brian Carlstrom51c24672013-07-11 16:00:56 -070042 ifneq ($(5),ndebug)
43 ifneq ($(5),debug)
44 $$(error expected ndebug or debug for argument 5, received $(5))
Brian Carlstrom0796af02011-10-12 14:31:45 -070045 endif
46 endif
47
48 art_executable := $(1)
49 art_source := $(2)
Brian Carlstrom51c24672013-07-11 16:00:56 -070050 art_shared_libraries := $(3)
51 art_target_or_host := $(4)
52 art_ndebug_or_debug := $(5)
Brian Carlstrom0796af02011-10-12 14:31:45 -070053
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)
Brian Carlstrom51c24672013-07-11 16:00:56 -070063 LOCAL_SHARED_LIBRARIES := $$(art_shared_libraries) # libnativehelper
Brian Carlstrom0796af02011-10-12 14:31:45 -070064
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)
Ian Rogerscd5d0422013-05-17 15:54:01 -070073 LOCAL_CLANG := $(ART_TARGET_CLANG)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080074 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070075 ifeq ($$(art_ndebug_or_debug),debug)
Brian Carlstrom86927212011-09-15 11:31:11 -070076 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070077 else
78 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070079 endif
80 else # host
Ian Rogerscd5d0422013-05-17 15:54:01 -070081 LOCAL_CLANG := $(ART_HOST_CLANG)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080082 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070083 ifeq ($$(art_ndebug_or_debug),debug)
Brian Carlstrom86927212011-09-15 11:31:11 -070084 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070085 else
86 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
Brian Carlstrom86927212011-09-15 11:31:11 -070087 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070088 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070089
90 ifeq ($$(art_ndebug_or_debug),ndebug)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070091 LOCAL_SHARED_LIBRARIES += libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070092 else # debug
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070093 LOCAL_SHARED_LIBRARIES += libartd
94 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070095
96 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070097 LOCAL_SHARED_LIBRARIES += libstlport
98 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070099
Brian Carlstrom51c24672013-07-11 16:00:56 -0700100 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/build/Android.common.mk
101 LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/build/Android.executable.mk
Brian Carlstromfa42b442013-06-17 12:53:45 -0700102
Brian Carlstrom0796af02011-10-12 14:31:45 -0700103 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)
Brian Carlstrom51c24672013-07-11 16:00:56 -0700114 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libart-compiler,target,ndebug))
115 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),,target,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700116endif
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700117ifeq ($(ART_BUILD_TARGET_DEBUG),true)
Brian Carlstrom51c24672013-07-11 16:00:56 -0700118 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libartd-compiler,target,debug))
119 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),,target,debug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700120endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800121
122# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
123ifeq ($(ART_BUILD_NDEBUG),true)
Brian Carlstrom51c24672013-07-11 16:00:56 -0700124 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libart-compiler,host,ndebug))
Brian Carlstrom265091e2013-01-30 14:08:26 -0800125endif
126ifeq ($(ART_BUILD_NDEBUG),true)
Brian Carlstrom51c24672013-07-11 16:00:56 -0700127 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),libartd-compiler,host,debug))
Brian Carlstrom265091e2013-01-30 14:08:26 -0800128endif
129
130ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Brian Carlstrom51c24672013-07-11 16:00:56 -0700131 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),,host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700132endif
133ifeq ($(ART_BUILD_HOST_DEBUG),true)
Brian Carlstrom51c24672013-07-11 16:00:56 -0700134 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),,host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700135endif