blob: 74e9b2163e8b89e745225749f99330c96b2f3bc8 [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 :=
buzbeec531cef2012-10-18 07:09:20 -070018ifeq ($(ART_USE_PORTABLE_COMPILER),true)
buzbee26f10ee2012-12-21 11:16:29 -080019 LIBART_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
buzbee2cfc6392012-05-07 14:51:40 -070020endif
21
Brian Carlstrom07d579f2011-07-27 13:31:51 -070022# $(1): target or host
23# $(2): ndebug or debug
24define build-libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070025 ifneq ($(1),target)
26 ifneq ($(1),host)
27 $$(error expected target or host for argument 1, received $(1))
28 endif
29 endif
30 ifneq ($(2),ndebug)
31 ifneq ($(2),debug)
32 $$(error expected ndebug or debug for argument 2, received $(2))
33 endif
34 endif
35
36 art_target_or_host := $(1)
37 art_ndebug_or_debug := $(2)
38
Brian Carlstrom07d579f2011-07-27 13:31:51 -070039 include $(CLEAR_VARS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070040 ifeq ($$(art_target_or_host),target)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070041 include external/stlport/libstlport.mk
42 endif
43 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
Brian Carlstrom0796af02011-10-12 14:31:45 -070044 ifeq ($$(art_ndebug_or_debug),ndebug)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070045 LOCAL_MODULE := libart
Brian Carlstrom0796af02011-10-12 14:31:45 -070046 else # debug
Brian Carlstrom07d579f2011-07-27 13:31:51 -070047 LOCAL_MODULE := libartd
48 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070049
Brian Carlstrom07d579f2011-07-27 13:31:51 -070050 LOCAL_MODULE_TAGS := optional
Shih-wei Liaod1fec812012-02-13 09:51:10 -080051 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
52
Brian Carlstrom0796af02011-10-12 14:31:45 -070053 ifeq ($$(art_target_or_host),target)
Brian Carlstrom07d579f2011-07-27 13:31:51 -070054 LOCAL_SRC_FILES := $(LIBART_TARGET_SRC_FILES)
Brian Carlstrom0796af02011-10-12 14:31:45 -070055 else # host
Brian Carlstrom07d579f2011-07-27 13:31:51 -070056 LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES)
Elliott Hughes0e57ccb2012-04-03 16:04:52 -070057 LOCAL_IS_HOST_MODULE := true
Brian Carlstrom07d579f2011-07-27 13:31:51 -070058 endif
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080059
Elliott Hughes0e57ccb2012-04-03 16:04:52 -070060 GENERATED_SRC_DIR := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),$$(LOCAL_IS_HOST_MODULE),)
61 ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES))
62 ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES))
63
64$$(ENUM_OPERATOR_OUT_GEN): art/tools/generate-operator-out.py
65$$(ENUM_OPERATOR_OUT_GEN): PRIVATE_CUSTOM_TOOL = art/tools/generate-operator-out.py $$< > $$@
Elliott Hughesef67aec2012-04-04 12:01:27 -070066$$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : art/%.h
Elliott Hughes0e57ccb2012-04-03 16:04:52 -070067 $$(transform-generated-source)
68
69 LOCAL_GENERATED_SOURCES += $$(ENUM_OPERATOR_OUT_GEN)
70
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080071 LOCAL_CFLAGS := $(LIBART_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070072 ifeq ($$(art_target_or_host),target)
Ian Rogerscd5d0422013-05-17 15:54:01 -070073 LOCAL_CLANG := $(ART_TARGET_CLANG)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080074 LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070075 else # host
Ian Rogerscd5d0422013-05-17 15:54:01 -070076 LOCAL_CLANG := $(ART_HOST_CLANG)
Shih-wei Liaoc4c98812012-03-10 21:55:51 -080077 LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
Elliott Hughes1d3f1142011-09-13 12:00:00 -070078 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -070079 ifeq ($$(art_ndebug_or_debug),debug)
80 ifeq ($$(art_target_or_host),target)
Brian Carlstrom86927212011-09-15 11:31:11 -070081 LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -070082 else # host
Brian Carlstrom86927212011-09-15 11:31:11 -070083 LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
Brian Carlstromfd2ec542012-05-02 15:08:57 -070084 LOCAL_LDLIBS += $(ART_HOST_DEBUG_LDLIBS)
Brian Carlstrom08125a02011-09-16 14:55:51 -070085 LOCAL_STATIC_LIBRARIES := libgtest_host
Brian Carlstrom86927212011-09-15 11:31:11 -070086 endif
Elliott Hughes3b6baaa2011-10-14 19:13:56 -070087 else
88 ifeq ($$(art_target_or_host),target)
89 LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
90 else # host
91 LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
92 endif
Brian Carlstrom07d579f2011-07-27 13:31:51 -070093 endif
Brian Carlstrom69b15fb2011-09-03 12:25:21 -070094 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
Elliott Hughes18c07532011-08-18 15:50:51 -070095 LOCAL_SHARED_LIBRARIES := liblog libnativehelper
Elliott Hughes46e251b2012-05-22 15:10:45 -070096 LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
Brian Carlstrom0796af02011-10-12 14:31:45 -070097 ifeq ($$(art_target_or_host),target)
Brian Carlstromc4dc43e2012-10-17 11:11:58 -070098 LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl libselinux
Brian Carlstrom0796af02011-10-12 14:31:45 -070099 else # host
Elliott Hughes6c9c06d2011-11-07 16:43:47 -0800100 LOCAL_STATIC_LIBRARIES += libcutils
Elliott Hughesffb465f2012-03-01 18:46:05 -0800101 LOCAL_SHARED_LIBRARIES += libz-host
Brian Carlstromfd2ec542012-05-02 15:08:57 -0700102 LOCAL_LDLIBS += -ldl -lpthread
Elliott Hughesad6c9c32012-01-19 17:39:12 -0800103 ifeq ($(HOST_OS),linux)
104 LOCAL_LDLIBS += -lrt
105 endif
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700106 endif
buzbeec531cef2012-10-18 07:09:20 -0700107 include $(LLVM_GEN_INTRINSICS_MK)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700108 ifeq ($$(art_target_or_host),target)
buzbeec531cef2012-10-18 07:09:20 -0700109 include $(LLVM_DEVICE_BUILD_MK)
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700110 include $(BUILD_SHARED_LIBRARY)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700111 else # host
buzbeec531cef2012-10-18 07:09:20 -0700112 include $(LLVM_HOST_BUILD_MK)
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700113 include $(BUILD_HOST_SHARED_LIBRARY)
114 endif
115endef
116
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700117ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
118 $(eval $(call build-libart,target,ndebug))
119endif
120ifeq ($(ART_BUILD_TARGET_DEBUG),true)
121 $(eval $(call build-libart,target,debug))
122endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800123
124# We always build dex2oat and dependencies, even if the host build is otherwise disabled, since they are used to cross compile for the target.
125ifeq ($(ART_BUILD_NDEBUG),true)
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700126 $(eval $(call build-libart,host,ndebug))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700127endif
Brian Carlstrom265091e2013-01-30 14:08:26 -0800128ifeq ($(ART_BUILD_DEBUG),true)
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700129 $(eval $(call build-libart,host,debug))
130endif