Add rule for making homepage.
[jelmer/subvertpy.git] / Makefile
1 # Simple Makefile for Bazaar plugin
2 # Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
3 #   
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #   
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #   
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 #
17
18 DEBUGGER ?= 
19 BZR ?= $(shell which bzr)
20 BZR_OPTIONS ?= 
21 PYTHON ?= $(shell which python)
22 SETUP ?= $(PYTHON) ./setup.py
23 PYDOCTOR ?= pydoctor
24 CTAGS ?= ctags
25 PYLINT ?= pylint
26 RST2HTML ?= $(if $(shell which rst2html.py 2>/dev/null), rst2html.py, rst2html)
27 TESTS ?= 
28 DESTDIR ?=
29
30 REST_DOCS = README FAQ AUTHORS
31
32 all:: build build-inplace $(patsubst %,%.html,$(REST_DOCS))
33
34 build::
35         $(SETUP) build
36
37 build-inplace::
38         $(SETUP) build_ext --inplace
39
40 build-inplace-debug::
41         $(SETUP) build_ext --inplace --debug
42
43 install::
44 ifneq ($(DESTDIR),)
45         $(SETUP) install --root "$(DESTDIR)"
46 else
47         $(SETUP) install
48 endif
49  
50
51 clean::
52         $(SETUP) clean
53         rm -f *.so
54
55 TMP_PLUGINS_DIR = $(shell pwd)/.plugins
56
57 $(TMP_PLUGINS_DIR):
58         mkdir -p $@
59
60 $(TMP_PLUGINS_DIR)/svn: $(TMP_PLUGINS_DIR)
61         ln -sf .. $@
62
63 check:: build-inplace $(TMP_PLUGINS_DIR)/svn 
64         BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(DEBUGGER) $(PYTHON) $(PYTHON_OPTIONS) $(BZR) $(BZR_OPTIONS) selftest $(TEST_OPTIONS) --starting-with=bzrlib.plugins.svn $(TESTS)
65
66 check-verbose::
67         $(MAKE) check TEST_OPTIONS=-v
68
69 check-one::
70         $(MAKE) check TEST_OPTIONS=--one
71
72 check-random::
73         $(MAKE) check TEST_OPTIONS="--random=now --verbose --one"
74
75 valgrind-check:: build-inplace-debug
76         $(MAKE) check DEBUGGER="valgrind --suppressions=/usr/lib/valgrind/python.supp $(VALGRIND_OPTIONS)"
77
78 leak-check:: 
79         $(MAKE) valgrind-check VALGRIND_OPTIONS="--leak-check=full --show-reachable=yes --num-callers=200 --leak-resolution=med --log-file=leaks.log"
80
81 gdb-check:: build-inplace-debug
82         $(MAKE) check DEBUGGER="gdb --args $(GDB_OPTIONS)"
83
84 strace-check::
85         $(MAKE) check DEBUGGER="strace $(STRACE_OPTIONS)"
86
87 show-plugins::
88         BZR_PLUGIN_PATH=$(TMP_PLUGINS_DIR) $(BZR) plugins
89
90 lint::
91         $(PYLINT) -f parseable *.py */*.py
92
93 pydoctor::
94         $(PYDOCTOR) --make-html -c bzr-svn.cfg
95
96 FAQ.html README.html AUTHORS.html: %.html: %
97         $(RST2HTML) $< > $@
98
99 tags::
100         $(CTAGS) -R .
101
102 ctags:: tags
103
104 homepage.html: wiki.py README INSTALL
105         python wiki.py | tail -n +2 | rst2html > $@