/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to Makefile

Tweaks from merge review

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2012, 2016, 2017 Canonical Ltd
2
 
#
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.
7
 
#
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.
12
 
#
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
16
 
 
17
 
# A relatively simple Makefile to assist in building parts of brz. Mostly for
18
 
# building documentation, etc.
19
 
 
20
 
 
21
 
### Core Stuff ###
22
 
 
23
 
SHELL=bash
24
 
PYTHON?=python3
25
 
PYTHON2?=python2
26
 
PYTHON3?=python3
27
 
PYTHON27=python27
28
 
BRZ_TARGET=release
29
 
PLUGIN_TARGET=plugin-release
30
 
PYTHON_BUILDFLAGS=
31
 
BRZ_PLUGIN_PATH=-site:-user
32
 
 
33
 
# Shorter replacement for $(sort $(wildcard <arg>)) as $(call sw,<arg>)
34
 
sw = $(sort $(wildcard $(1)))
35
 
 
36
 
 
37
 
.PHONY: all clean realclean extensions flake8 api-docs check-nodocs check
38
 
 
39
 
all: extensions
40
 
 
41
 
extensions:
42
 
        @echo "building extension modules."
43
 
        $(PYTHON) setup.py build_ext -i $(PYTHON_BUILDFLAGS)
44
 
 
45
 
check: docs check-nodocs
46
 
 
47
 
check-nodocs: check-nodocs2 check-nodocs3
48
 
 
49
 
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
63
 
 
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
78
 
 
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
83
 
        set -o pipefail; \
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."
90
 
 
91
 
# Run Python style checker (apt-get install flake8)
92
 
#
93
 
# Note that at present this gives many false warnings, because it doesn't
94
 
# know about identifiers loaded through lazy_import.
95
 
flake8:
96
 
        flake8
97
 
 
98
 
clean:
99
 
        $(PYTHON) setup.py clean
100
 
        -find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
101
 
 
102
 
realclean: clean
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
106
 
 
107
 
# build tags for emacs and vim
108
 
TAGS:
109
 
        ctags -R -e breezy
110
 
 
111
 
tags:
112
 
        ctags -R breezy
113
 
 
114
 
# these are treated as phony so they'll always be rebuilt - it's pretty quick
115
 
.PHONY: TAGS tags
116
 
 
117
 
 
118
 
### Documentation ###
119
 
 
120
 
docs: docs-sphinx
121
 
 
122
 
clean-docs: clean-sphinx
123
 
 
124
 
html-docs: html-sphinx
125
 
 
126
 
 
127
 
### Man-page Documentation ###
128
 
 
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)) 
134
 
 
135
 
MAN_PAGES = man1/brz.1
136
 
man1/brz.1: $(MAN_DEPENDENCIES)
137
 
        mkdir -p $(dir $@)
138
 
        $(PYTHON) tools/generate_docs.py -o $@ man
139
 
 
140
 
 
141
 
### Sphinx-style Documentation ###
142
 
 
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
149
 
 
150
 
# Clean out generated documentation
151
 
clean-sphinx:
152
 
        $(MAKE) -C doc/en clean
153
 
        $(MAKE) -C doc/developers clean
154
 
 
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
160
 
 
161
 
NEWS_FILES = $(call sw,doc/en/release-notes/brz-*.txt)
162
 
 
163
 
doc/en/user-reference/index.txt: $(MAN_DEPENDENCIES)
164
 
        LANGUAGE=C $(PYTHON) tools/generate_docs.py -o $@ rstx
165
 
 
166
 
doc/en/release-notes/index.txt: $(NEWS_FILES) tools/generate_release_notes.py
167
 
        $(PYTHON) tools/generate_release_notes.py $@ $(NEWS_FILES)
168
 
 
169
 
doc/%/Makefile: doc/en/Makefile
170
 
        $(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
171
 
 
172
 
doc/%/make.bat: doc/en/make.bat
173
 
        $(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
174
 
 
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
179
 
 
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
190
 
 
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
197
 
 
198
 
 
199
 
# Build the texinfo files using Sphinx.
200
 
texinfo-sphinx: $(SPHINX_DEPENDENCIES)
201
 
        $(MAKE) -C doc/en texinfo
202
 
        $(MAKE) -C doc/developers texinfo
203
 
 
204
 
### Documentation Website ###
205
 
 
206
 
# Where to build the website
207
 
DOC_WEBSITE_BUILD = build_doc_website
208
 
 
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)
213
 
 
214
 
 
215
 
### Miscellaneous Documentation Targets ###
216
 
 
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
220
 
        @echo Generating $@
221
 
        @dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
222
 
 
223
 
 
224
 
### Windows Support ###
225
 
 
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
229
 
# the build process.
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
234
 
 
235
 
installer-all:
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)
249
 
 
250
 
 
251
 
clean-installer-all:
252
 
        $(PYTHON) tools/win32/ostools.py remove build-win32
253
 
 
254
 
# make brz.exe for win32 with py2exe
255
 
exe:
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
262
 
 
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
268
 
 
269
 
py-inst-27: docs
270
 
        $(PYTHON27) setup.py bdist_wininst --install-script="brz-win32-bdist-postinstall.py" -d .
271
 
 
272
 
python-installer: py-inst-27
273
 
 
274
 
 
275
 
copy-docs: docs
276
 
        $(PYTHON) tools/win32/ostools.py copytodir README win32_brz.exe/doc
277
 
        $(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_brz.exe
278
 
 
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
288
 
 
289
 
 
290
 
# i18n targets
291
 
 
292
 
.PHONY: update-pot po/brz.pot
293
 
update-pot: po/brz.pot
294
 
 
295
 
TRANSLATABLE_PYFILES:=$(shell find breezy -name '*.py' \
296
 
                | grep -v 'breezy/tests/' \
297
 
                | grep -v 'breezy/doc' \
298
 
                )
299
 
 
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
308
 
 
309
 
 
310
 
### Packaging Targets ###
311
 
 
312
 
.PHONY: dist check-dist-tarball
313
 
 
314
 
# build a distribution source tarball
315
 
dist: 
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 && \
321
 
        $(MAKE) clean && \
322
 
        $(MAKE) && \
323
 
        $(PYTHON) setup.py sdist -d $$PWD/.. && \
324
 
        gpg --detach-sign --armor $$tarball && \
325
 
        rm -rf $$expbasedir
326
 
 
327
 
# run all tests in a previously built tarball
328
 
check-dist-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 && \
334
 
        rm -rf $$tmpdir
 
1
all: 
 
2
 
 
3
check:
 
4
        ./bzr selftest $(tests)
 
5
        @echo "Running all tests with no locale."
 
6
        LC_CTYPE= LANG=C LC_ALL= ./bzr selftest $(tests)
 
7
 
 
8
check-msgeditor:
 
9
        ./bzr --no-plugins selftest -v msgeditor
 
10
 
 
11
clean: 
 
12
        ./setup.py clean
 
13
        -find . -name "*.pyc" -o -name "*.pyo" | xargs rm -f
 
14
        rm -rf test????.tmp
 
15
 
 
16
.PHONY: all
 
17
 
 
18
 
 
19
# build emacs cross-reference
 
20
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
 
21
TAGS: $(tag_files)
 
22
        ctags-exuberant -e $(tag_files)
 
23
 
 
24
tutorial.html: tutorial.txt
 
25
        rest2html tutorial.txt > tutorial.html