63
18
pyflakes bzrlib | grep -v ' imported but unused'
66
$(PYTHON) setup.py clean
67
-find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
69
# Build API documentation
73
PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --html -o api/html --docformat 'restructuredtext en' $(docfiles)
75
PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --check --docformat 'restructuredtext en' $(docfiles)
77
# build tags for emacs and vim
84
# these are treated as phony so they'll always be rebuilt - it's pretty quick
90
# Default to plain documentation for maximum backwards compatibility.
91
# (Post 2.0, the defaults will most likely be Sphinx-style instead.)
95
clean-docs: clean-plain
100
### Man-page Documentation ###
102
MAN_DEPENDENCIES = bzrlib/builtins.py \
103
$(wildcard bzrlib/*.py) \
104
$(wildcard bzrlib/*/*.py) \
105
tools/generate_docs.py \
106
$(wildcard $(addsuffix /*.txt, bzrlib/help_topics/en))
108
MAN_PAGES = man1/bzr.1
109
man1/bzr.1: $(MAN_DEPENDENCIES)
110
$(PYTHON) tools/generate_docs.py -o $@ man
113
### Sphinx-style Documentation ###
115
# Build the documentation. To keep the dependencies down to a minimum
116
# for distro packagers, we only build the html documentation by default.
117
# Sphinx 0.6 or later is preferred for the best rendering, though
118
# Sphinx 0.4 or later should work. See http://sphinx.pocoo.org/index.html
119
# for installation instructions.
120
docs-sphinx: html-sphinx
122
# Clean out generated documentation
124
cd doc/en && make clean
125
cd doc/es && make clean
126
cd doc/ja && make clean
127
cd doc/ru && make clean
128
cd doc/developers && make clean
130
SPHINX_DEPENDENCIES = \
131
doc/en/release-notes/index.txt \
132
doc/en/user-reference/index.txt \
139
doc/developers/Makefile \
140
doc/developers/make.bat
142
NEWS_FILES = $(wildcard doc/en/release-notes/bzr-*.txt)
144
doc/en/user-reference/index.txt: $(MAN_DEPENDENCIES)
145
$(PYTHON) tools/generate_docs.py -o $@ rstx
147
doc/en/release-notes/index.txt: $(NEWS_FILES) tools/generate_release_notes.py
148
$(PYTHON) tools/generate_release_notes.py $@ $(NEWS_FILES)
150
doc/%/Makefile: doc/en/Makefile
151
$(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
153
doc/%/make.bat: doc/en/make.bat
154
$(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
156
# Build the html docs using Sphinx.
157
html-sphinx: $(SPHINX_DEPENDENCIES)
158
cd doc/en && make html
159
cd doc/es && make html
160
cd doc/ru && make html
161
cd doc/ja && make html
162
cd doc/developers && make html
164
# Build the PDF docs using Sphinx. This requires numerous LaTeX
165
# packages. See http://sphinx.pocoo.org/builders.html for details.
166
# Note: We don't currently build PDFs for the Russian docs because
167
# they require additional packages to be installed (to handle
168
# Russian hyphenation rules, etc.)
169
pdf-sphinx: $(SPHINX_DEPENDENCIES)
170
cd doc/en && make latex
171
cd doc/es && make latex
172
cd doc/ja && make latex
173
cd doc/developers && make latex
174
cd doc/en/_build/latex && make all-pdf
175
cd doc/es/_build/latex && make all-pdf
176
cd doc/developers/_build/latex && make all-pdf
178
# Build the CHM (Windows Help) docs using Sphinx.
179
# Note: HtmlHelp Workshop needs to be used on the generated hhp files
180
# to generate the final chm files.
181
chm-sphinx: $(SPHINX_DEPENDENCIES)
182
cd doc/en && make htmlhelp
183
cd doc/es && make htmlhelp
184
cd doc/ru && make htmlhelp
185
cd doc/ja && make htmlhelp
186
cd doc/developers && make htmlhelp
189
### Documentation Website ###
191
# Where to build the website
192
DOC_WEBSITE_BUILD = build_doc_website
194
# Build and package docs into a website, complete with downloads.
195
doc-website: html-sphinx pdf-sphinx
196
$(PYTHON) tools/package_docs.py doc/en $(DOC_WEBSITE_BUILD)
197
$(PYTHON) tools/package_docs.py doc/es $(DOC_WEBSITE_BUILD)
198
$(PYTHON) tools/package_docs.py doc/ru $(DOC_WEBSITE_BUILD)
199
$(PYTHON) tools/package_docs.py doc/ja $(DOC_WEBSITE_BUILD)
200
$(PYTHON) tools/package_docs.py doc/developers $(DOC_WEBSITE_BUILD)
203
### Plain Documentation ###
205
# While Sphinx is the preferred tool for building documentation, we still
206
# support our "plain" html documentation so that Sphinx is not a hard
207
# dependency for packagers on older platforms.
209
rst2html = $(PYTHON) tools/rst2html.py --link-stylesheet --footnote-references=superscript --halt=warning
211
# translate txt docs to html
212
derived_txt_files = \
213
doc/en/release-notes/NEWS.txt
215
doc/en/tutorials/tutorial.txt \
216
doc/en/tutorials/using_bazaar_with_launchpad.txt \
217
doc/en/tutorials/centralized_workflow.txt \
218
$(wildcard doc/es/tutorials/*.txt) \
219
$(wildcard doc/ru/tutorials/*.txt) \
220
doc/ja/tutorials/tutorial.txt \
221
doc/ja/tutorials/using_bazaar_with_launchpad.txt \
222
doc/ja/tutorials/centralized_workflow.txt \
223
$(wildcard doc/*/mini-tutorial/index.txt) \
224
$(wildcard doc/*/user-guide/index-plain.txt) \
225
doc/en/admin-guide/index-plain.txt \
226
$(wildcard doc/es/guia-usario/*.txt) \
227
$(derived_txt_files) \
228
doc/en/upgrade-guide/index.txt \
230
$(wildcard doc/index.*.txt)
232
doc/en/user-guide/index.txt \
233
doc/es/user-guide/index.txt \
234
doc/ja/user-guide/index.txt \
235
doc/ru/user-guide/index.txt \
236
doc/en/admin-guide/index.txt
237
txt_files = $(filter-out $(txt_nohtml), $(txt_all))
238
htm_files = $(patsubst %.txt, %.html, $(txt_files))
242
$(wildcard doc/*/bzr-en-quick-reference.svg) \
243
$(wildcard doc/*/bzr-en-quick-reference.png) \
244
$(wildcard doc/*/bzr-en-quick-reference.pdf) \
245
$(wildcard doc/*/bzr-es-quick-reference.svg) \
246
$(wildcard doc/*/bzr-es-quick-reference.png) \
247
$(wildcard doc/*/bzr-es-quick-reference.pdf) \
248
$(wildcard doc/*/bzr-ru-quick-reference.svg) \
249
$(wildcard doc/*/bzr-ru-quick-reference.png) \
250
$(wildcard doc/*/bzr-ru-quick-reference.pdf) \
251
$(wildcard doc/*/user-guide/images/*.png)
253
# doc/developers/*.txt files that should *not* be individually
256
doc/developers/add.txt \
257
doc/developers/annotate.txt \
258
doc/developers/bundle-creation.txt \
259
doc/developers/commit.txt \
260
doc/developers/diff.txt \
261
doc/developers/directory-fingerprints.txt \
262
doc/developers/gc.txt \
263
doc/developers/implementation-notes.txt \
264
doc/developers/incremental-push-pull.txt \
265
doc/developers/index.txt \
266
doc/developers/initial-push-pull.txt \
267
doc/developers/merge-scaling.txt \
268
doc/developers/miscellaneous-notes.txt \
269
doc/developers/missing.txt \
270
doc/developers/performance-roadmap-rationale.txt \
271
doc/developers/performance-use-case-analysis.txt \
272
doc/developers/planned-change-integration.txt \
273
doc/developers/planned-performance-changes.txt \
274
doc/developers/plans.txt \
275
doc/developers/process.txt \
276
doc/developers/revert.txt \
277
doc/developers/specifications.txt \
278
doc/developers/status.txt \
279
doc/developers/uncommit.txt
281
dev_txt_all = $(wildcard $(addsuffix /*.txt, doc/developers))
282
dev_txt_files = $(filter-out $(dev_txt_nohtml), $(dev_txt_all))
283
dev_htm_files = $(patsubst %.txt, %.html, $(dev_txt_files))
285
doc/en/user-guide/index-plain.html: $(wildcard $(addsuffix /*.txt, doc/en/user-guide))
286
$(rst2html) --stylesheet=../../default.css $(dir $@)index-plain.txt $@
288
#doc/es/user-guide/index.html: $(wildcard $(addsuffix /*.txt, doc/es/user-guide))
289
# $(rst2html) --stylesheet=../../default.css $(dir $@)index.txt $@
291
#doc/ru/user-guide/index.html: $(wildcard $(addsuffix /*.txt, doc/ru/user-guide))
292
# $(rst2html) --stylesheet=../../default.css $(dir $@)index.txt $@
294
doc/en/admin-guide/index-plain.html: $(wildcard $(addsuffix /*.txt, doc/en/admin-guide))
295
$(rst2html) --stylesheet=../../default.css $(dir $@)index-plain.txt $@
297
doc/developers/%.html: doc/developers/%.txt
298
$(rst2html) --stylesheet=../default.css $< $@
300
doc/index.html: doc/index.txt
301
$(rst2html) --stylesheet=default.css $< $@
303
doc/index.%.html: doc/index.%.txt
304
$(rst2html) --stylesheet=default.css $< $@
307
$(rst2html) --stylesheet=../../default.css $< "$@"
309
doc/en/release-notes/NEWS.txt: $(NEWS_FILES) tools/generate_release_notes.py
310
$(PYTHON) tools/generate_release_notes.py "$@" $(NEWS_FILES)
312
upgrade_guide_dependencies = $(wildcard $(addsuffix /*.txt, doc/en/upgrade-guide))
314
doc/en/upgrade-guide/index.html: $(upgrade_guide_dependencies)
315
$(rst2html) --stylesheet=../../default.css $(dir $@)index.txt $@
317
derived_web_docs = $(htm_files) $(dev_htm_files)
318
WEB_DOCS = $(derived_web_docs) $(non_txt_files)
319
ALL_DOCS = $(derived_web_docs) $(MAN_PAGES)
321
# the main target to build all the docs
322
docs-plain: $(ALL_DOCS)
324
# produce a tree containing just the final docs, ready for uploading to the web
326
html-plain: docs-plain
327
$(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) $(HTMLDIR)
329
# clean produced docs
331
$(PYTHON) tools/win32/ostools.py remove $(ALL_DOCS) \
332
$(HTMLDIR) $(derived_txt_files)
335
### Miscellaneous Documentation Targets ###
337
# build a png of our performance task list
338
# this is no longer built by default; you can build it if you want to look at it
339
doc/developers/performance.png: doc/developers/performance.dot
341
@dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
344
### Windows Support ###
346
# make all the installers completely from scratch, using zc.buildout
347
# to fetch the dependencies
348
# These are files that need to be copied into the build location to boostrap
350
# Note that the path is relative to tools/win32
351
BUILDOUT_FILES = buildout.cfg \
352
buildout-templates/bin/build-installer.bat.in \
353
ostools.py bootstrap.py
356
@echo Make all the installers from scratch
357
@# Build everything in a separate directory, to avoid cluttering the WT
358
$(PYTHON) tools/win32/ostools.py makedir build-win32
359
@# cd to tools/win32 so that the relative paths are copied correctly
360
cd tools/win32 && $(PYTHON) ostools.py copytree $(BUILDOUT_FILES) ../../build-win32
361
@# There seems to be a bug in gf.release.bzr, It doesn't correctly update
362
@# existing release directories, so delete them manually before building
363
@# It means things may be rebuilt that don't need to be, but at least
364
@# it will be correct when they do.
365
cd build-win32 && $(PYTHON) ostools.py remove release */release
366
cd build-win32 && $(PYTHON) bootstrap.py
367
cd build-win32 && bin/buildout
368
cd build-win32 && bin/build-installer.bat $(BZR_TARGET) $(PLUGIN_TARGET)
372
$(PYTHON) tools/win32/ostools.py remove build-win32
374
# make bzr.exe for win32 with py2exe
376
@echo *** Make bzr.exe
377
$(PYTHON) tools/win32/ostools.py remove bzrlib/*.pyd
378
$(PYTHON) setup.py build_ext -i -f $(PYTHON_BUILDFLAGS)
379
$(PYTHON) setup.py py2exe > py2exe.log
380
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/start_bzr.bat win32_bzr.exe
381
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_bzr.exe
383
# win32 installer for bzr.exe
384
installer: exe copy-docs
385
@echo *** Make Windows installer
386
$(PYTHON) tools/win32/run_script.py cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
387
iscc /Q tools/win32/bzr.iss
389
# win32 Python's distutils-based installer
390
# require to have Python interpreter installed on win32
392
$(PYTHON24) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
395
$(PYTHON25) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
398
$(PYTHON26) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
400
python-installer: py-inst-24 py-inst-25 py-inst-26
404
$(PYTHON) tools/win32/ostools.py copytodir README win32_bzr.exe/doc
405
$(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_bzr.exe
407
# clean on win32 all installer-related files and directories
408
clean-win32: clean-docs
409
$(PYTHON) tools/win32/ostools.py remove build
410
$(PYTHON) tools/win32/ostools.py remove win32_bzr.exe
411
$(PYTHON) tools/win32/ostools.py remove py2exe.log
412
$(PYTHON) tools/win32/ostools.py remove tools/win32/bzr.iss
413
$(PYTHON) tools/win32/ostools.py remove bzr-setup*.exe
414
$(PYTHON) tools/win32/ostools.py remove bzr-*win32.exe
415
$(PYTHON) tools/win32/ostools.py remove dist
418
### Packaging Targets ###
420
.PHONY: dist check-dist-tarball
422
# build a distribution source tarball
424
# this method of copying the pyrex generated files is a bit ugly; it would be
425
# nicer to generate it from distutils.
427
version=`./bzr version --short` && \
428
echo Building distribution of bzr $$version && \
429
expbasedir=`mktemp -t -d tmp_bzr_dist.XXXXXXXXXX` && \
430
expdir=$$expbasedir/bzr-$$version && \
431
tarball=$$PWD/../bzr-$$version.tar.gz && \
434
bzr export $$expdir && \
435
cp bzrlib/*.c bzrlib/*.h $$expdir/bzrlib/. && \
436
tar cfz $$tarball -C $$expbasedir bzr-$$version && \
437
gpg --detach-sign $$tarball && \
440
# run all tests in a previously built tarball
442
tmpdir=`mktemp -t -d tmp_bzr_check_dist.XXXXXXXXXX` && \
443
version=`./bzr version --short` && \
444
tarball=$$PWD/../bzr-$$version.tar.gz && \
445
tar Cxz $$tmpdir -f $$tarball && \
446
$(MAKE) -C $$tmpdir/bzr-$$version check && \
22
-find . -name "*.pyc" -o -name "*.pyo" | xargs rm -f
28
# build emacs cross-reference
29
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
31
ctags-exuberant -e $(tag_files)
33
tutorial.html: tutorial.txt
34
rest2html tutorial.txt > tutorial.html