blob: 3311b994486282b334dd41b6846804d007b9a391 [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)
Brian Carlstrom86927212011-09-15 11:31:11 -070047 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070048 endif
49 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
50 LOCAL_SHARED_LIBRARIES := libnativehelper
51 ifeq ($(4),ndebug)
52 LOCAL_SHARED_LIBRARIES += libart
53 else
54 LOCAL_SHARED_LIBRARIES += libartd
55 endif
56 ifeq ($(3),target)
57 LOCAL_SHARED_LIBRARIES += libstlport
58 endif
59 ifeq ($(3),target)
60 include $(BUILD_EXECUTABLE)
61 else
62 include $(BUILD_HOST_EXECUTABLE)
63 endif
64 ifeq ($(1),target)
65 ART_TARGET_EXECUTABLES += $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
66 else
67 ART_HOST_EXECUTABLES += $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
68 endif
69endef
70
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070071ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
72 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,ndebug))
Brian Carlstrom78128a62011-09-15 17:21:19 -070073 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070074 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070075endif
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070076ifeq ($(ART_BUILD_TARGET_DEBUG),true)
77 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),target,debug))
Brian Carlstrom78128a62011-09-15 17:21:19 -070078 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),target,debug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070079 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),target,debug))
80endif
81ifeq ($(ART_BUILD_HOST_NDEBUG),true)
82 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,ndebug))
Brian Carlstrom78128a62011-09-15 17:21:19 -070083 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,ndebug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070084 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -070085endif
86ifeq ($(ART_BUILD_HOST_DEBUG),true)
87 $(eval $(call build-art-executable,dex2oat,$(DEX2OAT_SRC_FILES),host,debug))
Brian Carlstrom78128a62011-09-15 17:21:19 -070088 $(eval $(call build-art-executable,oatdump,$(OATDUMP_SRC_FILES),host,debug))
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070089 $(eval $(call build-art-executable,oatexec,$(OATEXEC_SRC_FILES),host,debug))
90endif
91