~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Rory Yorke
  • Date: 2010-10-20 14:38:53 UTC
  • mto: This revision was merged to the branch mainline in revision 5519.
  • Revision ID: rory.yorke@gmail.com-20101020143853-9kfd2ldcjfroh8jw
Show missing files in bzr status (bug 134168).

"bzr status" will now show missing files, that is, those added with "bzr
add" and then removed by non bzr means (e.g., rm).

Blackbox tests were added for this case, and tests were also added to
test_delta, since the implementation change is in bzrlib.delta.

Might also affect bug 189709.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
all:
2
 
        chmod u+x ./bzr
3
 
 
4
 
check:
5
 
        ./bzr selftest
6
 
 
7
 
.PHONY: all
8
 
 
9
 
 
10
 
# build emacs cross-reference
11
 
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
12
 
TAGS: $(tag_files)
13
 
        ctags-exuberant -e $(tag_files)
 
1
# Copyright (C) 2005-2010 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 bzr. Mostly for
 
18
# building documentation, etc.
 
19
 
 
20
 
 
21
### Core Stuff ###
 
22
 
 
23
PYTHON=python
 
24
PYTHON24=python24
 
25
PYTHON25=python25
 
26
PYTHON26=python26
 
27
BZR_TARGET=release
 
28
PLUGIN_TARGET=plugin-release
 
29
PYTHON_BUILDFLAGS=
 
30
 
 
31
.PHONY: all clean extensions pyflakes api-docs check-nodocs check
 
32
 
 
33
all: extensions
 
34
 
 
35
extensions:
 
36
        @echo "building extension modules."
 
37
        $(PYTHON) setup.py build_ext -i $(PYTHON_BUILDFLAGS)
 
38
 
 
39
check: docs check-nodocs
 
40
 
 
41
check-nodocs: extensions
 
42
        set -e
 
43
        # Generate a stream for PQM to watch.
 
44
        -$(RM) -f selftest.log
 
45
        $(PYTHON) -Werror -O ./bzr selftest --subunit $(tests) | tee selftest.log
 
46
        # An empty log file should catch errors in the $(PYTHON)
 
47
        # command above (the '|' swallow any errors since 'make'
 
48
        # sees the 'tee' exit code for the whole line
 
49
        if [ ! -s selftest.log ] ; then exit 1 ; fi
 
50
        # Check that there were no errors reported.
 
51
        subunit-stats < selftest.log
 
52
 
 
53
# Run Python style checker (apt-get install pyflakes)
 
54
#
 
55
# Note that at present this gives many false warnings, because it doesn't
 
56
# know about identifiers loaded through lazy_import.
 
57
pyflakes:
 
58
        pyflakes bzrlib
 
59
 
 
60
pyflakes-nounused:
 
61
        # There are many of these warnings at the moment and they're not a
 
62
        # high priority to fix
 
63
        pyflakes bzrlib | grep -v ' imported but unused'
 
64
 
 
65
clean:
 
66
        $(PYTHON) setup.py clean
 
67
        -find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
 
68
 
 
69
# Build API documentation
 
70
docfiles = bzr bzrlib
 
71
api-docs:
 
72
        mkdir -p api/html
 
73
        PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --html -o api/html --docformat 'restructuredtext en' $(docfiles)
 
74
check-api-docs:
 
75
        PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --check --docformat 'restructuredtext en' $(docfiles)
 
76
 
 
77
# build tags for emacs and vim
 
78
TAGS:
 
79
        ctags -R -e bzrlib
 
80
 
 
81
tags:
 
82
        ctags -R bzrlib
 
83
 
 
84
# these are treated as phony so they'll always be rebuilt - it's pretty quick
 
85
.PHONY: TAGS tags
 
86
 
 
87
 
 
88
### Documentation ###
 
89
 
 
90
# Default to plain documentation for maximum backwards compatibility.
 
