3 ### Standard Makefile for Python packages.
5 ### (c) 2013, 2019, 2020 Straylight/Edgeware
8 ###----- Licensing notice ---------------------------------------------------
10 ### This file is part of the Common Files Distribution (`common').
12 ### `Common' is free software; you can redistribute it and/or modify
13 ### it under the terms of the GNU General Public License as published by
14 ### the Free Software Foundation; either version 2 of the License, or
15 ### (at your option) any later version.
17 ### `Common' is distributed in the hope that it will be useful,
18 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ### GNU General Public License for more details.
22 ### You should have received a copy of the GNU General Public License
23 ### along with `common'; if not, write to the Free Software Foundation,
24 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
32 ###--------------------------------------------------------------------------
33 ### Version information.
35 distdir := $(shell $(PYTHON) setup.py -q distdir)
37 ###--------------------------------------------------------------------------
38 ### Useful targets implemented by the `setup.py' program.
40 SINGLE_PYTARGETS += gen
45 $(foreach p,$(PYTHONS),all/$p):: all/%: gen
49 clean-hook::; rm -f MANIFEST RELEASE
51 SINGLE_PYTARGETS += dist
53 OPTS-dist += --dist-dir .
56 OPTS-install += --prefix $(prefix) \
57 $(and $(DESTDIR),--root $(DESTDIR))
61 $(foreach p,$(PYTHONS),check/$p):: check/%: all/%
63 ###--------------------------------------------------------------------------
64 ### Interfacing `setup.py' to make.
66 pysetup = $(or $2,$(PYTHON)) setup.py \
67 $(if $(filter-out undefined,$(origin CMD-$1)),$(CMD-$1),$1) \
68 $(OPTS-$1) $(OPTS-$1/$(or $2,$(PYTHON)))
70 PYTHON_PYTARGETS = $(foreach t, $(PYTARGETS), \
71 $(foreach p, $(PYTHONS), \
73 ALL_PYTARGETS = $(PYTARGETS)
74 ALL_PYTARGETS += $(SINGLE_PYTARGETS) $(PYTHON_PYTARGETS)
76 $(foreach t, $(ALL_PYTARGETS), $t-hook):: %:
78 $(SINGLE_PYTARGETS):: %: %-hook setup.py
80 $(PYTARGETS):: %: %-hook $(foreach p, $(PYTHONS), %/$p)
81 $(PYTHON_PYTARGETS):: %: %-hook setup.py
82 $(call pysetup,$(patsubst %/,%,$(dir $*)),$(notdir $*))
84 .PHONY: $(ALL_PYTARGETS)
86 ###--------------------------------------------------------------------------
91 $(PYTHON) setup.py sdist --dist-dir _distcheck
92 cd _distcheck && tar xvfz $(distdir).tar.gz
93 cd _distcheck/$(distdir) && $(MAKE) check && $(MAKE) dist
94 cp _distcheck/$(distdir)/$(distdir).tar.gz .
97 ###----- That's all, folks --------------------------------------------------