~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-04-07 07:52:50 UTC
  • mfrom: (3340.1.1 208418-1.4)
  • Revision ID: pqm@pqm.ubuntu.com-20080407075250-phs53xnslo8boaeo
Return the correct knit serialisation method in _StreamAccess.
        (Andrew Bennetts, Martin Pool, Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# A relatively simple Makefile to assist in building parts of bzr. Mostly for
18
18
# building documentation, etc.
19
19
 
 
20
 
 
21
### Core Stuff ###
 
22
 
 
23
PYTHON=python
 
24
 
20
25
.PHONY: all clean extensions pyflakes api-docs
21
26
 
22
27
all: extensions
23
28
 
24
29
extensions:
25
30
        @echo "building extension modules."
26
 
        python setup.py build_ext -i
 
31
        $(PYTHON) setup.py build_ext -i
27
32
 
28
 
check: extensions
29
 
        python -Werror ./bzr selftest -v $(tests)
 
33
check: docs extensions
 
34
        $(PYTHON) -Werror -O ./bzr selftest -1v $(tests)
30
35
        @echo "Running all tests with no locale."
31
 
        LC_CTYPE= LANG=C LC_ALL= ./bzr selftest -v $(tests)
32
 
        python -O -Werror ./bzr selftest -v $(tests)
33
 
 
34
 
check-msgeditor:
35
 
        ./bzr --no-plugins selftest -v msgeditor
 
36
        LC_CTYPE= LANG=C LC_ALL= ./bzr selftest -1v $(tests) 2>&1 | sed -e 's/^/[ascii] /'
36
37
 
37
38
# Run Python style checker (apt-get install pyflakes)
 
39
#
 
40
# Note that at present this gives many false warnings, because it doesn't
 
41
# know about identifiers loaded through lazy_import.
38
42
pyflakes:
39
43
        pyflakes bzrlib
40
44
 
44
48
        pyflakes bzrlib | grep -v ' imported but unused'
45
49
 
46
50
clean:
47
 
        python setup.py clean
48
 
        -find . -name "*.pyc" -o -name "*.pyo" | xargs rm -f
49
 
        rm -rf test????.tmp
 
51
        $(PYTHON) setup.py clean
 
52
        -find . -name "*.pyc" -o -name "*.pyo" -o -name "*.so" | xargs rm -f
50
53
 
 
54
# Build API documentation
51
55
docfiles = bzr bzrlib
52
56
api-docs:
53
57
        mkdir -p api/html
54
 
        PYTHONPATH=$(PWD) python tools/bzr_epydoc --html -o api/html --docformat 'restructuredtext en' $(docfiles)
55
 
 
 
58
        PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --html -o api/html --docformat 'restructuredtext en' $(docfiles)
56
59
check-api-docs:
57
 
        PYTHONPATH=$(PWD) python tools/bzr_epydoc --check --docformat 'restructuredtext en' $(docfiles)
58
 
 
59
 
 
60
 
# build emacs cross-reference
61
 
tag_files=./bzr ./bzrlib/*py ./bzrlib/selftest/*.py
62
 
TAGS: $(tag_files)
63
 
        ctags-exuberant -e $(tag_files)
64
 
 
65
 
 
66
 
# Produce HTML docs to upload on Canonical server
67
 
HTMLDIR := html_docs
68
 
PRETTYDIR := pretty_docs
69
 
 
70
 
html-docs: docs
71
 
        python tools/win32/ostools.py copytodir $(htm_files) doc/default.css $(HTMLDIR)
72
 
 
 
60
        PYTHONPATH=$(PWD) $(PYTHON) tools/bzr_epydoc --check --docformat 'restructuredtext en' $(docfiles)
 
61
 
 
62
# build tags for emacs and vim
 
63
TAGS:
 
64
        ctags -R -e bzrlib
 
65
 
 
66
tags:
 
67
        ctags -R bzrlib
 
68
 
 
69
# these are treated as phony so they'll always be rebuilt - it's pretty quick
 
70
.PHONY: TAGS tags
 
71
 
 
72
### Documentation ###
 
73
 
 
74
# set PRETTY to get docs that look like the Bazaar web site
 
75
ifdef PRETTY
 
76
rst2html := $(PYTHON) tools/rst2prettyhtml.py doc/bazaar-vcs.org.kid 
 
77
else
 
78
rst2html := $(PYTHON) tools/rst2html.py --link-stylesheet --footnote-references=superscript --halt=warning
 
79
endif
73
80
 
74
81
# translate txt docs to html
75
 
doc_dir := doc 
76
 
txt_files := $(wildcard $(addsuffix /*.txt, $(doc_dir))) doc/bzr_man.txt
77
 
htm_files := $(patsubst %.txt, %.htm, $(txt_files)) 
78
 
 
79
 
pretty-html-docs: pretty_files
80
 
 
81
 
pretty_docs:
82
 
        python -c "import os; os.mkdir('$(PRETTYDIR)')"
83
 
 
84
 
pretty_files: $(patsubst doc/%.txt, $(PRETTYDIR)/%.htm, $(txt_files))
85
 
 
86
 
doc/HACKING.htm: HACKING
87
 
        python tools/rst2html.py --link-stylesheet --stylesheet=default.css HACKING doc/HACKING.htm
88
 
 
89
 
doc/%.htm: doc/%.txt 
90
 
        python tools/rst2html.py --link-stylesheet --stylesheet=default.css doc/$*.txt doc/$*.htm
91
 
 
92
 
$(PRETTYDIR)/%.htm: pretty_docs doc/%.txt
93
 
        python tools/rst2prettyhtml.py doc/bazaar-vcs.org.kid doc/$*.txt \
94
 
        $(PRETTYDIR)/$*.htm
 
82
derived_txt_files := \
 
83
        doc/en/user-reference/bzr_man.txt \
 
84
        doc/en/developer-guide/HACKING.txt \
 
85
        doc/en/release-notes/NEWS.txt
 
86
doc_dir := doc/en/tutorials
 
87
txt_files := $(wildcard $(addsuffix /*.txt, $(doc_dir))) $(derived_txt_files) \
 
88
        doc/en/user-guide/index.txt \
 
89
        doc/en/mini-tutorial/index.txt \
 
90
        doc/index.txt
 
91
non_txt_files := \
 
92
       doc/default.css \
 
93
       doc/en/quick-reference/quick-start-summary.svg \
 
94
       doc/en/quick-reference/quick-start-summary.png \
 
95
       doc/en/quick-reference/quick-start-summary.pdf \
 
96
       $(wildcard doc/en/user-guide/images/*.png)
 
97
htm_files := $(patsubst %.txt, %.html, $(txt_files)) 
 
98
dev_txt_files := $(wildcard $(addsuffix /*.txt, doc/developers))
 
99
dev_htm_files := $(patsubst %.txt, %.html, $(dev_txt_files)) 
 
100
 
 
101
doc/en/user-guide/index.html: $(wildcard $(addsuffix /*.txt, doc/en/user-guide)) 
 
102
        $(rst2html) --stylesheet=../../default.css doc/en/user-guide/index.txt $@
 
103
 
 
104
doc/developers/%.html: doc/developers/%.txt
 
105
        $(rst2html) --stylesheet=../default.css $< $@
 
106
 
 
107
doc/index.html: doc/index.txt
 
108
        $(rst2html) --stylesheet=default.css $< $@
 
109
 
 
110
%.html: %.txt
 
111
        $(rst2html) --stylesheet=../../default.css $< $@
95
112
 
96
113
MAN_DEPENDENCIES = bzrlib/builtins.py \
97
114
                 bzrlib/bundle/commands.py \
98
115
                 bzrlib/conflicts.py \
 
116
                 bzrlib/help_topics/__init__.py \
99
117
                 bzrlib/sign_my_commits.py \
 
118
                 bzrlib/bugtracker.py \
100
119
                 generate_docs.py \
101
120
                 tools/doc_generate/__init__.py \
102
 
                 tools/doc_generate/autodoc_rstx.py
103
 
 
104
 
doc/bzr_man.txt: $(MAN_DEPENDENCIES)
105
 
        python generate_docs.py -o $@ rstx
 
121
                 tools/doc_generate/autodoc_man.py \
 
122
                 tools/doc_generate/autodoc_rstx.py \
 
123
                 $(wildcard $(addsuffix /*.txt, bzrlib/help_topics/en)) 
 
124
 
 
125
doc/en/user-reference/bzr_man.txt: $(MAN_DEPENDENCIES)
 
126
        $(PYTHON) generate_docs.py -o $@ rstx
 
127
 
 
128
doc/en/developer-guide/HACKING.txt: doc/developers/HACKING.txt
 
129
        $(PYTHON) tools/win32/ostools.py copytodir doc/developers/HACKING.txt doc/en/developer-guide
 
130
 
 
131
doc/en/release-notes/NEWS.txt: NEWS
 
132
        $(PYTHON) -c "import shutil; shutil.copyfile('$<', '$@')"
106
133
 
107
134
MAN_PAGES = man1/bzr.1
108
135
man1/bzr.1: $(MAN_DEPENDENCIES)
109
 
        python generate_docs.py -o $@ man
110
 
 
111
 
docs: $(htm_files) $(MAN_PAGES) doc/HACKING.htm
112
 
 
113
 
copy-docs: docs
114
 
        python tools/win32/ostools.py copytodir $(htm_files) \
115
 
                doc/default.css doc/HACKING.htm NEWS README \
116
 
                win32_bzr.exe/doc
 
136
        $(PYTHON) generate_docs.py -o $@ man
 
137
 
 
138
# build a png of our performance task list
 
139
doc/developers/performance.png: doc/developers/performance.dot
 
140
        @echo Generating $@
 
141
        @dot -Tpng $< -o$@ || echo "Dot not installed; skipping generation of $@"
 
142
 
 
143
derived_web_docs = $(htm_files) $(dev_htm_files) doc/developers/performance.png
 
144
WEB_DOCS = $(derived_web_docs) $(non_txt_files)
 
145
ALL_DOCS = $(derived_web_docs) $(MAN_PAGES)
 
146
 
 
147
# the main target to build all the docs
 
148
docs: $(ALL_DOCS)
 
149
 
 
150
# produce a tree containing just the final docs, ready for uploading to the web
 
151
HTMLDIR := html_docs
 
152
html-docs: docs
 
153
        $(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) $(HTMLDIR)
117
154
 
118
155
# clean produced docs
119
156
clean-docs:
120
 
        python tools/win32/ostools.py remove $(htm_files) \
121
 
        $(HTMLDIR) $(PRETTYDIR) doc/bzr_man.txt $(MAN_PAGES)
122
 
 
 
157
        $(PYTHON) tools/win32/ostools.py remove $(ALL_DOCS) \
 
158
        $(HTMLDIR) $(derived_txt_files)
 
159
 
 
160
 
 
161
### Windows Support ###
123
162
 
124
163
# make bzr.exe for win32 with py2exe
125
164
exe:
126
165
        @echo *** Make bzr.exe
127
 
        python setup.py py2exe > py2exe.log
128
 
        python tools/win32/ostools.py copytodir tools/win32/start_bzr.bat win32_bzr.exe
129
 
        python tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_bzr.exe
 
166
        $(PYTHON) setup.py build_ext -i -f
 
167
        $(PYTHON) setup.py py2exe > py2exe.log
 
168
        $(PYTHON) tools/win32/ostools.py copytodir tools/win32/start_bzr.bat win32_bzr.exe
 
169
        $(PYTHON) tools/win32/ostools.py copytodir tools/win32/bazaar.url win32_bzr.exe
130
170
 
131
171
# win32 installer for bzr.exe
132
172
installer: exe copy-docs
134
174
        cog.py -d -o tools/win32/bzr.iss tools/win32/bzr.iss.cog
135
175
        iscc /Q tools/win32/bzr.iss
136
176
 
137
 
# win32 python's distutils-based installer
138
 
# require to have python interpreter installed on win32
139
 
python-installer: docs
140
 
        python setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
141
 
 
 
177
# win32 Python's distutils-based installer
 
178
# require to have Python interpreter installed on win32
 
179
py-inst-24: docs
 
180
        python24 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
 
181
 
 
182
py-inst-25: docs
 
183
        python25 setup.py bdist_wininst --install-script="bzr-win32-bdist-postinstall.py" -d .
 
184
 
 
185
python-installer: py-inst-24 py-inst-25
 
186
 
 
187
 
 
188
copy-docs: docs
 
189
        $(PYTHON) tools/win32/ostools.py copytodir README win32_bzr.exe/doc
 
190
        $(PYTHON) tools/win32/ostools.py copytree $(WEB_DOCS) win32_bzr.exe
142
191
 
143
192
# clean on win32 all installer-related files and directories
144
 
clean-win32:
145
 
        python tools/win32/ostools.py remove build
146
 
        python tools/win32/ostools.py remove win32_bzr.exe
147
 
        python tools/win32/ostools.py remove py2exe.log
148
 
        python tools/win32/ostools.py remove doc/*.htm
149
 
        python tools/win32/ostools.py remove doc/bzr_man.txt
150
 
        python tools/win32/ostools.py remove tools/win32/bzr.iss
151
 
        python tools/win32/ostools.py remove bzr-setup*.exe
152
 
        python tools/win32/ostools.py remove bzr-*win32.exe
153
 
        python tools/win32/ostools.py remove dist
 
193
clean-win32: clean-docs
 
194
        $(PYTHON) tools/win32/ostools.py remove build
 
195
        $(PYTHON) tools/win32/ostools.py remove win32_bzr.exe
 
196
        $(PYTHON) tools/win32/ostools.py remove py2exe.log
 
197
        $(PYTHON) tools/win32/ostools.py remove tools/win32/bzr.iss
 
198
        $(PYTHON) tools/win32/ostools.py remove bzr-setup*.exe
 
199
        $(PYTHON) tools/win32/ostools.py remove bzr-*win32.exe
 
200
        $(PYTHON) tools/win32/ostools.py remove dist