33# Jim Fulton, Digital Creations,
[email protected] 44
55
6- # Uncomment this line if you want to fix the location of the PYTHON
7- # installation. Otherwise, set the environment variable before using this
8- # Makefile.
9- # $(PYTHONHOME)= /usr/local/
6+ # 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+
10+ # $(PYTHONHOME)= /usr/local/
11+ # $(PYTHONVERSION)= 1.4
1012
1113# The following lines should be left as is:
14+ VERSION= $(PYTHONVERSION)
1215pyinstalldir= $(PYTHONHOME)
1316installdir= $(PYTHONHOME)
1417exec_installdir=$(pyinstalldir)
15- INCLUDEPY= $(pyinstalldir)/include/python1.4
16- LIBP= $(exec_installdir)/lib/python1.4
18+ INCLUDEPY= $(pyinstalldir)/include/python$(VERSION)
19+ LIBP= $(exec_installdir)/lib/python$(VERSION)
1720LIBPL= $(LIBP)/config
1821PYMAKE= make -f $(LIBPL)/Makefile
1922
@@ -31,34 +34,48 @@ MODULE=your-module
3134OBS=$(MODULE).o
3235
3336# Put extra linker options, such as libraries here:
34- EXTRA=
37+ EXTRALD=
38+
39+ # Put Extra compiler options, such as extra -I options, here
40+ CFLAGS=-O
3541
3642# If you have any Python modules, include them here, so that they
37- # can be installed.
43+ # can get installed.
3844PYMODULES=
3945
4046build:
4147 if [ "$(MODULE)" != your-module ]; then \
4248 $(PYMAKE) INCLDIR=$(INCLUDEPY) CONFIGINCLDIR=$(LIBPL) \
4349 ASHAREDMODULE=$(MODULE) \
4450 'ASHAREDMODULESOBS=$(OBS)' \
45- 'ASHAREDMODULESEXTRA=$(EXTRA)' \
51+ 'ASHAREDMODULESEXTRA=$(EXTRALD)' \
52+ 'OPT=$(CFLAGS)' \
4653 asharedmodule; \
4754 fi
4855
49- install: installso installpy
56+ # Normally we don't install .py files:
57+ install: installso installpyc
58+
59+ # But sometimes we may want to:
60+ installpy: 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+
5067
5168installso: build
5269 if [ "$(MODULE)" != your-module ]; then \
5370 $(PYMAKE) exec_prefix=$(installdir) \
5471 ASHAREDMODULE=$(MODULE) asharedinstall; \
5572 fi
5673
57- installpy :
74+ installpyc :
5875 for m in $(PYMODULES) the-end; do \
5976 if [ "$$m" != the-end ]; then \
6077 python -c "import $$m"; \
61- cp $$m.pyc $(installdir)/lib/python/; \
78+ cp $$m.pyc $(installdir)/lib/python$(VERSION) /; \
6279 fi; \
6380 done
6481
0 commit comments