llvm-project/lldb/Makefile

118 lines
3.4 KiB
Makefile
Raw Normal View History

##===- Makefile --------------------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
# If LLDB_LEVEL is not set, then we are the top-level Makefile. Otherwise, we
# are being included from a subdirectory makefile.
ifndef LLDB_LEVEL
IS_TOP_LEVEL := 1
LLDB_LEVEL := .
Suppress python readline module under Linux to fix a seg fault. Bug fix for pr18841: http://llvm.org/bugs/show_bug.cgi?id=18841 This change creates a stub Python readline.so module that does almost nothing. Its whole purpose is to prevent Python from loading the real module, something it does during the embedded Python interpreter's initialization sequence (and way before lldb ever requests it within embedded_interpreter.py). On Ubuntu 12.04 and 13.10 x86_64, and in the Python 2.7.6 tree, the stock Python readline module links against the GNU readline library. This appears to be the case on all Pythons except where __APPLE__ is defined. LLDB now requires linking against the libedit library. Something about having both libedit.so and libreadline.so linked into the same process space is causing the Python readline.so to trigger a NULL memory access. I have put in a separate patch to python.org. This suppression of embedded interpreter readline support can be removed if at least any one of the following happens: 1. The stock python distribution accepts a patch similar to what I submitted to Python 2.7.6's Modules/readline.c file. 2. The stock python distribution implements Modules/readline.c in terms of libedit's readline compatibility mode (i.e. essentially compiles it the way __APPLE__ compiles that module) under Linux. 3. a clean-room implementation of the python readline module is implemented against libedit (either readline compatibility mode or native libedit). This could be implemented within the readline.cpp file that this change introduces. It cannot be a fork of python's readline.c module due to llvm licensing. The net effect of this change on Linux is that the embedded python's readline support will not exist. llvm-svn: 202243
2014-02-26 15:39:20 +08:00
DIRS := include scripts source lib tools
PARALLEL_DIRS :=
endif
###
# Common Makefile code, shared by all LLDB Makefiles.
# Set LLVM source root level.
LEVEL := $(LLDB_LEVEL)/../..
# Include LLVM common makefile.
include $(LEVEL)/Makefile.common
# Set common LLDB build flags.
CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/include
CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/include
CPP.Flags += -I$(LLVM_SRC_ROOT)/tools/clang/include
CPP.Flags += -I$(LLVM_OBJ_ROOT)/tools/clang/include
CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source
CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Utility
CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/Utility
CPP.Flags += -I$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/source/Plugins/Process/POSIX
ifeq (,$(findstring -DLLDB_DISABLE_PYTHON,$(CXXFLAGS)))
# Set Python include directory
PYTHON_INC_DIR = $(shell python-config --includes)
CPP.Flags += $(PYTHON_INC_DIR)
endif
ifeq ($(HOST_OS),Darwin)
CPP.Flags += $(subst -I,-I$(SDKROOT),$(PYTHON_INC_DIR))
CPP.Flags += -F$(SDKROOT)/System/Library/Frameworks
CPP.Flags += -F$(SDKROOT)/System/Library/PrivateFrameworks
CPP.Flags += -I$(SDKROOT)/usr/include/libxml2
endif
ifdef LLDB_VENDOR
CPP.Flags += -DLLDB_VENDOR='"$(LLDB_VENDOR) "'
endif
# If building on a 32-bit system, make sure off_t can store offsets > 2GB
ifneq "$(HOST_ARCH)" "x86_64"
CPP.Flags += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
endif
# Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
# work with it enabled with GCC), Clang/llvm-gc don't support it yet, and newer
# GCC's have false positive warnings with it on Linux (which prove a pain to
# fix). For example:
# http://gcc.gnu.org/PR41874
# http://gcc.gnu.org/PR41838
#
# We can revisit this when LLVM/Clang support it.
CXX.Flags += -fno-strict-aliasing
# Do not warn about pragmas. In particular, we are looking to ignore the
# "#pragma mark" construct which GCC warns about on platforms other than Darwin.
EXTRA_OPTIONS += -Wno-unknown-pragmas
# Drop -Wsign-compare, which we are not currently clean with.
EXTRA_OPTIONS += -Wno-sign-compare
# Drop -Wunused-function and -Wunneeded-internal-declaration, which we are not
# currently clean with.
EXTRA_OPTIONS += -Wno-sign-compare -Wno-unused-function
###
# LLDB Top Level specific stuff.
ifeq ($(IS_TOP_LEVEL),1)
ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT))
$(RecursiveTargets)::
$(Verb) if [ ! -f test/Makefile ]; then \
$(MKDIR) test; \
$(CP) $(PROJ_SRC_DIR)/test/Makefile test/Makefile; \
fi
endif
test::
@ $(MAKE) -C test
#report::
# @ $(MAKE) -C test report
#clean::
# @ $(MAKE) -C test clean
tags::
$(Verb) etags `find . -type f -name '*.h' -or -name '*.cpp' | \
grep -v /lib/Headers | grep -v /test/`
cscope.files:
find tools lib include -name '*.cpp' \
-or -name '*.def' \
-or -name '*.td' \
-or -name '*.h' > cscope.files
.PHONY: test report clean cscope.files
endif