Guido van Rossum | e8c0a15 | 1996-08-20 20:54:59 +0000 | [diff] [blame] | 1 | # Generic Makefile for dynamically linked extension modules. |
| 2 | # |
| 3 | # Jim Fulton, Digital Creations, jim@digicool.com |
| 4 | |
| 5 | |
| 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/ |
| 10 | |
| 11 | # The following lines should be left as is: |
| 12 | pyinstalldir= $(PYTHONHOME) |
| 13 | installdir= $(PYTHONHOME) |
| 14 | exec_installdir=$(pyinstalldir) |
Guido van Rossum | be725fd | 1996-08-28 14:27:24 +0000 | [diff] [blame^] | 15 | INCLUDEPY= $(pyinstalldir)/include/python1.4 |
Guido van Rossum | e8c0a15 | 1996-08-20 20:54:59 +0000 | [diff] [blame] | 16 | LIBP= $(exec_installdir)/lib/python |
Guido van Rossum | be725fd | 1996-08-28 14:27:24 +0000 | [diff] [blame^] | 17 | LIBPL= $(LIBP)/config |
Guido van Rossum | e8c0a15 | 1996-08-20 20:54:59 +0000 | [diff] [blame] | 18 | PYMAKE= make -f $(LIBPL)/Makefile |
| 19 | |
| 20 | # LIBSO is the location of platform-dependent dynamically linked |
| 21 | # extension libraries. This can be handy when you need to build |
| 22 | # shared libraries that are not extensions but want to store them |
| 23 | # with other extensions and need to know where they are. |
| 24 | # Leave this line as it is. |
| 25 | LIBSO= `$(PYMAKE) -s echodestshared` |
| 26 | |
| 27 | # Put your module name here: |
| 28 | MODULE=your-module |
| 29 | |
| 30 | # Put the object files for your module here: |
| 31 | OBS=$(MODULE).o |
| 32 | |
| 33 | # Put extra linker options, such as libraries here: |
| 34 | EXTRA= |
| 35 | |
| 36 | # If you have any Python modules, include them here, so that they |
| 37 | # can be installed. |
| 38 | PYMODULES= |
| 39 | |
| 40 | build: |
| 41 | if [ "$(MODULE)" != your-module ]; then \ |
| 42 | $(PYMAKE) INCLDIR=$(INCLUDEPY) CONFIGINCLDIR=$(LIBPL) \ |
| 43 | ASHAREDMODULE=$(MODULE) \ |
| 44 | 'ASHAREDMODULESOBS=$(OBS)' \ |
| 45 | 'ASHAREDMODULESEXTRA=$(EXTRA)' \ |
| 46 | asharedmodule; \ |
| 47 | fi |
| 48 | |
| 49 | install: installso installpy |
| 50 | |
| 51 | installso: build |
| 52 | if [ "$(MODULE)" != your-module ]; then \ |
| 53 | $(PYMAKE) exec_prefix=$(installdir) \ |
| 54 | ASHAREDMODULE=$(MODULE) asharedinstall; \ |
| 55 | fi |
| 56 | |
| 57 | installpy: |
| 58 | for m in $(PYMODULES) the-end; do \ |
| 59 | if [ "$$m" != the-end ]; then \ |
| 60 | python -c "import $$m"; \ |
| 61 | cp $$m.pyc $(installdir)/lib/python/; \ |
| 62 | fi; \ |
| 63 | done |
| 64 | |
| 65 | clean:: |
| 66 | -rm -f *.o *.so *~ *# so_locations |