91
# (Post 2.0, the defaults will most likely be Sphinx-style instead.)
 
92
 
 
93
docs: docs-plain
 
94
 
 
95
clean-docs: clean-plain
 
96
 
 
97
html-docs: html-plain
 
98
 
 
99
 
 
100
### Man-page Documentation ###
 
101
 
 
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)) 
 
107
 
 
108
MAN_PAGES = man1/bzr.1
 
109
man1/bzr.1: $(MAN_DEPENDENCIES)
 
110
        $(PYTHON) tools/generate_docs.py -o $@ man
 
111
 
 
112
 
 
113
### Sphinx-style Documentation ###
 
114
 
 
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
 
121
 
 
122
# Clean out generated documentation
 
123
clean-sphinx:
 
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
 
129
 
 
130
SPHINX_DEPENDENCIES = \
 
131
        doc/en/release-notes/index.txt \
 
132
        doc/en/user-reference/index.txt \
 
133
        doc/es/Makefile \
 
134
        doc/es/make.bat \
 
135
        doc/ja/Makefile \
 
136
        doc/ja/make.bat \
 
137
        doc/ru/Makefile \
 
138
        doc/ru/make.bat \
 
139
        doc/developers/Makefile \
 
140
        doc/developers/make.bat
 
141
 
 
142
NEWS_FILES = $(wildcard doc/en/release-notes/bzr-*.txt)
 
143
 
 
144
doc/en/user-reference/index.txt: $(MAN_DEPENDENCIES)
 
145
        $(PYTHON) tools/generate_docs.py -o $@ rstx
 
146
 
 
147
doc/en/release-notes/index.txt: $(NEWS_FILES) tools/generate_release_notes.py
 
148
        $(PYTHON) tools/generate_release_notes.py $@ $(NEWS_FILES)
 
149
 
 
150
doc/%/Makefile: doc/en/Makefile
 
151
        $(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
 
152
 
 
153
doc/%/make.bat: doc/en/make.bat
 
154
        $(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
 
155
 
 
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
 
163
 
 
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
 
177
 
 
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
 
187
 
 
188
 
 
189
### Documentation Website ###
 
190
 
 
191
# Where to build the website
 
192
DOC_WEBSITE_BUILD = build_doc_website
 
193
 
 
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)
 
201
 
 
202
 
 
203
### Plain Documentation ###
 
204
 
 
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.
 
208
 
 
209
rst2html = $(PYTHON) tools/rst2html.py --link-stylesheet --footnote-references=superscript --halt=warning
 
210
 
 
211
# translate txt docs to html
 
212
derived_txt_files = \
 
213
        doc/en/release-notes/NEWS.txt
 
214
txt_all = \
 
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 \
 
229
        doc/index.txt \
 
230
        $(wildcard doc/index.*.txt)
 
231
txt_nohtml = \
 
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)) 
 
239
 
 
240
non_txt_files = \
 
241
       doc/default.css \
 
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)
 
252
 
 
253
# doc/developers/*.txt files that should *not* be individually
 
254
# converted to HTML
 
255
dev_txt_nohtml = \
 
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
 
280
 
 
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)) 
 
