blob: 4e5137a55eb5b1f0734e78d6e17884e440deab4e [file] [log] [blame]
Guido van Rossume8c0a151996-08-20 20:54:59 +00001# Generic Makefile for dynamically linked extension modules.
2#
3# Jim Fulton, Digital Creations, jim@digicool.com
4
5
Guido van Rossum62cf6051996-08-28 19:29:44 +00006# Uncomment and modify these lines if you want to fix the location of
7# the PYTHON installation and the python version. Otherwise, set the
8# environment variables before using this Makefile.
9
Guido van Rossum7d42d951996-11-06 16:39:12 +000010# PYTHONHOME= /usr/local/
11# PYTHONVERSION= 1.4
Guido van Rossume8c0a151996-08-20 20:54:59 +000012
13# The following lines should be left as is:
Guido van Rossum62cf6051996-08-28 19:29:44 +000014VERSION= $(PYTHONVERSION)
Guido van Rossume8c0a151996-08-20 20:54:59 +000015pyinstalldir= $(PYTHONHOME)
16installdir= $(PYTHONHOME)
17exec_installdir=$(pyinstalldir)
Guido van Rossum62cf6051996-08-28 19:29:44 +000018INCLUDEPY= $(pyinstalldir)/include/python$(VERSION)
19LIBP= $(exec_installdir)/lib/python$(VERSION)
Guido van Rossumbe725fd1996-08-28 14:27:24 +000020LIBPL= $(LIBP)/config
Guido van Rossume8c0a151996-08-20 20:54:59 +000021PYMAKE= make -f $(LIBPL)/Makefile
22
23# LIBSO is the location of platform-dependent dynamically linked
24# extension libraries. This can be handy when you need to build
25# shared libraries that are not extensions but want to store them
26# with other extensions and need to know where they are.
27# Leave this line as it is.
28LIBSO= `$(PYMAKE) -s echodestshared`
29
30# Put your module name here:
31MODULE=your-module
32
33# Put the object files for your module here:
34OBS=$(MODULE).o
35
36# Put extra linker options, such as libraries here:
Guido van Rossum62cf6051996-08-28 19:29:44 +000037EXTRALD=
38
39# Put Extra compiler options, such as extra -I options, here
40CFLAGS=-O
Guido van Rossume8c0a151996-08-20 20:54:59 +000041
42# If you have any Python modules, include them here, so that they
Guido van Rossum62cf6051996-08-28 19:29:44 +000043# can get installed.
Guido van Rossume8c0a151996-08-20 20:54:59 +000044PYMODULES=
45
46build:
47 if [ "$(MODULE)" != your-module ]; then \
48 $(PYMAKE) INCLDIR=$(INCLUDEPY) CONFIGINCLDIR=$(LIBPL) \
49 ASHAREDMODULE=$(MODULE) \
50 'ASHAREDMODULESOBS=$(OBS)' \
Guido van Rossum62cf6051996-08-28 19:29:44 +000051 'ASHAREDMODULESEXTRA=$(EXTRALD)' \
52 'OPT=$(CFLAGS)' \
Guido van Rossume8c0a151996-08-20 20:54:59 +000053 asharedmodule; \
54 fi
55
Guido van Rossum62cf6051996-08-28 19:29:44 +000056# Normally we don't install .py files:
57install: installso installpyc
58
59# But sometimes we may want to:
60installpy: install
61 for m in $(PYMODULES) the-end; do \
62 if [ "$$m" != the-end ]; then \
63 cp $$m.py $(installdir)/lib/python$(VERSION)/; \
64 fi; \
65 done
66
Guido van Rossume8c0a151996-08-20 20:54:59 +000067
68installso: build
69 if [ "$(MODULE)" != your-module ]; then \
70 $(PYMAKE) exec_prefix=$(installdir) \
71 ASHAREDMODULE=$(MODULE) asharedinstall; \
72 fi
73
Guido van Rossum62cf6051996-08-28 19:29:44 +000074installpyc:
Guido van Rossume8c0a151996-08-20 20:54:59 +000075 for m in $(PYMODULES) the-end; do \
76 if [ "$$m" != the-end ]; then \
77 python -c "import $$m"; \
Guido van Rossum62cf6051996-08-28 19:29:44 +000078 cp $$m.pyc $(installdir)/lib/python$(VERSION)/; \
Guido van Rossume8c0a151996-08-20 20:54:59 +000079 fi; \
80 done
81
82clean::
83 -rm -f *.o *.so *~ *# so_locations