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 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 17 | # $(1): target or host |
| 18 | # $(2): ndebug or debug |
| 19 | define build-libart |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 20 | ifneq ($(1),target) |
| 21 | ifneq ($(1),host) |
| 22 | $$(error expected target or host for argument 1, received $(1)) |
| 23 | endif |
| 24 | endif |
| 25 | ifneq ($(2),ndebug) |
| 26 | ifneq ($(2),debug) |
| 27 | $$(error expected ndebug or debug for argument 2, received $(2)) |
| 28 | endif |
| 29 | endif |
| 30 | |
| 31 | art_target_or_host := $(1) |
| 32 | art_ndebug_or_debug := $(2) |
| 33 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 34 | include $(CLEAR_VARS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 35 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 36 | include external/stlport/libstlport.mk |
| 37 | endif |
| 38 | LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 39 | ifeq ($$(art_ndebug_or_debug),ndebug) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 40 | LOCAL_MODULE := libart |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 41 | else # debug |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 42 | LOCAL_MODULE := libartd |
| 43 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 44 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 45 | LOCAL_MODULE_TAGS := optional |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 46 | LOCAL_MODULE_CLASS := SHARED_LIBRARIES |
| 47 | |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 48 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 49 | LOCAL_SRC_FILES := $(LIBART_TARGET_SRC_FILES) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 50 | else # host |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 51 | LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES) |
| 52 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 53 | ifeq ($$(art_target_or_host),target) |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 54 | LOCAL_CFLAGS := $(ART_TARGET_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 55 | else # host |
Elliott Hughes | 1d3f114 | 2011-09-13 12:00:00 -0700 | [diff] [blame] | 56 | LOCAL_CFLAGS := $(ART_HOST_CFLAGS) |
| 57 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 58 | ifeq ($$(art_ndebug_or_debug),debug) |
| 59 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 60 | LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 61 | else # host |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 62 | LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS) |
Brian Carlstrom | 08125a0 | 2011-09-16 14:55:51 -0700 | [diff] [blame] | 63 | LOCAL_STATIC_LIBRARIES := libgtest_host |
Brian Carlstrom | 8692721 | 2011-09-15 11:31:11 -0700 | [diff] [blame] | 64 | endif |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 65 | else |
| 66 | ifeq ($$(art_target_or_host),target) |
| 67 | LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS) |
| 68 | else # host |
| 69 | LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS) |
| 70 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 71 | endif |
Brian Carlstrom | 69b15fb | 2011-09-03 12:25:21 -0700 | [diff] [blame] | 72 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 73 | ifeq ($(ART_USE_LLVM_COMPILER),true) |
| 74 | LOCAL_STATIC_LIBRARIES += libLLVMBitWriter libLLVMCore libLLVMSupport |
| 75 | endif |
Elliott Hughes | 18c0753 | 2011-08-18 15:50:51 -0700 | [diff] [blame] | 76 | LOCAL_SHARED_LIBRARIES := liblog libnativehelper |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 77 | ifeq ($$(art_target_or_host),target) |
Elliott Hughes | 06e3ad4 | 2012-02-07 14:51:57 -0800 | [diff] [blame] | 78 | LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl libdynamic_annotations |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 79 | else # host |
Elliott Hughes | 6c9c06d | 2011-11-07 16:43:47 -0800 | [diff] [blame] | 80 | LOCAL_STATIC_LIBRARIES += libcutils |
Elliott Hughes | 06e3ad4 | 2012-02-07 14:51:57 -0800 | [diff] [blame] | 81 | LOCAL_SHARED_LIBRARIES += libz-host libdynamic_annotations-host |
Elliott Hughes | ad6c9c3 | 2012-01-19 17:39:12 -0800 | [diff] [blame] | 82 | LOCAL_LDLIBS := -ldl -lpthread |
| 83 | ifeq ($(HOST_OS),linux) |
| 84 | LOCAL_LDLIBS += -lrt |
| 85 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 86 | endif |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 87 | LOCAL_STATIC_LIBRARIES += libdex |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 88 | ifeq ($$(art_target_or_host),target) |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 89 | ifeq ($(ART_USE_LLVM_COMPILER),true) |
| 90 | include $(LLVM_GEN_INTRINSICS_MK) |
| 91 | include $(LLVM_DEVICE_BUILD_MK) |
| 92 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 93 | include $(BUILD_SHARED_LIBRARY) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 94 | else # host |
Shih-wei Liao | d1fec81 | 2012-02-13 09:51:10 -0800 | [diff] [blame] | 95 | LOCAL_IS_HOST_MODULE := true |
| 96 | ifeq ($(ART_USE_LLVM_COMPILER),true) |
| 97 | include $(LLVM_GEN_INTRINSICS_MK) |
| 98 | include $(LLVM_HOST_BUILD_MK) |
| 99 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 100 | include $(BUILD_HOST_SHARED_LIBRARY) |
| 101 | endif |
| 102 | endef |
| 103 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 104 | ifeq ($(ART_BUILD_TARGET_NDEBUG),true) |
| 105 | $(eval $(call build-libart,target,ndebug)) |
| 106 | endif |
| 107 | ifeq ($(ART_BUILD_TARGET_DEBUG),true) |
| 108 | $(eval $(call build-libart,target,debug)) |
| 109 | endif |
| 110 | ifeq ($(ART_BUILD_HOST_NDEBUG),true) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 111 | $(eval $(call build-libart,host,ndebug)) |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 112 | endif |
| 113 | ifeq ($(ART_BUILD_HOST_DEBUG),true) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 114 | $(eval $(call build-libart,host,debug)) |
| 115 | endif |