Carl Shapiro | 7b21670 | 2011-06-17 15:09:26 -0700 | [diff] [blame] | 1 | # |
| 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 Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 17 | LIBART_CFLAGS := |
| 18 | ifeq ($(ART_USE_LLVM_COMPILER),true) |
| 19 | LIBART_CFLAGS += -DART_USE_LLVM_COMPILER=1 |
Shih-wei Liao | 21d28f5 | 2012-06-12 05:55:00 -0700 | [diff] [blame^] | 20 | ifeq ($(ART_USE_DEXLANG_FRONTEND),true) |
| 21 | LIBART_CFLAGS += -DART_USE_DEXLANG_FRONTEND=1 |
| 22 | endif |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 23 | endif |
| 24 | |
Shih-wei Liao | e94d9b2 | 2012-05-22 09:01:24 -0700 | [diff] [blame] | 25 | ifeq ($(ART_USE_GREENLAND_COMPILER),true) |
| 26 | LIBART_CFLAGS += -DART_USE_GREENLAND_COMPILER=1 |
| 27 | endif |
| 28 | |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 29 | ifeq ($(ART_USE_QUICK_COMPILER),true) |
| 30 | LIBART_CFLAGS += -DART_USE_QUICK_COMPILER=1 |
| 31 | endif |
| 32 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 33 | # $(1): target or host |
| 34 | # $(2): ndebug or debug |
| 35 | define build-libart |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 36 | ifneq ($(1),target) |
| 37 | ifneq ($(1),host) |
| 38 | $$(error expected target or host for argument 1, received $(1)) |
| 39 | endif |
| 40 | endif |
| 41 | ifneq ($(2),ndebug) |
| 42 | ifneq ($(2),debug) |
| 43 | $$(error expected ndebug or debug for argument 2, received $(2)) |
| 44 | endif |
| 45 | endif |
| 46 | |
| 47 | art_target_or_host := $(1) |
| 48 | art_ndebug_or_debug := $(2) |
| 49 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 50 | include $(CLEAR_VARS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 51 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 52 | include external/stlport/libstlport.mk |
| 53 | endif |
| 54 | LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 55 | ifeq ($$(art_ndebug_or_debug),ndebug) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 56 | LOCAL_MODULE := libart |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 57 | else # debug |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 58 | LOCAL_MODULE := libartd |
| 59 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 60 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 61 | LOCAL_MODULE_TAGS := optional |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 62 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
| 63 | |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 64 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 65 | LOCAL_SRC_FILES := $(LIBART_TARGET_SRC_FILES) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 66 | else # host |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 67 | LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES) |
Elliott Hughes | 0e57ccb | 2012-04-03 16:04:52 -0700 | [diff] [blame] | 68 | LOCAL_IS_HOST_MODULE := true |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 69 | endif |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 70 | |
Elliott Hughes | 0e57ccb | 2012-04-03 16:04:52 -0700 | [diff] [blame] | 71 | GENERATED_SRC_DIR := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),$$(LOCAL_IS_HOST_MODULE),) |
| 72 | ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES)) |
| 73 | ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES)) |
| 74 | |
| 75 | $$(ENUM_OPERATOR_OUT_GEN): art/tools/generate-operator-out.py |
| 76 | $$(ENUM_OPERATOR_OUT_GEN): PRIVATE_CUSTOM_TOOL = art/tools/generate-operator-out.py $$< > $$@ |
Elliott Hughes | ef67aec | 2012-04-04 12:01:27 -0700 | [diff] [blame] | 77 | $$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : art/%.h |
Elliott Hughes | 0e57ccb | 2012-04-03 16:04:52 -0700 | [diff] [blame] | 78 | $$(transform-generated-source) |
| 79 | |
| 80 | LOCAL_GENERATED_SOURCES += $$(ENUM_OPERATOR_OUT_GEN) |
| 81 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 82 | LOCAL_CFLAGS := $(LIBART_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 83 | ifeq ($$(art_target_or_host),target) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 84 | LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 85 | else # host |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 86 | LOCAL_CFLAGS += $(ART_HOST_CFLAGS) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 87 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 88 | ifeq ($$(art_ndebug_or_debug),debug) |
| 89 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 90 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 91 | else # host |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 92 | LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) |
Brian Carlstrom | fd2ec54 | 2012-05-02 15:08:57 -0700 | [diff] [blame] | 93 | LOCAL_LDLIBS += $(ART_HOST_DEBUG_LDLIBS) |
Brian Carlstrom | 08125a0 | 2011-09-16 14:55:51 -0700 | [diff] [blame] | 94 | LOCAL_STATIC_LIBRARIES := libgtest_host |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 95 | endif |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 96 | else |
| 97 | ifeq ($$(art_target_or_host),target) |
| 98 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
| 99 | else # host |
| 100 | LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) |
| 101 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 102 | endif |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 103 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) |
Elliott Hughes | 18c0753 | 2011-08-18 15:50:51 -0700 | [diff] [blame] | 104 | LOCAL_SHARED_LIBRARIES := liblog libnativehelper |
Elliott Hughes | 46e251b | 2012-05-22 15:10:45 -0700 | [diff] [blame] | 105 | LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 106 | ifeq ($$(art_target_or_host),target) |
Elliott Hughes | ffb465f | 2012-03-01 18:46:05 -0800 | [diff] [blame] | 107 | LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl |
| 108 | LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 109 | else # host |
Elliott Hughes | 6c9c06d | 2011-11-07 16:43:47 -0800 | [diff] [blame] | 110 | LOCAL_STATIC_LIBRARIES += libcutils |
Elliott Hughes | ffb465f | 2012-03-01 18:46:05 -0800 | [diff] [blame] | 111 | LOCAL_SHARED_LIBRARIES += libz-host |
| 112 | LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support |
Brian Carlstrom | fd2ec54 | 2012-05-02 15:08:57 -0700 | [diff] [blame] | 113 | LOCAL_LDLIBS += -ldl -lpthread |
Elliott Hughes | ad6c9c3 | 2012-01-19 17:39:12 -0800 | [diff] [blame] | 114 | ifeq ($(HOST_OS),linux) |
| 115 | LOCAL_LDLIBS += -lrt |
| 116 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 117 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 118 | ifeq ($$(art_target_or_host),target) |
Shih-wei Liao | e94d9b2 | 2012-05-22 09:01:24 -0700 | [diff] [blame] | 119 | ifeq ($(ART_REQUIRE_LLVM),true) |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 120 | include $(LLVM_GEN_INTRINSICS_MK) |
| 121 | include $(LLVM_DEVICE_BUILD_MK) |
| 122 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 123 | include $(BUILD_SHARED_LIBRARY) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 124 | else # host |
Shih-wei Liao | e94d9b2 | 2012-05-22 09:01:24 -0700 | [diff] [blame] | 125 | ifeq ($(ART_REQUIRE_LLVM),true) |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 126 | include $(LLVM_GEN_INTRINSICS_MK) |
| 127 | include $(LLVM_HOST_BUILD_MK) |
| 128 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 129 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 130 | endif |
| 131 | endef |
| 132 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 133 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 134 | $(eval $(call build-libart,target,ndebug)) |
| 135 | endif |
| 136 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 137 | $(eval $(call build-libart,target,debug)) |
| 138 | endif |
| 139 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 140 | $(eval $(call build-libart,host,ndebug)) |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 141 | endif |
| 142 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 143 | $(eval $(call build-libart,host,debug)) |
| 144 | endif |