From 1a7628a4057a6a852f488c4e3d70d165f1666d49 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 15 Jun 2013 22:21:21 +0100 Subject: [PATCH] pysetup.mk: Makefile fragment for interfacing to `setup.py'. --- Makefile.am | 3 ++- pysetup.mk | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 pysetup.mk diff --git a/Makefile.am b/Makefile.am index ee272b3..c397447 100644 --- a/Makefile.am +++ b/Makefile.am @@ -92,7 +92,8 @@ dist_pkgdata_SCRIPTS += install-ac dist_pkgdata_SCRIPTS += maninst ## Python support stuff. -dist_pkgdata_SCRIPTS += mdwsetup.py +dist_pkgdata_DATA += mdwsetup.py +dist_pkgdata_DATA += pysetup.mk ## confsubst pkgdata_SCRIPTS += confsubst diff --git a/pysetup.mk b/pysetup.mk new file mode 100644 index 0000000..0e7a218 --- /dev/null +++ b/pysetup.mk @@ -0,0 +1,58 @@ +### -*-makefile-*- +### +### Standard Makefile for Python packages. + +default: all + +PYTHON ?= python +prefix ?= /usr/local + +###-------------------------------------------------------------------------- +### Version information. + +distdir := $(shell $(PYTHON) setup.py -q distdir) + +###-------------------------------------------------------------------------- +### Useful targets implemented by the `setup.py' program. + +PYTARGETS += all +CMD-all ?= build + +PYTARGETS += clean +OPTS-clean ?= --all +clean-hook::; rm -f MANIFEST RELEASE + +PYTARGETS += dist +CMD-dist ?= sdist +OPTS-dist += --dist-dir . + +PYTARGETS += install +OPTS-install += --prefix $(prefix) + +PYTARGETS += check + +###-------------------------------------------------------------------------- +### Interfacing `setup.py' to make. + +pysetup = $(PYTHON) setup.py \ + $(if $(filter-out undefined,$(origin CMD-$1)),$(CMD-$1),$1) \ + $(OPTS-$1) + +$(foreach t, $(PYTARGETS), $t-hook):: %: +$(PYTARGETS):: %: %-hook setup.py + $(call pysetup,$*) + +.PHONY: $(PYTARGETS) + +###-------------------------------------------------------------------------- +### Release builds. + +distcheck: + rm -rf _distcheck + $(PYTHON) setup.py sdist --dist-dir _distcheck + cd _distcheck && tar xvfz $(distdir).tar.gz + cd _distcheck/$(distdir) && make && make check && make dist + cp _distcheck/$(distdir)/$(distdir).tar.gz . + rm -rf _distcheck + +###----- That's all, folks -------------------------------------------------- -- 2.11.0