]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - scripts/Python/modules/readline/Makefile
Vendor import of lldb trunk r256945:
[FreeBSD/FreeBSD.git] / scripts / Python / modules / readline / Makefile
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
23 PYTHON_CONFIG?= python-config
24 PYTHON_INC_DIR = $(shell $(PYTHON_CONFIG) --includes)
25
26 # Include all archives in the shared lib
27 USEDLIBS :=
28
29 include $(LLDB_LEVEL)/../../Makefile.config
30
31 LINK_COMPONENTS :=
32
33 include $(LEVEL)/Makefile.common
34
35 # include python headers
36 CPP.Flags += $(PYTHON_INC_DIR)
37
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
45     endif
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)"
56     endif
57 endif
58
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
63     # Link in libedit
64     # LLVMLibsOptions += -ledit
65     LLVMLibsOptions += -Wl,--soname,$(LIBRARYNAME)$(SHLIBEXT)
66 endif
67
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
74     # Link in libedit
75     # LLVMLibsOptions += -L/usr/local/lib -ledit
76 endif
77
78 # FIXME: dynamically construct the version from `python -V`
79 PYTHON_VERSION:=2.7
80 LLDB_PYTHON_MODULE_REL_DIR:=python$(PYTHON_VERSION)/site-packages
81 LLDB_PYTHON_MODULE_DIR:=$(LibDir)/$(LLDB_PYTHON_MODULE_REL_DIR)
82
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)
86
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)
91
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)"
99
100 endif  # if !defined(LLDB_DISABLE_PYTHON)