blob: 1b2f41d75e347e207393fbc2ce94bd9ff7ae27fe [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
20# $(1): executable ("d" will be appended for debug version)
21# $(2): source
22# $(3): target or host
23# $(4): ndebug or debug
24define build-art-executable
25 include $(CLEAR_VARS)
26 ifeq ($(3),target)
27 include external/stlport/libstlport.mk
28 endif
29 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
30 ifeq ($(4),ndebug)
31 LOCAL_MODULE := $(1)
32 else
33 LOCAL_MODULE := $(1)d
34 endif
35 LOCAL_MODULE_TAGS := optional
36 LOCAL_SRC_FILES := $(2)
Elliott Hughes1d3f1142011-09-13 12:00:00 -070037 ifeq ($(3),target)
38 LOCAL_CFLAGS := $(ART_TARGET_CFLAGS)
39 else
40 LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
41 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070042 ifeq ($(4),debug)
43 LOCAL_CFLAGS += -UNDEBUG
44 endif
45 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
46 LOCAL_SHARED_LIBRARIES := libnativehelper
47 ifeq ($(4),ndebug)
48 LOCAL_SHARED_LIBRARIES += libart
49 else
50 LOCAL_SHARED_LIBRARIES += libartd
51 endif
52 ifeq ($(3),target)
53 LOCAL_SHARED_LIBRARIES += libstlport
54 endif
55 ifeq ($(3),target)
56 include $(BUILD_EXECUTABLE)
57 else
58 include $(BUILD_HOST_EXECUTABLE)
59 endif
60 ifeq ($(1),target)
61 ART_TARGET_EXECUTABLES += $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
62 else
63 ART_HOST_EXECUTABLES += $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
64 endif
65endef
66
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070067ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
68 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,ndebug))
69 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070070endif
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070071ifeq ($(ART_BUILD_TARGET_DEBUG),true)
72 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,debug))
73 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug))
74endif
75ifeq ($(ART_BUILD_HOST_NDEBUG),true)
76 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070077 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070078endif
79ifeq ($(ART_BUILD_HOST_DEBUG),true)
80 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070081 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug))
82endif
83