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