1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
|
# Universal Unix Makefile for Python extensions (for use with Autoconf)
# =====================================================================
# Note that this is not the same file as that distributed with Python 1.4.
# It has been slightly modified so that it can be used with scripts created
# by autoconf (using some extra commands written by James Henstridge)
# Also note that this file will also work with Python 1.5 or 1.5.1
# Short Instructions
# ------------------
# 1. Build and install Python (1.4 or newer).
# 2. run "./configure"
# 3. run "make"
# You should now have a shared library.
# Long Instructions
# -----------------
# Build *and install* the basic Python 1.4 distribution. See the
# Python README for instructions.
# Create a file Setup.in for your extension. This file follows the
# format of the Modules/Setup.in file; see the instructions there.
# The first line should just have the string
# *shared*
# For a simple module called "spam" on file "spammodule.c", it only needs
# to contain one extra line::
# spam spammodule.c
# You can build as many modules as you want in the same directory --
# just have a separate line for each of them in the Setup.in file.
#
# Note that when configure is run, The file Setup.in is parsed for @VARNAME@
# expressions, and after they are expanded, the output is put in the file
# Setup. Every time configure is run, Setup is overwritten each time
# configure is run.
# Copy this file (Misc/Makefile.pre.in) to the directory containing
# your extension. Also create a configure script. You may wish to use the
# generic one supplied with this file. (This should be done by the one
# writing the extension -- not the user).
# Run "./configure". This creates Makefile
# (producing Makefile.pre as intermediate files) and
# config.c, incorporating the values for sys.prefix, sys.exec_prefix
# and sys.version from the installed Python binary. For this to work,
# the python binary must be on your path. If this fails, try
# ./configure --with-python=<path>/python
# or
# ./configure --with-python-version=<version> --with-python-prefix=<prefix> \
# --with-python-exec-prefix=<exec_prefix>
# where <prefix> is the prefix used to install Python
# If you are building your extension as a shared library (your
# Setup.in file starts with *shared*), run "make" or "make sharedmods"
# to build the shared library files. If you are building a statically
# linked Python binary (the only solution of your platform doesn't
# support shared libraries, and sometimes handy if you want to
# distribute or install the resulting Python binary), run "make
# python".
# Note: Each time you edit Makefile.pre.in or Setup.in, you must run
# "./configure" before running "make".
# Hint: if you want to use VPATH, you can start in an empty
# subdirectory and type (where <srcdir> is the location of the source):
# <srcdir>/configure --srcdir=<srcdir>
# make
# === Bootstrap variables (edited through "./configure") ===
# The prefix used by "make inclinstall libainstall" of core python
prefix= @prefix@
# The exec_prefix used by the same
exec_prefix= @exec_prefix@
# Source directory and VPATH (for VPATH builds).
srcdir= @srcdir@
VPATH= @srcdir@
# === Variables that you may want to customize (rarely) ===
# (Static) build target
TARGET= python
# Add more -I and -D options here
CFLAGS= $(OPT) -I$(INCLUDEPY) -I$(LIBPL) $(DEFS)
# These two variables can be set in Setup to merge extensions.
# See example[23].
BASELIB=
BASESETUP=
# === Variables set by makesetup ===
MODOBJS= _MODOBJS_
MODLIBS= _MODLIBS_
# === Definitions added by makesetup ===
# === Variables from configure ===
VERSION= @VERSION@
CC= @CC@
LINKCC= @LINKCC@
SGI_ABI= @SGI_ABI@
OPT= @OPT@
LDFLAGS= @LDFLAGS@
LDLAST= @LDLAST@
DEFS= @DEFS@
LIBS= @LIBS@
LIBM= @LIBM@
LIBC= @LIBC@
RANLIB= @RANLIB@
MACHDEP= @MACHDEP@
SO= @SO@
LDSHARED= @LDSHARED@
CCSHARED= @CCSHARED@
LINKFORSHARED= @LINKFORSHARED@
@SET_CCC@
#the python executable (from configure)
PYTHON = @PYTHON@
# Install Stuff
INSTALL = @INSTALL@
PY_LIB_DIR = @PYTHON_LIBRARY_DIR@
PY_MOD_DIR = @PYTHON_MODULE_DIR@
# === Fixed definitions ===
# Shell used by make (some versions default to the login shell, which is bad)
SHELL= /bin/sh
# Expanded directories
BINDIR= $(exec_prefix)/bin
LIBDIR= $(exec_prefix)/lib
MANDIR= $(prefix)/man
INCLUDEDIR= $(prefix)/include
SCRIPTDIR= $(prefix)/lib
# Detailed destination directories
BINLIBDEST= $(LIBDIR)/python$(VERSION)
LIBDEST= $(SCRIPTDIR)/python$(VERSION)
INCLUDEPY= $(INCLUDEDIR)/python$(VERSION)
LIBP= $(exec_prefix)/lib/python$(VERSION)
LIBPL= $(LIBP)/config
# === Fixed rules ===
# Default target. This builds shared libraries.
default: sharedmods
# Build shared libraries from our extension modules
sharedmods: $(SHAREDMODS)
# Target to build a pyc file from a py file:
.py.pyc:
$(PYTHON) -c "import py_compile; py_compile.compile('$<')"
.SUFFIXES: .py .pyc
# Target to install scripts and modules
install: install-shmods
install-shmods: $(SHAREDMODS)
@echo 'Installing shared modules...'
@if [ -n "$(SHAREDMODS)" ]; then \
for mod in $(SHAREDMODS); do \
echo " install -m 555 $$mod $(PY_MOD_DIR)"; \
$(INSTALL) -m 555 $$mod $(PY_MOD_DIR); \
done; \
fi
install-scripts: $(SCRIPTS)
@if [ -n "$(SCRIPTS)" ]; then \
echo 'Installing scripts...'; \
for script in $(SCRIPTS); do \
dir=`dirname $$script`; \
if [ ! -d $(PY_LIB_DIR)/$$dir ]; then \
$(INSTALL) -d $(PY_LIB_DIR)/$$dir; \
fi; \
echo " install -m 644 $$script $(PY_LIB_DIR)/$$dir"; \
$(INSTALL) -m 644 $$script $(PY_LIB_DIR)/$$dir; \
done; \
echo "Compiling..."; \
for script in $(SCRIPTS); do \
$(PYTHON) -c "import py_compile; py_compile.compile(\"$(PY_LIB_DIR)/$$script\")"; \
done; \
fi
# Handy target to remove intermediate files and backups
clean:
-rm -f *.o *~ *.pyc *.pyo
# Handy target to remove everything that is easily regenerated
clobber: clean
-rm -f *.a tags TAGS config.c Makefile.pre python
-rm -f *.so *.sl so_locations
# Handy target to remove everything you don't want to distribute
distclean: clobber
-rm -f Makefile Setup
-rm -f config.status config.log config.cache
|