1
# Copyright (C) 2005-2012, 2016, 2017 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
# A relatively simple Makefile to assist in building parts of brz. Mostly for
18
# building documentation, etc.
29
PLUGIN_TARGET=plugin-release
31
BRZ_PLUGIN_PATH=-site:-user
33
# Shorter replacement for $(sort $(wildcard <arg>)) as $(call sw,<arg>)
34
sw = $(sort $(wildcard $(1)))
37
.PHONY: all clean realclean extensions flake8 api-docs check-nodocs check
42
@echo "building extension modules."
43
$(PYTHON) setup.py build_ext -i $(PYTHON_BUILDFLAGS)
45
check: docs check-nodocs
47
check-nodocs: check-nodocs2 check-nodocs3
50
# Generate a stream for PQM to watch.
51
-$(RM) -f selftest.log
52
echo `date` ": selftest starts" 1>&2
53
set -o pipefail; BRZ_PLUGIN_PATH=$(BRZ_PLUGIN_PATH) $(PYTHON3) -Werror -Wignore::ImportWarning -Wignore::PendingDeprecationWarning -Wignore::DeprecationWarning -O \
54
./brz selftest -Oselftest.timeout=120 --strict \
55
--subunit2 $(tests) | tee selftest.log | subunit-2to1
56
echo `date` ": selftest ends" 1>&2
57
# An empty log file should catch errors in the $(PYTHON3)
58
# command above (the '|' swallow any errors since 'make'
59
# sees the 'tee' exit code for the whole line
60
if [ ! -s selftest.log ] ; then exit 1 ; fi
61
# Check that there were no errors reported.
62
subunit-stats < selftest.log
64
check-nodocs2: extensions
65
# Generate a stream for PQM to watch.
66
-$(RM) -f selftest.log
67
echo `date` ": selftest starts" 1>&2
68
set -o pipefail; BRZ_PLUGIN_PATH=$(BRZ_PLUGIN_PATH) $(PYTHON) -Werror -Wignore::ImportWarning -Wignore::DeprecationWarning -O \
69
./brz selftest -Oselftest.timeout=120 \
70
--subunit2 $(tests) | tee selftest.log | subunit-2to1
71
echo `date` ": selftest ends" 1>&2
72
# An empty log file should catch errors in the $(PYTHON)
73
# command above (the '|' swallow any errors since 'make'
74
# sees the 'tee' exit code for the whole line
75
if [ ! -s selftest.log ] ; then exit 1 ; fi
76
# Check that there were no errors reported.
77
subunit-stats < selftest.log
79
check-ci: docs extensions
80
# FIXME: Remove -Wignore::FutureWarning once
81
# https://github.com/paramiko/paramiko/issues/713 is not a concern
82
# anymore -- vila 2017-05-24
84
BRZ_PLUGIN_PATH=$(BRZ_PLUGIN_PATH) $(PYTHON2) -Werror -Wignore::FutureWarning -Wignore::DeprecationWarning -Wignore::ImportWarning -Wignore::ResourceWarning -O \
85
./brz selftest -v --parallel=fork -Oselftest.timeout=120 --subunit2 \
86
| subunit-filter -s --passthrough --rename "^" "python2."; \
87
BRZ_PLUGIN_PATH=$(BRZ_PLUGIN_PATH) $(PYTHON3) -Werror -Wignore::FutureWarning -Wignore::DeprecationWarning -Wignore::PendingDeprecationWarning -Wignore::ImportWarning -Wignore::ResourceWarning -O \
88
./brz selftest -v --parallel=fork -Oselftest.timeout=120 --subunit2 \
89
| subunit-filter -s --passthrough --rename "^" "python3."
91
# Run Python style checker (apt-get install flake8)
93
# Note that at present this gives many false warnings, because it doesn't
94
# know about identifiers loaded through lazy_import.
99
$(PYTHON) setup.py clean
100
-find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
103
# Remove files which are autogenerated but included by the tarball.
104
rm -f breezy/*_pyx.c breezy/bzr/*_pyx.c
105
rm -f breezy/_simple_set_pyx.h breezy/_simple_set_pyx_api.h
107
# build tags for emacs and vim
114
# these are treated as phony so they'll always be rebuilt - it's pretty quick
118
### Documentation ###
122
clean-docs: clean-sphinx
124
html-docs: html-sphinx
127
### Man-page Documentation ###
129
MAN_DEPENDENCIES = breezy/builtins.py \
130
$(call sw,breezy/*.py) \
131
$(call sw,breezy/*/*.py) \
132
tools/generate_docs.py \
133
$(call sw,$(addsuffix /*.txt, breezy/help_topics/en))
135
MAN_PAGES = man1/brz.1
136
man1/brz.1: $(MAN_DEPENDENCIES)
138
$(PYTHON) tools/generate_docs.py -o $@ man
141
### Sphinx-style Documentation ###
143
# Build the documentation. To keep the dependencies down to a minimum
144
# for distro packagers, we only build the html documentation by default.
145
# Sphinx 0.6 or later is preferred for the best rendering, though
146
# Sphinx 0.4 or later should work. See http://sphinx.pocoo.org/index.html
147
# for installation instructions.
148
docs-sphinx: html-sphinx
150
# Clean out generated documentation
152
$(MAKE) -C doc/en clean
153
$(MAKE) -C doc/developers clean
155
SPHINX_DEPENDENCIES = \
156
doc/en/release-notes/index.txt \
157
doc/en/user-reference/index.txt \
158
doc/developers/Makefile \
159
doc/developers/make.bat
161
NEWS_FILES = $(call sw,doc/en/release-notes/brz-*.txt)
163
doc/en/user-reference/index.txt: $(MAN_DEPENDENCIES)
164
LANGUAGE=C $(PYTHON) tools/generate_docs.py -o $@ rstx
166
doc/en/release-notes/index.txt: $(NEWS_FILES) tools/generate_release_notes.py
167
$(PYTHON) tools/generate_release_notes.py $@ $(NEWS_FILES)
169
doc/%/Makefile: doc/en/Makefile
170
$(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
172
doc/%/make.bat: doc/en/make.bat
173
$(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
175
# Build the html docs using Sphinx.
176
html-sphinx: $(SPHINX_DEPENDENCIES)
177
$(MAKE) -C doc/en html
178
$(MAKE) -C doc/developers api html
180
# Build the PDF docs using Sphinx. This requires numerous LaTeX
181
# packages. See http://sphinx.pocoo.org/builders.html for details.
182
# Note: We don't currently build PDFs for the Russian docs because
183
# they require additional packages to be installed (to handle
184
# Russian hyphenation rules, etc.)
185
pdf-sphinx: $(SPHINX_DEPENDENCIES)
186
$(MAKE) -C doc/en latex
187
$(MAKE) -C doc/developers latex
188
$(MAKE) -C doc/en/_build/latex all-pdf
189
$(MAKE) -C doc/developers/_build/latex all-pdf
191
# Build the CHM (Windows Help) docs using Sphinx.
192
# Note: HtmlHelp Workshop needs to be used on the generated hhp files
193
# to generate the final chm files.
194
chm-sphinx: $(SPHINX_DEPENDENCIES)
195
$(MAKE) -C doc/en htmlhelp
196
$(MAKE) -C doc/developers htmlhelp
199
# Build the texinfo files using Sphinx.
200
texinfo-sphinx: $(SPHINX_DEPENDENCIES)
201
$(MAKE) -C doc/en texinfo
202
$(MAKE) -C doc/developers texinfo
204
### Documentation Website ###
206
# Where to build the website
207
DOC_WEBSITE_BUILD = build_doc_website
209
# Build and package docs into a website, complete with downloads.
210
doc-website: html-sphinx pdf-sphinx
211
$(PYTHON) tools/package_docs.py doc/en $(DOC_WEBSITE_BUILD)
212
$(PYTHON) tools/package_docs.py doc/developers $(DOC_WEBSITE_BUILD)
215
### Miscellaneous Documentation Targets ###
217
# build a png of our performance task list
218
# this is no longer built by default; you can build it if you want to look at it
219
doc/developers/performance.png: doc/developers/performance.dot
221
@dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
224
### Windows Support ###
226
# make all the installers completely from scratch, using zc.buildout
227
# to fetch the dependencies
228
# These are files that need to be copied into the build location to boostrap
230
# Note that the path is relative to tools/win32
231
BUILDOUT_FILES = buildout.cfg \
232
buildout-templates/bin/build-installer.bat.in \
233
ostools.py bootstrap.py
236
@echo Make all the installers from scratch
237
@# Build everything in a separate directory, to avoid cluttering the WT
238
$(PYTHON) tools/win32/ostools.py makedir build-win32
239
@# cd to tools/win32 so that the relative paths are copied correctly
240
cd tools/win32 && $(PYTHON) ostools.py copytree $(BUILDOUT_FILES) ../../build-win32
241
@# There seems to be a bug in gf.release.brz, It doesn't correctly update
242
@# existing release directories, so delete them manually before building
243
@# It means things may be rebuilt that don't need to be, but at least
244
@# it will be correct when they do.
245
cd build-win32 && $(PYTHON) ostools.py remove release */release
246
cd build-win32 && $(PYTHON) bootstrap.py
247
cd build-win32 && bin/buildout
248
cd build-win32 && bin/build-installer.bat $(BRZ_TARGET) $(PLUGIN_TARGET)
252
$(PYTHON) tools/win32/ostools.py remove build-win32
254
# make brz.exe for win32 with py2exe
256
@echo *** Make brz.exe
257
$(PYTHON) tools/win32/ostools.py remove breezy/*.pyd
258
$(PYTHON) setup.py build_ext -i -f $(PYTHON_BUILDFLAGS)
259
$(PYTHON) setup.py py2exe > py2exe.log
260
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/start_brz.bat win32_brz.exe
261
$(PYTHON) tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_brz.exe
263
# win32 installer for brz.exe
264
installer: exe copy-docs
265
@echo *** Make Windows installer
266
$(PYTHON) tools/win32/run_script.py cog.py -d -o tools/win32/brz.iss tools/win32/brz.iss.cog
267
iscc /Q tools/win32/brz.iss
270
$(PYTHON27) setup.py bdist_wininst --install-script="brz-win32-bdist-postinstall.py" -d .
272
python-installer: py-inst-27
276
$(PYTHON) tools/win32/ostools.py copytodir README win32_brz.exe/doc
277
$(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_brz.exe
279
# clean on win32 all installer-related files and directories
280
clean-win32: clean-docs
281
$(PYTHON) tools/win32/ostools.py remove build
282
$(PYTHON) tools/win32/ostools.py remove win32_brz.exe
283
$(PYTHON) tools/win32/ostools.py remove py2exe.log
284
$(PYTHON) tools/win32/ostools.py remove tools/win32/brz.iss
285
$(PYTHON) tools/win32/ostools.py remove brz-setup*.exe
286
$(PYTHON) tools/win32/ostools.py remove brz-*win32.exe
287
$(PYTHON) tools/win32/ostools.py remove dist
292
.PHONY: update-pot po/brz.pot
293
update-pot: po/brz.pot
295
TRANSLATABLE_PYFILES:=$(shell find breezy -name '*.py' \
296
| grep -v 'breezy/tests/' \
297
| grep -v 'breezy/doc' \
300
po/brz.pot: $(PYFILES) $(DOCFILES)
301
$(PYTHON) ./brz export-pot --include-duplicates > po/brz.pot
302
echo $(TRANSLATABLE_PYFILES) | xargs \
303
xgettext --package-name "brz" \
304
--msgid-bugs-address "<bazaar@canonical.com>" \
305
--copyright-holder "Canonical" \
306
--from-code ISO-8859-1 --join --sort-by-file --add-comments=i18n: \
307
-d bzr -p po -o brz.pot
310
### Packaging Targets ###
312
.PHONY: dist check-dist-tarball
314
# build a distribution source tarball
316
version=`./brz version --short` && \
317
echo Building distribution of brz $$version && \
318
expbasedir=`mktemp -t -d tmp_brz_dist.XXXXXXXXXX` && \
319
expdir=$$expbasedir/brz-$$version && \
320
tarball=$$PWD/../breezy-$$version.tar.gz && \
323
$(PYTHON) setup.py sdist -d $$PWD/.. && \
324
gpg --detach-sign --armor $$tarball && \
327
# run all tests in a previously built tarball
329
tmpdir=`mktemp -t -d tmp_brz_check_dist.XXXXXXXXXX` && \
330
version=`./brz version --short` && \
331
tarball=$$PWD/../breezy-$$version.tar.gz && \
332
tar Cxz $$tmpdir -f $$tarball && \
333
$(MAKE) -C $$tmpdir/breezy-$$version check && \
4
./bzr selftest $(tests)
5
@echo "Running all tests with no locale."
6
LC_CTYPE= LANG=C LC_ALL= ./bzr selftest $(tests)
9
./bzr --no-plugins selftest -v msgeditor
13
-find . -name "*.pyc" -o -name "*.pyo" | xargs rm -f
19
# build emacs cross-reference
20
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
22
ctags-exuberant -e $(tag_files)
24
tutorial.html: tutorial.txt
25
rest2html tutorial.txt > tutorial.html