1 ##===- scripts/Python/modules/readline/Makefile ------------*- Makefile -*-===##
3 # The LLVM Compiler Infrastructure
5 # This file is distributed under the University of Illinois Open Source
6 # License. See LICENSE.TXT for details.
8 ##===----------------------------------------------------------------------===##
10 # Skip this entire Makefile if python is disabled.
11 ifeq (,$(findstring -DLLDB_DISABLE_PYTHON,$(CXXFLAGS)))
13 LEVEL := ../../../../../..
14 LLDB_LEVEL := ../../../..
16 LIBRARYNAME = readline
19 LINK_LIBS_IN_SHARED = 1
23 PYTHON_CONFIG?= python-config
24 PYTHON_INC_DIR = $(shell $(PYTHON_CONFIG) --includes)
26 # Include all archives in the shared lib
29 include $(LLDB_LEVEL)/../../Makefile.config
33 include $(LEVEL)/Makefile.common
35 # include python headers
36 CPP.Flags += $(PYTHON_INC_DIR)
38 ifeq ($(HOST_OS),Darwin)
39 LLVMLibsOptions += -Wl,-all_load
40 # set dylib internal version number to llvmCore submission number
41 ifdef LLDB_SUBMIT_VERSION
42 LLVMLibsOptions += -Wl,-current_version \
43 -Wl,$(LLDB_SUBMIT_VERSION).$(LLDB_SUBMIT_SUBVERSION) \
44 -Wl,-compatibility_version -Wl,1
46 # extra options to override libtool defaults
47 LVMLibsOptions += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks
48 LLVMLibsOptions += -framework Foundation -framework CoreFoundation
49 LLVMLibsOptions += -framework CoreServices -framework Carbon -framework Security
50 LLVMLibsOptions += -framework DebugSymbols $(PYTHON_BUILD_FLAGS) -lobjc
51 # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
52 DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
53 ifneq ($(DARWIN_VERS),8)
54 LLVMLibsOptions += -Wl,-install_name \
55 -Wl,"@executable_path/../lib/$(LIBRARYNAME)$(SHLIBEXT)"
59 ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU GNU/kFreeBSD))
60 # Include everything from the .a's into the shared library.
61 ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
62 -Wl,--no-whole-archive
64 # LLVMLibsOptions += -ledit
65 LLVMLibsOptions += -Wl,--soname,$(LIBRARYNAME)$(SHLIBEXT)
68 ifeq ($(HOST_OS),FreeBSD)
69 # Include everything from the .a's into the shared library.
70 ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
71 -Wl,--no-whole-archive
72 # Allow unresolved symbols.
73 LLVMLibsOptions += -Wl,--allow-shlib-undefined
75 # LLVMLibsOptions += -L/usr/local/lib -ledit
78 # FIXME: dynamically construct the version from `python -V`
80 LLDB_PYTHON_MODULE_REL_DIR:=python$(PYTHON_VERSION)/site-packages
81 LLDB_PYTHON_MODULE_DIR:=$(LibDir)/$(LLDB_PYTHON_MODULE_REL_DIR)
83 # Target to move readline module from shared lib build location to
84 # local python module directory.
85 all-local:: $(LLDB_PYTHON_MODULE_DIR)/$(LIBRARYNAME)$(SHLIBEXT)
87 $(LLDB_PYTHON_MODULE_DIR)/$(LIBRARYNAME)$(SHLIBEXT): $(SharedLibDir)/$(LIBRARYNAME)$(SHLIBEXT)
88 $(Echo) Staging $(BuildMode) $(LIBRARYNAME)$(SHLIBEXT) to $(LLDB_PYTHON_MODULE_DIR)
89 $(Verb) $(MKDIR) "$(LLDB_PYTHON_MODULE_DIR)"
90 $(Verb) $(ProgInstall) $(SharedLibDir)/$(LIBRARYNAME)$(SHLIBEXT) $(LLDB_PYTHON_MODULE_DIR)
92 # Target to move the shared library from the build python lib dir to
93 # the install python lib dir.
94 install-local:: $(LLDB_PYTHON_MODULE_DIR)/$(LIBRARYNAME)$(SHLIBEXT)
95 $(Echo) Installing $(BuildMode) $(LLDB_PYTHON_MODULE_DIR)/$(LIBRARYNAME)$(SHLIBEXT) to $(DESTDIR)$(prefix)/lib/$(LLDB_PYTHON_MODULE_REL_DIR)
96 $(Verb) $(MKDIR) "$(DESTDIR)$(prefix)/lib/$(LLDB_PYTHON_MODULE_REL_DIR)"
97 $(Verb) $(ProgInstall) "$(LLDB_PYTHON_MODULE_DIR)/$(LIBRARYNAME)$(SHLIBEXT)" "$(DESTDIR)$(prefix)/lib/$(LLDB_PYTHON_MODULE_REL_DIR)"
98 $(Verb) $(RM) "$(DESTDIR)$(prefix)/lib/$(LIBRARYNAME)$(SHLIBEXT)"
100 endif # if !defined(LLDB_DISABLE_PYTHON)