2 # this Makefile requires GNU make
4 # If you get an error message like the following:
6 # error: Setup script exited with error: Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed.
8 # Then that probably means that you aren't using the the right
9 # compiler. In that case, try creating distutils configuration file
10 # (as described in http://docs.python.org/inst/config-syntax.html ),
11 # specifying which compiler to use. For example, if you use either
12 # the cygwin gcc compiler with mingw support, or the MINGW compiler,
13 # then you can add the following lines to your .cfg file:
20 PATHSEP=$(shell python -c 'import os ; print os.pathsep')
21 TRIALPATH=$(shell which trial.py 2>/dev/null)
23 TRIALPATH=$(shell which trial 2>/dev/null)
26 TRIALPATH=$(shell $(PYTHON) -c "import os, sys; print repr(os.path.join(sys.prefix, \"Scripts\", \"trial.py\"))")
29 TRIALPATH=$(shell $(PYTHON) -c "import os, sys; print repr(os.path.join(sys.prefix, \"Scripts\", \"trial\"))")
34 PLAT = $(strip $(shell python -c "import sys ; print sys.platform"))
36 # The platform is Windows with cygwin build tools and the native Python interpreter.
37 TRIALPATH := $(shell cygpath -w $(TRIALPATH))
38 SUPPORT = $(shell cygpath -w $(shell pwd))\support
39 SUPPORTLIB := $(SUPPORT)\Lib\site-packages
40 SRCPATH := $(shell cygpath -w $(shell pwd))\src
42 PYVER=$(shell $(PYTHON) misc/pyver.py)
43 SUPPORT = $(shell pwd)/support
44 SUPPORTLIB = $(SUPPORT)/lib/$(PYVER)/site-packages
45 SRCPATH := $(shell pwd)/src
53 REACTOROPT := --reactor=$(REACTOR)
58 TRIAL=$(PYTHON) -u "$(TRIALPATH)" --rterrors $(REACTOROPT)
61 mkdir -p "$(SUPPORTLIB)"
62 PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)." \
63 $(PYTHON) misc/dependencies/build-deps-setup.py install \
66 EGGSPATH = $(shell $(PYTHON) misc/find-dep-eggs.py)
70 PP=PYTHONPATH="$(SRCPATH)$(PATHSEP)$(EGGSPATH)$(PATHSEP)$(PYTHONPATH)"
72 .PHONY: make-version build
74 $(PYTHON) misc/make-version.py "allmydata-tahoe" "src/allmydata/_version.py"
77 $(PYTHON) ./setup.py build_ext -i
78 chmod +x bin/allmydata-tahoe
80 # 'make install' will do the following:
81 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
82 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
83 # a different location
88 $(PP) $(PYTHON) ./setup.py install \
89 --single-version-externally-managed \
90 --prefix=$(PREFIX) --record=./tahoe.files
92 $(PP) $(PYTHON) ./setup.py install \
93 --single-version-externally-managed
99 .PHONY: check-deps test test-figleaf figleaf-output
104 $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, OpenSSL'
110 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
111 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
115 # use 'make test REPORTER=--reporter=bwverbose' from buildbot, to
116 # suppress the ansi color sequences
118 test: build .checked-deps
120 $(TRIAL) $(REPORTER) $(TEST)
122 test-figleaf: build .checked-deps
125 $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
129 $(PYTHON) misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes
130 @echo "now point your browser at coverage-html/index.html"
132 # after doing test-figleaf and figleaf-output, point your browser at
133 # coverage-html/index.html
135 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines check-memory
138 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
142 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
145 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
149 rsync -a coverage-html/ $(UPLOAD_TARGET)
150 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
153 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
157 .figleaf.el: .figleaf
159 $(PYTHON) misc/figleaf2el.py .figleaf src
162 $(PYTHON) -OOu `which pyflakes` src/allmydata
166 @find src -name '*.py' |grep -v /build/ |wc --lines
168 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
170 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
175 $(PYTHON) src/allmydata/test/check_memory.py upload
177 $(PYTHON) src/allmydata/test/check_memory.py upload-self
179 $(PYTHON) src/allmydata/test/check_memory.py upload-POST
181 $(PYTHON) src/allmydata/test/check_memory.py download
183 $(PYTHON) src/allmydata/test/check_memory.py download-GET
186 test-darcs-boringfile:
188 $(PYTHON) misc/test-darcs-boringfile.py
191 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.old
194 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.new
195 diff allfiles.tmp.old allfiles.tmp.new
198 rm -rf build _trial_temp _test_memory .checked-deps
200 rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
201 rm -rf tahoe_deps.egg-info allmydata_tahoe.egg-info
203 rm -rf setuptools*.egg *.pyc
209 VER=$(shell $(PYTHON) misc/get-version.py)
210 DEBCOMMENTS="'make deb' build"
215 .PHONY: setup-deb deb-ARCH is-known-debian-arch
216 .PHONY: deb-sid deb-feisty deb-edgy deb-etch
219 $(MAKE) deb-ARCH ARCH=sid
221 $(MAKE) deb-ARCH ARCH=feisty
222 # edgy uses the feisty control files for now
224 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty
225 # etch uses the feisty control files for now
227 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=feisty
229 # we know how to handle the following debian architectures
230 KNOWN_DEBIAN_ARCHES := sid feisty edgy etch
232 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
233 is-known-debian-arch:
234 @echo "ARCH must be set when using setup-deb or deb-ARCH"
235 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
238 is-known-debian-arch:
246 setup-deb: is-known-debian-arch
248 ln -s misc/$(TAHOE_ARCH)/debian debian
249 chmod +x debian/rules
251 # etch (current debian stable) has python-simplejson-1.3, which doesn't
253 # sid (debian unstable) currently has python-simplejson 1.7.1
254 # edgy has 1.3, which doesn't support indent=
255 # feisty has 1.4, which supports indent= but emits a deprecation warning
258 # we need 1.4 or newer
260 deb-ARCH: is-known-debian-arch setup-deb
261 fakeroot debian/rules binary
263 echo "The newly built .deb packages are in the parent directory from here."
265 .PHONY: increment-deb-version
266 .PHONY: deb-sid-head deb-edgy-head deb-feisty-head
267 .PHONY: deb-etch-head
269 # The buildbot runs the following targets after each change, to produce
270 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
272 increment-deb-version: make-version
273 debchange --newversion $(VER) $(DEBCOMMENTS)
275 $(MAKE) setup-deb ARCH=sid
276 $(MAKE) increment-deb-version
277 fakeroot debian/rules binary
279 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=feisty
280 $(MAKE) increment-deb-version
281 fakeroot debian/rules binary
283 $(MAKE) setup-deb ARCH=feisty
284 $(MAKE) increment-deb-version
285 fakeroot debian/rules binary
287 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=feisty
288 $(MAKE) increment-deb-version
289 fakeroot debian/rules binary