blob: 5226db7a10653ef27c9b26b79c448ea105c87a9d [file] [log] [blame]
#
# Copyright (C) 2011 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LIBART_CFLAGS :=
ifeq ($(ART_USE_LLVM_COMPILER),true)
LIBART_CFLAGS += -DART_USE_LLVM_COMPILER=1
endif
ifeq ($(ART_USE_PORTABLE_COMPILER),true)
LIBART_CFLAGS += -DART_USE_PORTABLE_COMPILER=1
endif
# $(1): target or host
# $(2): ndebug or debug
define build-libart
ifneq ($(1),target)
ifneq ($(1),host)
$$(error expected target or host for argument 1, received $(1))
endif
endif
ifneq ($(2),ndebug)
ifneq ($(2),debug)
$$(error expected ndebug or debug for argument 2, received $(2))
endif
endif
art_target_or_host := $(1)
art_ndebug_or_debug := $(2)
include $(CLEAR_VARS)
ifeq ($$(art_target_or_host),target)
include external/stlport/libstlport.mk
endif
LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
ifeq ($$(art_ndebug_or_debug),ndebug)
LOCAL_MODULE := libart
else # debug
LOCAL_MODULE := libartd
endif
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
ifeq ($$(art_target_or_host),target)
LOCAL_SRC_FILES := $(LIBART_TARGET_SRC_FILES)
else # host
LOCAL_SRC_FILES := $(LIBART_HOST_SRC_FILES)
LOCAL_IS_HOST_MODULE := true
endif
GENERATED_SRC_DIR := $$(call intermediates-dir-for,$$(LOCAL_MODULE_CLASS),$$(LOCAL_MODULE),$$(LOCAL_IS_HOST_MODULE),)
ENUM_OPERATOR_OUT_CC_FILES := $$(patsubst %.h,%_operator_out.cc,$$(LIBART_ENUM_OPERATOR_OUT_HEADER_FILES))
ENUM_OPERATOR_OUT_GEN := $$(addprefix $$(GENERATED_SRC_DIR)/,$$(ENUM_OPERATOR_OUT_CC_FILES))
$$(ENUM_OPERATOR_OUT_GEN): art/tools/generate-operator-out.py
$$(ENUM_OPERATOR_OUT_GEN): PRIVATE_CUSTOM_TOOL = art/tools/generate-operator-out.py $$< > $$@
$$(ENUM_OPERATOR_OUT_GEN): $$(GENERATED_SRC_DIR)/%_operator_out.cc : art/%.h
$$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $$(ENUM_OPERATOR_OUT_GEN)
LOCAL_CFLAGS := $(LIBART_CFLAGS)
ifeq ($$(art_target_or_host),target)
LOCAL_CFLAGS += $(ART_TARGET_CFLAGS)
else # host
LOCAL_CFLAGS += $(ART_HOST_CFLAGS)
endif
ifeq ($$(art_ndebug_or_debug),debug)
ifeq ($$(art_target_or_host),target)
LOCAL_CFLAGS += $(ART_TARGET_DEBUG_CFLAGS)
else # host
LOCAL_CFLAGS += $(ART_HOST_DEBUG_CFLAGS)
LOCAL_LDLIBS += $(ART_HOST_DEBUG_LDLIBS)
LOCAL_STATIC_LIBRARIES := libgtest_host
endif
else
ifeq ($$(art_target_or_host),target)
LOCAL_CFLAGS += $(ART_TARGET_NON_DEBUG_CFLAGS)
else # host
LOCAL_CFLAGS += $(ART_HOST_NON_DEBUG_CFLAGS)
endif
endif
LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
LOCAL_SHARED_LIBRARIES := liblog libnativehelper
LOCAL_SHARED_LIBRARIES += libcorkscrew # native stack trace support
ifeq ($$(art_target_or_host),target)
LOCAL_SHARED_LIBRARIES += libcutils libstlport libz libdl libselinux
LOCAL_SHARED_LIBRARIES += libdynamic_annotations # tsan support
else # host
LOCAL_STATIC_LIBRARIES += libcutils
LOCAL_SHARED_LIBRARIES += libz-host
LOCAL_SHARED_LIBRARIES += libdynamic_annotations-host # tsan support
LOCAL_LDLIBS += -ldl -lpthread
ifeq ($(HOST_OS),linux)
LOCAL_LDLIBS += -lrt
endif
endif
include $(LLVM_GEN_INTRINSICS_MK)
ifeq ($$(art_target_or_host),target)
include $(LLVM_DEVICE_BUILD_MK)
include $(BUILD_SHARED_LIBRARY)
else # host
include $(LLVM_HOST_BUILD_MK)
include $(BUILD_HOST_SHARED_LIBRARY)
endif
endef
ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
$(eval $(call build-libart,target,ndebug))
endif
ifeq ($(ART_BUILD_TARGET_DEBUG),true)
$(eval $(call build-libart,target,debug))
endif
ifeq ($(ART_BUILD_HOST_NDEBUG),true)
$(eval $(call build-libart,host,ndebug))
endif
ifeq ($(ART_BUILD_HOST_DEBUG),true)
$(eval $(call build-libart,host,debug))
endif