1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
# A relatively simple Makefile to assist in building parts of bzr. Mostly for
18
# building documentation, etc.
23
.PHONY: all clean extensions pyflakes api-docs
28
@echo "building extension modules."
29
python setup.py build_ext -i
31
check: docs extensions
32
python -Werror -O ./bzr selftest -1v $(tests)
33
@echo "Running all tests with no locale."
34
LC_CTYPE= LANG=C LC_ALL= ./bzr selftest -1v $(tests) 2>&1 | sed -e 's/^/[ascii] /'
36
# Run Python style checker (apt-get install pyflakes)
38
# Note that at present this gives many false warnings, because it doesn't
39
# know about identifiers loaded through lazy_import.
44
# There are many of these warnings at the moment and they're not a
45
# high priority to fix
46
pyflakes bzrlib | grep -v ' imported but unused'
50
-find . -name "*.pyc" -o -name "*.pyo" | xargs rm -f
53
# Build API documentation
57
PYTHONPATH=$(PWD) python tools/bzr_epydoc --html -o api/html --docformat 'restructuredtext en' $(docfiles)
59
PYTHONPATH=$(PWD) python tools/bzr_epydoc --check --docformat 'restructuredtext en' $(docfiles)
61
# build tags for emacs and vim
68
# these are treated as phony so they'll always be rebuilt - it's pretty quick
73
# set PRETTY to get docs that look like the Bazaar web site
75
rst2html := python tools/rst2prettyhtml.py doc/bazaar-vcs.org.kid
77
rst2html := python tools/rst2html.py --link-stylesheet --footnote-references=superscript
80
# translate txt docs to html
81
derived_txt_files := \
82
doc/en/user-reference/bzr_man.txt \
83
doc/en/developer-guide/HACKING.txt \
84
doc/en/release-notes/NEWS.txt
85
doc_dir := doc/en/user-guide
86
txt_files := $(wildcard $(addsuffix /*.txt, $(doc_dir))) $(derived_txt_files) \
87
doc/en/mini-tutorial/index.txt \
91
doc/en/quick-reference/quick-start-summary.svg
92
htm_files := $(patsubst %.txt, %.html, $(txt_files))
93
dev_txt_files := $(wildcard $(addsuffix /*.txt, doc/developers))
94
dev_htm_files := $(patsubst %.txt, %.html, $(dev_txt_files))
96
doc/developers/%.html: doc/developers/%.txt
97
$(rst2html) --stylesheet=../default.css $< $@
99
doc/index.html: doc/index.txt
100
$(rst2html) --stylesheet=default.css $< $@
103
$(rst2html) --stylesheet=../../default.css $< $@
105
MAN_DEPENDENCIES = bzrlib/builtins.py \
106
bzrlib/bundle/commands.py \
107
bzrlib/conflicts.py \
108
bzrlib/sign_my_commits.py \
110
tools/doc_generate/__init__.py \
111
tools/doc_generate/autodoc_man.py \
112
tools/doc_generate/autodoc_rstx.py
114
doc/en/user-reference/bzr_man.txt: $(MAN_DEPENDENCIES)
115
python generate_docs.py -o $@ rstx
117
doc/en/developer-guide/HACKING.txt: doc/developers/HACKING.txt
118
python tools/win32/ostools.py copytodir doc/developers/HACKING.txt doc/en/developer-guide
120
doc/en/release-notes/NEWS.txt: NEWS
121
python -c "import shutil; shutil.copyfile('$<', '$@')"
123
MAN_PAGES = man1/bzr.1
124
man1/bzr.1: $(MAN_DEPENDENCIES)
125
python generate_docs.py -o $@ man
127
# build a png of our performance task list
128
doc/developers/performance.png: doc/developers/performance.dot
130
@dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
132
derived_web_docs = $(htm_files) $(dev_htm_files) doc/developers/performance.png
133
WEB_DOCS = $(derived_web_docs) $(non_txt_files)
134
ALL_DOCS = $(derived_web_docs) $(MAN_PAGES)
136
# the main target to build all the docs
139
# produce a tree containing just the final docs, ready for uploading to the web
142
python tools/win32/ostools.py copytree $(WEB_DOCS) $(HTMLDIR)
144
# clean produced docs
146
python tools/win32/ostools.py remove $(ALL_DOCS) \
147
$(HTMLDIR) $(derived_txt_files)
150
### Windows Support ###
152
# make bzr.exe for win32 with py2exe
154
@echo *** Make bzr.exe
155
python setup.py build_ext -i -f
156
python setup.py py2exe > py2exe.log
157
python tools/win32/ostools.py copytodir tools/win32/start_bzr.bat win32_bzr.exe
158
python tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_bzr.exe
160
# win32 installer for bzr.exe
161
installer: exe copy-docs
162
@echo *** Make windows installer
163
cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
164
iscc /Q tools/win32/bzr.iss
166
# win32 python's distutils-based installer
167
# require to have python interpreter installed on win32
168
python-installer: docs
169
python24 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
170
python25 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
173
python tools/win32/ostools.py copytodir README win32_bzr.exe/doc
174
python tools/win32/ostools.py copytree $(WEB_DOCS) win32_bzr.exe
176
# clean on win32 all installer-related files and directories
177
clean-win32: clean-docs
178
python tools/win32/ostools.py remove build
179
python tools/win32/ostools.py remove win32_bzr.exe
180
python tools/win32/ostools.py remove py2exe.log
181
python tools/win32/ostools.py remove tools/win32/bzr.iss
182
python tools/win32/ostools.py remove bzr-setup*.exe
183
python tools/win32/ostools.py remove bzr-*win32.exe
184
python tools/win32/ostools.py remove dist
10
# build emacs cross-reference
11
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
13
ctags-exuberant -e $(tag_files)