blob: ff6ad17ba8f5bc3c6f7ad9a1b7ef548a56882b85 [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)
Brian Carlstrom86927212011-09-15 11:31:11 -070043 ifeq ($(3),target)
44 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
45 else
46 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
47 LOCAL_STATIC_LIBRARIES := libgtest_host
48 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070049 endif
50 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
51 LOCAL_SHARED_LIBRARIES := libnativehelper
52 ifeq ($(4),ndebug)
53 LOCAL_SHARED_LIBRARIES += libart
54 else
55 LOCAL_SHARED_LIBRARIES += libartd
56 endif
57 ifeq ($(3),target)
58 LOCAL_SHARED_LIBRARIES += libstlport
59 endif
60 ifeq ($(3),target)
61 include $(BUILD_EXECUTABLE)
62 else
63 include $(BUILD_HOST_EXECUTABLE)
64 endif
65 ifeq ($(1),target)
66 ART_TARGET_EXECUTABLES += $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
67 else
68 ART_HOST_EXECUTABLES += $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
69 endif
70endef
71
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070072ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
73 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,ndebug))
Brian Carlstrom78128a62011-09-15 17:21:19 -070074 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070075 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070076endif
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070077ifeq ($(ART_BUILD_TARGET_DEBUG),true)
78 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,debug))
Brian Carlstrom78128a62011-09-15 17:21:19 -070079 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,debug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070080 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug))
81endif
82ifeq ($(ART_BUILD_HOST_NDEBUG),true)
83 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug))
Brian Carlstrom78128a62011-09-15 17:21:19 -070084 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070085 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070086endif
87ifeq ($(ART_BUILD_HOST_DEBUG),true)
88 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug))
Brian Carlstrom78128a62011-09-15 17:21:19 -070089 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070090 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug))
91endif
92