284
 
 
285
doc/en/user-guide/index-plain.html: $(wildcard $(addsuffix /*.txt, doc/en/user-guide)) 
 
286
        $(rst2html) --stylesheet=../../default.css $(dir $@)index-plain.txt $@
 
287
 
 
288
#doc/es/user-guide/index.html: $(wildcard $(addsuffix /*.txt, doc/es/user-guide)) 
 
289
#       $(rst2html) --stylesheet=../../default.css $(dir $@)index.txt $@
 
290
#
 
291
#doc/ru/user-guide/index.html: $(wildcard $(addsuffix /*.txt, doc/ru/user-guide)) 
 
292
#       $(rst2html) --stylesheet=../../default.css $(dir $@)index.txt $@
 
293
#
 
294
doc/en/admin-guide/index-plain.html: $(wildcard $(addsuffix /*.txt, doc/en/admin-guide)) 
 
295
        $(rst2html) --stylesheet=../../default.css $(dir $@)index-plain.txt $@
 
296
 
 
297
doc/developers/%.html: doc/developers/%.txt
 
298
        $(rst2html) --stylesheet=../default.css $< $@
 
299
 
 
300
doc/index.html: doc/index.txt
 
301
        $(rst2html) --stylesheet=default.css $< $@
 
302
 
 
303
doc/index.%.html: doc/index.%.txt
 
304
        $(rst2html) --stylesheet=default.css $< $@
 
305
 
 
306
%.html: %.txt
 
307
        $(rst2html) --stylesheet=../../default.css $< "$@"
 
308
 
 
309
doc/en/release-notes/NEWS.txt: $(NEWS_FILES) tools/generate_release_notes.py
 
310
        $(PYTHON) tools/generate_release_notes.py "$@" $(NEWS_FILES)
 
311
 
 
312
upgrade_guide_dependencies =  $(wildcard $(addsuffix /*.txt, doc/en/upgrade-guide)) 
 
313
 
 
314
doc/en/upgrade-guide/index.html: $(upgrade_guide_dependencies)
 
315
        $(rst2html) --stylesheet=../../default.css $(dir $@)index.txt $@
 
316
 
 
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)
 
320
 
 
321
# the main target to build all the docs
 
322
docs-plain: $(ALL_DOCS)
 
323
 
 
324
# produce a tree containing just the final docs, ready for uploading to the web
 
325
HTMLDIR = html_docs
 
326
html-plain: docs-plain
 
327
        $(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) $(HTMLDIR)
 
328
 
 
329
# clean produced docs
 
330
clean-plain:
 
331
        $(PYTHON) tools/win32/ostools.py remove $(ALL_DOCS) \
 
332
            $(HTMLDIR) $(derived_txt_files)
 
333
 
 
334
 
 
335
### Miscellaneous Documentation Targets ###
 
336
 
 
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
 
340
        @echo Generating $@
 
341
        @dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
 
342
 
 
343
 
 
344
### Windows Support ###
 
345
 
 
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
 
349
# the build process.
 
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
 
354
 
 
355
installer-all:
 
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)
 
369
 
 
370
 
 
371
clean-installer-all:
 
372
        $(PYTHON) tools/win32/ostools.py remove build-win32
 
373
 
 
374
# make bzr.exe for win32 with py2exe
 
375
exe:
 
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
 
382
 
 
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
 
388
 
 
389
# win32 Python's distutils-based installer
 
390
# require to have Python interpreter installed on win32
 
391
py-inst-24: docs
 
392
        $(PYTHON24) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
 
393
 
 
394
py-inst-25: docs
 
395
        $(PYTHON25) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
 
396
 
 
397
py-inst-26: docs
 
398
        $(PYTHON26) setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
 
399
 
 
400
python-installer: py-inst-24 py-inst-25 py-inst-26
 
401
 
 
402
 
 
403
copy-docs: docs
 
404
        $(PYTHON) tools/win32/ostools.py copytodir README win32_bzr.exe/doc
 
405
        $(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_bzr.exe
 
406
 
 
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
 
416
 
 
417
 
 
418
### Packaging Targets ###
 
419
 
 
420
.PHONY: dist check-dist-tarball
 
421
 
 
422
# build a distribution source tarball
 
423
#
 
424
# this method of copying the pyrex generated files is a bit ugly; it would be
 
425
# nicer to generate it from distutils.
 
426
dist: 
 
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 && \
 
432
        $(MAKE) clean && \
 
433
        $(MAKE) && \
 
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 && \
 
438
        rm -rf $$expbasedir
 
439
 
 
440
# run all tests in a previously built tarball
 
441
check-dist-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 && \
 
447
        rm -rf $$tmpdir