chiark / gitweb /
debian/control: Recommend the other build tools we usually need.
[cfd] / pysetup.mk
CommitLineData
1a7628a4
MW
1### -*-makefile-*-
2###
3### Standard Makefile for Python packages.
4
5default: all
6
7PYTHON ?= python
8prefix ?= /usr/local
9
10###--------------------------------------------------------------------------
11### Version information.
12
13distdir := $(shell $(PYTHON) setup.py -q distdir)
14
15###--------------------------------------------------------------------------
16### Useful targets implemented by the `setup.py' program.
17
18PYTARGETS += all
19CMD-all ?= build
20
21PYTARGETS += clean
22OPTS-clean ?= --all
23clean-hook::; rm -f MANIFEST RELEASE
24
25PYTARGETS += dist
26CMD-dist ?= sdist
27OPTS-dist += --dist-dir .
28
29PYTARGETS += install
30OPTS-install += --prefix $(prefix)
31
32PYTARGETS += check
33
34###--------------------------------------------------------------------------
35### Interfacing `setup.py' to make.
36
37pysetup = $(PYTHON) setup.py \
38 $(if $(filter-out undefined,$(origin CMD-$1)),$(CMD-$1),$1) \
39 $(OPTS-$1)
40
41$(foreach t, $(PYTARGETS), $t-hook):: %:
42$(PYTARGETS):: %: %-hook setup.py
43 $(call pysetup,$*)
44
45.PHONY: $(PYTARGETS)
46
47###--------------------------------------------------------------------------
48### Release builds.
49
50distcheck:
51 rm -rf _distcheck
52 $(PYTHON) setup.py sdist --dist-dir _distcheck
53 cd _distcheck && tar xvfz $(distdir).tar.gz
54 cd _distcheck/$(distdir) && make && make check && make dist
55 cp _distcheck/$(distdir)/$(distdir).tar.gz .
56 rm -rf _distcheck
57
58###----- That's all, folks --------------------------------------------------