blob: 9ccbe3fc374edfa545041e5bf9d4711079de465e [file] [log] [blame]
Carl Shapiro7b216702011-06-17 15:09:26 -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
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080017LIBART_CFLAGS :=
18ifeq ($(ART_USE_LLVM_COMPILER),true)
19 LIBART_CFLAGS += -DART_USE_LLVM_COMPILER=1
20endif
21
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -070022ifeq ($(ART_USE_GREENLAND_COMPILER),true)
23 LIBART_CFLAGS += -DART_USE_GREENLAND_COMPILER=1
24endif
25
buzbee2cfc6392012-05-07 14:51:40 -070026ifeq ($(ART_USE_QUICK_COMPILER),true)
27 LIBART_CFLAGS += -DART_USE_QUICK_COMPILER=1
28endif
29
Brian Carlstrom07d579f2011-07-27 13:31:51 -070030# $(1): target or host
31# $(2): ndebug or debug
32define build-libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070033 ifneq ($(1),target)
34 ifneq ($(1),host)
35 $$(error expected target or host for argument 1, received $(1))
36 endif
37 endif
38 ifneq ($(2),ndebug)
39 ifneq ($(2),debug)
40 $$(error expected ndebug or debug for argument 2, received $(2))
41 endif
42 endif
43
44 art_target_or_host := $(1)
45 art_ndebug_or_debug := $(2)
46
Brian Carlstrom07d579f2011-07-27 13:31:51 -070047 include $(CLEAR_VARS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070048 ifeq ($$(art_target_or_host),target)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070049 include external/stlport/libstlport.mk
50 endif
51 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
Brian Carlstrom0796af02011-10-12 14:31:45 -070052 ifeq ($$(art_ndebug_or_debug),ndebug)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070053 LOCAL_MODULE := libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070054 else # debug
Brian Carlstrom07d579f2011-07-27 13:31:51 -070055 LOCAL_MODULE := libartd
56 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070057
Brian Carlstrom07d579f2011-07-27 13:31:51 -070058 LOCAL_MODULE_TAGS := optional
Shih-wei Liaod1fec812012-02-13 09:51:10 -080059 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
60
Brian Carlstrom0796af02011-10-12 14:31:45 -070061 ifeq ($$(art_target_or_host),target)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070062 LOCAL_SRC_FILES := $(LIBART_TARGET_SRC_FILES)
Brian Carlstrom0796af02011-10-12 14:31:45 -070063 else # host
Brian Carlstrom07d579f2011-07-27 13:31:51 -070064 LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES)
Elliott Hughes0e57ccb2012-04-03 16:04:52 -070065 LOCAL_IS_HOST_MODULE := true
Brian Carlstrom07d579f2011-07-27 13:31:51 -070066 endif
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080067
Elliott Hughes0e57ccb2012-04-03 16:04:52 -070068 GENERATED_SRC_DIR := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),$$(LOCAL_IS_HOST_MODULE),)
69 ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES))
70 ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES))
71
72$$(ENUM_OPERATOR_OUT_GEN): art/tools/generate-operator-out.py
73$$(ENUM_OPERATOR_OUT_GEN): PRIVATE_CUSTOM_TOOL = art/tools/generate-operator-out.py $$< > $$@
Elliott Hughesef67aec2012-04-04 12:01:27 -070074$$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : art/%.h
Elliott Hughes0e57ccb2012-04-03 16:04:52 -070075 $$(transform-generated-source)
76
77 LOCAL_GENERATED_SOURCES += $$(ENUM_OPERATOR_OUT_GEN)
78
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080079 LOCAL_CFLAGS := $(LIBART_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070080 ifeq ($$(art_target_or_host),target)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080081 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070082 else # host
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080083 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Elliott Hughes1d3f1142011-09-13 12:00:00 -070084 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070085 ifeq ($$(art_ndebug_or_debug),debug)
86 ifeq ($$(art_target_or_host),target)
Brian Carlstrom86927212011-09-15 11:31:11 -070087 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070088 else # host
Brian Carlstrom86927212011-09-15 11:31:11 -070089 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
Brian Carlstromfd2ec542012-05-02 15:08:57 -070090 LOCAL_LDLIBS += $(ART_HOST_DEBUG_LDLIBS)
Brian Carlstrom08125a02011-09-16 14:55:51 -070091 LOCAL_STATIC_LIBRARIES := libgtest_host
Brian Carlstrom86927212011-09-15 11:31:11 -070092 endif
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070093 else
94 ifeq ($$(art_target_or_host),target)
95 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
96 else # host
97 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
98 endif
Brian Carlstrom07d579f2011-07-27 13:31:51 -070099 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -0700100 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
Elliott Hughes18c07532011-08-18 15:50:51 -0700101 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -0700102 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Brian Carlstrom0796af02011-10-12 14:31:45 -0700103 ifeq ($$(art_target_or_host),target)
Elliott Hughesffb465f2012-03-01 18:46:05 -0800104 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl
105 LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
Brian Carlstrom0796af02011-10-12 14:31:45 -0700106 else # host
Elliott Hughes6c9c06d2011-11-07 16:43:47 -0800107 LOCAL_STATIC_LIBRARIES += libcutils
Elliott Hughesffb465f2012-03-01 18:46:05 -0800108 LOCAL_SHARED_LIBRARIES += libz-host
109 LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
Brian Carlstromfd2ec542012-05-02 15:08:57 -0700110 LOCAL_LDLIBS += -ldl -lpthread
Elliott Hughesad6c9c32012-01-19 17:39:12 -0800111 ifeq ($(HOST_OS),linux)
112 LOCAL_LDLIBS += -lrt
113 endif
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700114 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -0700115 ifeq ($$(art_target_or_host),target)
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700116 ifeq ($(ART_REQUIRE_LLVM),true)
Shih-wei Liaod1fec812012-02-13 09:51:10 -0800117 include $(LLVM_GEN_INTRINSICS_MK)
118 include $(LLVM_DEVICE_BUILD_MK)
119 endif
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700120 include $(BUILD_SHARED_LIBRARY)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700121 else # host
Shih-wei Liaoe94d9b22012-05-22 09:01:24 -0700122 ifeq ($(ART_REQUIRE_LLVM),true)
Shih-wei Liaod1fec812012-02-13 09:51:10 -0800123 include $(LLVM_GEN_INTRINSICS_MK)
124 include $(LLVM_HOST_BUILD_MK)
125 endif
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700126 include $(BUILD_HOST_SHARED_LIBRARY)
127 endif
128endef
129
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700130ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
131 $(eval $(call build-libart,target,ndebug))
132endif
133ifeq ($(ART_BUILD_TARGET_DEBUG),true)
134 $(eval $(call build-libart,target,debug))
135endif
136ifeq ($(ART_BUILD_HOST_NDEBUG),true)
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700137 $(eval $(call build-libart,host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700138endif
139ifeq ($(ART_BUILD_HOST_DEBUG),true)
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700140 $(eval $(call build-libart,host,debug))
141endif