1
# Copyright (C) 2005, 2006, 2007, 2008 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.
26
.PHONY: all clean extensions pyflakes api-docs
31
@echo "building extension modules."
32
$(PYTHON) setup.py build_ext -i $(PYTHON_BUILDFLAGS)
34
check: docs extensions
35
$(PYTHON) -Werror -O ./bzr selftest -1v $(tests)
36
@echo "Running all tests with no locale."
37
LC_CTYPE= LANG=C LC_ALL= ./bzr selftest -1v $(tests) 2>&1 | sed -e 's/^/[ascii] /'
39
# Run Python style checker (apt-get install pyflakes)
41
# Note that at present this gives many false warnings, because it doesn't
42
# know about identifiers loaded through lazy_import.
47
# There are many of these warnings at the moment and they're not a
48
# high priority to fix
49
pyflakes bzrlib | grep -v ' imported but unused'
52
$(PYTHON) setup.py clean
53
-find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
55
# Build API documentation
59
PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --html -o api/html --docformat 'restructuredtext en' $(docfiles)
61
PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --check --docformat 'restructuredtext en' $(docfiles)
63
# build tags for emacs and vim
70
# these are treated as phony so they'll always be rebuilt - it's pretty quick
75
# set PRETTY to get docs that look like the Bazaar web site
77
rst2html := $(PYTHON) tools/rst2prettyhtml.py doc/bazaar-vcs.org.kid
79
rst2html := $(PYTHON) tools/rst2html.py --link-stylesheet --footnote-references=superscript --halt=warning
82
# translate txt docs to html
83
derived_txt_files := \
84
doc/en/user-reference/bzr_man.txt \
85
doc/en/developer-guide/HACKING.txt \
86
doc/en/release-notes/NEWS.txt
87
txt_files := $(wildcard doc/en/tutorials/*.txt) \
88
$(derived_txt_files) \
89
doc/en/user-guide/index.txt \
90
doc/en/mini-tutorial/index.txt \
91
$(wildcard doc/es/guia-usario/*.txt) \
92
doc/es/mini-tutorial/index.txt \
97
doc/en/quick-reference/quick-start-summary.svg \
98
doc/en/quick-reference/quick-start-summary.png \
99
doc/en/quick-reference/quick-start-summary.pdf \
100
$(wildcard doc/en/user-guide/images/*.png) \
101
doc/es/referencia-rapida/referencia-rapida.svg \
102
doc/es/referencia-rapida/referencia-rapida.png \
103
doc/es/referencia-rapida/referencia-rapida.pdf \
104
$(wildcard doc/es/guia-usuario/images/*.png)
105
htm_files := $(patsubst %.txt, %.html, $(txt_files))
106
dev_txt_files := $(wildcard $(addsuffix /*.txt, doc/developers))
107
dev_htm_files := $(patsubst %.txt, %.html, $(dev_txt_files))
109
doc/en/user-guide/index.html: $(wildcard $(addsuffix /*.txt, doc/en/user-guide))
110
$(rst2html) --stylesheet=../../default.css doc/en/user-guide/index.txt $@
112
doc/developers/%.html: doc/developers/%.txt
113
$(rst2html) --stylesheet=../default.css $< $@
115
doc/index.html: doc/index.txt
116
$(rst2html) --stylesheet=default.css $< $@
119
$(rst2html) --stylesheet=../../default.css $< $@
121
MAN_DEPENDENCIES = bzrlib/builtins.py \
122
bzrlib/bundle/commands.py \
123
bzrlib/conflicts.py \
124
bzrlib/help_topics/__init__.py \
125
bzrlib/sign_my_commits.py \
126
bzrlib/bugtracker.py \
128
tools/doc_generate/__init__.py \
129
tools/doc_generate/autodoc_man.py \
130
tools/doc_generate/autodoc_rstx.py \
131
$(wildcard $(addsuffix /*.txt, bzrlib/help_topics/en))
133
doc/en/user-reference/bzr_man.txt: $(MAN_DEPENDENCIES)
134
$(PYTHON) generate_docs.py -o $@ rstx
136
doc/en/developer-guide/HACKING.txt: doc/developers/HACKING.txt
137
$(PYTHON) tools/win32/ostools.py copytodir doc/developers/HACKING.txt doc/en/developer-guide
139
doc/en/release-notes/NEWS.txt: NEWS
140
$(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
142
MAN_PAGES = man1/bzr.1
143
man1/bzr.1: $(MAN_DEPENDENCIES)
144
$(PYTHON) generate_docs.py -o $@ man
146
# build a png of our performance task list
147
doc/developers/performance.png: doc/developers/performance.dot
149
@dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
151
derived_web_docs = $(htm_files) $(dev_htm_files) doc/developers/performance.png
152
WEB_DOCS = $(derived_web_docs) $(non_txt_files)
153
ALL_DOCS = $(derived_web_docs) $(MAN_PAGES)
155
# the main target to build all the docs
158
# produce a tree containing just the final docs, ready for uploading to the web
161
$(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) $(HTMLDIR)
163
# clean produced docs
165
$(PYTHON) tools/win32/ostools.py remove $(ALL_DOCS) \
166
$(HTMLDIR) $(derived_txt_files)
169
### Windows Support ###
171
# make bzr.exe for win32 with py2exe
173
@echo *** Make bzr.exe
174
$(PYTHON) setup.py build_ext -i -f $(PYTHON_BUILDFLAGS)
175
$(PYTHON) setup.py py2exe > py2exe.log
176
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/start_bzr.bat win32_bzr.exe
177
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_bzr.exe
179
# win32 installer for bzr.exe
180
installer: exe copy-docs
181
@echo *** Make windows installer
182
$(PYTHON) tools/win32/run_script.py cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
183
iscc /Q tools/win32/bzr.iss
185
# win32 Python's distutils-based installer
186
# require to have Python interpreter installed on win32
188
python24 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
191
python25 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
193
python-installer: py-inst-24 py-inst-25
197
$(PYTHON) tools/win32/ostools.py copytodir README win32_bzr.exe/doc
198
$(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_bzr.exe
200
# clean on win32 all installer-related files and directories
201
clean-win32: clean-docs
202
$(PYTHON) tools/win32/ostools.py remove build
203
$(PYTHON) tools/win32/ostools.py remove win32_bzr.exe
204
$(PYTHON) tools/win32/ostools.py remove py2exe.log
205
$(PYTHON) tools/win32/ostools.py remove tools/win32/bzr.iss
206
$(PYTHON) tools/win32/ostools.py remove bzr-setup*.exe
207
$(PYTHON) tools/win32/ostools.py remove bzr-*win32.exe
208
$(PYTHON) tools/win32/ostools.py remove dist
210
.PHONY: dist dist-upload-escudero check-dist-tarball
212
# build a distribution tarball and zip file.
214
# this method of copying the pyrex generated files is a bit ugly; it would be
215
# nicer to generate it from distutils.
217
version=`./bzr version --short` && \
218
echo Building distribution of bzr $$version && \
219
expbasedir=`mktemp -t -d tmp_bzr_dist.XXXXXXXXXX` && \
220
expdir=$$expbasedir/bzr-$$version && \
221
tarball=$$PWD/../bzr-$$version.tar.gz && \
222
zipball=$$PWD/../bzr-$$version.zip && \
225
bzr export $$expdir && \
226
cp bzrlib/*.c $$expdir/bzrlib/. && \
227
tar cfz $$tarball -C $$expbasedir bzr-$$version && \
228
(cd $$expbasedir && zip -r $$zipball bzr-$$version) && \
229
gpg --detach-sign $$tarball && \
230
gpg --detach-sign $$zipball && \
233
# run all tests in a previously built tarball
235
tmpdir=`mktemp -t -d tmp_bzr_check_dist.XXXXXXXXXX` && \
236
version=`./bzr version --short` && \
237
tarball=$$PWD/../bzr-$$version.tar.gz && \
238
tar Cxz $$tmpdir -f $$tarball && \
239
$(MAKE) -C $$tmpdir/bzr-$$version check && \
243
# upload previously built tarball to the download directory on bazaar-vcs.org,
244
# and verify that it can be downloaded ok.
245
dist-upload-escudero:
246
version=`./bzr version --short` && \
247
tarball=../bzr-$$version.tar.gz && \
248
zipball=../bzr-$$version.zip && \
249
scp $$zipball $$zipball.sig $$tarball $$tarball.sig \
250
escudero.ubuntu.com:/srv/bazaar.canonical.com/www/releases/src \
252
echo verifying over http... && \
253
curl http://bazaar-vcs.org/releases/src/bzr-$$version.zip \
254
| diff -s - $$zipball && \
255
curl http://bazaar-vcs.org/releases/src/bzr-$$version.zip.sig \
256
| diff -s - $$zipball.sig
257
curl http://bazaar-vcs.org/releases/src/bzr-$$version.tar.gz \
258
| diff -s - $$tarball && \
259
curl http://bazaar-vcs.org/releases/src/bzr-$$version.tar.gz.sig \
260
| diff -s - $$tarball.sig
12
find . -name "*.pyc" | xargs rm
18
# build emacs cross-reference
19
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
21
ctags-exuberant -e $(tag_files)