blob: ee968a77f27b03c56e606d497a1c83ab6e9e0042 [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 :=
buzbeec531cef2012-10-18 07:09:20 -070021ifeq ($(ART_USE_PORTABLE_COMPILER),true)
22 ART_EXECUTABLES_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -070023endif
24
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070025# $(1): executable ("d" will be appended for debug version)
26# $(2): source
27# $(3): target or host
28# $(4): ndebug or debug
29define build-art-executable
Brian Carlstrom0796af02011-10-12 14:31:45 -070030 ifneq ($(3),target)
31 ifneq ($(3),host)
32 $$(error expected target or host for argument 3, received $(3))
33 endif
34 endif
35 ifneq ($(4),ndebug)
36 ifneq ($(4),debug)
37 $$(error expected ndebug or debug for argument 4, received $(4))
38 endif
39 endif
40
41 art_executable := $(1)
42 art_source := $(2)
43 art_target_or_host := $(3)
44 art_ndebug_or_debug := $(4)
45
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070046 include $(CLEAR_VARS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070047 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070048 include external/stlport/libstlport.mk
49 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070050
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070051 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070052 LOCAL_MODULE_TAGS := optional
Brian Carlstrom0796af02011-10-12 14:31:45 -070053 LOCAL_SRC_FILES := $$(art_source)
54 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
55 LOCAL_SHARED_LIBRARIES := libnativehelper
56
57 ifeq ($$(art_ndebug_or_debug),ndebug)
58 LOCAL_MODULE := $$(art_executable)
59 else #debug
60 LOCAL_MODULE := $$(art_executable)d
Elliott Hughes1d3f1142011-09-13 12:00:00 -070061 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070062
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080063 LOCAL_CFLAGS := $(ART_EXECUTABLES_CFLAGS)
Brian Carlstrom89521892011-12-07 22:05:07 -080064 ifeq ($$(art_target_or_host),target)
Ian Rogerscd5d0422013-05-17 15:54:01 -070065 LOCAL_CLANG := $(ART_TARGET_CLANG)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080066 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070067 ifeq ($$(art_ndebug_or_debug),debug)
Brian Carlstrom86927212011-09-15 11:31:11 -070068 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070069 else
70 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070071 endif
72 else # host
Ian Rogerscd5d0422013-05-17 15:54:01 -070073 LOCAL_CLANG := $(ART_HOST_CLANG)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080074 LOCAL_CFLAGS += $(ART_HOST_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_HOST_DEBUG_CFLAGS)
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070077 else
78 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
Brian Carlstrom86927212011-09-15 11:31:11 -070079 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070080 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070081
82 ifeq ($$(art_ndebug_or_debug),ndebug)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070083 LOCAL_SHARED_LIBRARIES += libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070084 else # debug
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070085 LOCAL_SHARED_LIBRARIES += libartd
86 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070087
88 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070089 LOCAL_SHARED_LIBRARIES += libstlport
90 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070091
92 ifeq ($$(art_target_or_host),target)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070093 include $(BUILD_EXECUTABLE)
Brian Carlstrom0796af02011-10-12 14:31:45 -070094 ART_TARGET_EXECUTABLES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
95 else # host
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070096 include $(BUILD_HOST_EXECUTABLE)
Brian Carlstrom0796af02011-10-12 14:31:45 -070097 ART_HOST_EXECUTABLES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070098 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070099
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700100endef
101
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700102ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
103 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,ndebug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700104 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700105 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700106endif
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700107ifeq ($(ART_BUILD_TARGET_DEBUG),true)
108 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,debug))
Brian Carlstrom78128a62011-09-15 17:21:19 -0700109 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,debug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700110 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug))
111endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800112
113# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
114ifeq ($(ART_BUILD_NDEBUG),true)
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700115 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug))
Brian Carlstrom265091e2013-01-30 14:08:26 -0800116endif
117ifeq ($(ART_BUILD_NDEBUG),true)
118 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug))
119endif
120
121ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Brian Carlstrom78128a62011-09-15 17:21:19 -0700122 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700123 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700124endif
125ifeq ($(ART_BUILD_HOST_DEBUG),true)
Brian Carlstrom78128a62011-09-15 17:21:19 -0700126 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700127 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700128endif