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 OSSEP=$(shell python -c 'import os ; print os.sep')
22 TRIALPATH=$(shell which trial.py 2>/dev/null)
24 TRIALPATH=$(shell which trial 2>/dev/null)
27 TRIALPATH=$(shell $(PYTHON) -c "import os, sys; print repr(os.path.join(sys.prefix, \"Scripts\", \"trial.py\"))")
30 TRIALPATH=$(shell $(PYTHON) -c "import os, sys; print repr(os.path.join(sys.prefix, \"Scripts\", \"trial\"))")
35 PLAT = $(strip $(shell python -c "import sys ; print sys.platform"))
37 # The platform is Windows with cygwin build tools and the native Python interpreter.
38 TRIALPATH := $(shell cygpath -w $(TRIALPATH))
39 SUPPORT = $(shell cygpath -w $(shell pwd))\support
40 SUPPORTLIB := $(SUPPORT)\Lib\site-packages
41 SRCPATH := $(shell cygpath -w $(shell pwd))\src
42 CHECK_PYWIN32_DEP := check-pywin32-dep
44 PYVER=$(shell $(PYTHON) misc/pyver.py)
45 SUPPORT = $(shell pwd)/support
46 SUPPORTLIB = $(SUPPORT)/lib/$(PYVER)/site-packages
47 SRCPATH := $(shell pwd)/src
56 REACTOROPT := --reactor=$(REACTOR)
61 TRIAL=$(PYTHON) -u "$(TRIALPATH)" --rterrors $(REACTOROPT)
63 # build-deps wants setuptools to have been built first. It's easiest to
64 # accomplish this by depending upon the tahoe compile.
65 build-deps: .built check-twisted-dep
66 mkdir -p "$(SUPPORTLIB)"
67 PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)" \
68 $(PYTHON) misc/dependencies/build-deps-setup.py install \
71 EGGSPATH = $(shell $(PYTHON) misc/find-dep-eggs.py)
75 ifneq ($(PYTHONPATH),)
76 PYTHONPATH := $(PYTHONPATH)$(PATHSEP)
78 PP=PYTHONPATH="$(SRCPATH)$(PATHSEP)$(EGGSPATH)$(PATHSEP)$(PYTHONPATH)"
80 .PHONY: make-version build
82 $(PYTHON) misc/make-version.py "allmydata-tahoe" "src/allmydata/_version.py"
89 $(PYTHON) ./setup.py build_ext -i
90 chmod +x bin/allmydata-tahoe
92 # 'make install' will do the following:
93 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
94 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
95 # a different location
100 $(PP) $(PYTHON) ./setup.py install \
101 --single-version-externally-managed \
102 --prefix=$(PREFIX) --record=./tahoe.files
104 $(PP) $(PYTHON) ./setup.py install \
105 --single-version-externally-managed
111 .PHONY: check-deps check-twisted-dep $(CHECK_PYWIN32_DEP) signal-error-deps, signal-error-twisted-dep, signal-error-pywin32-dep, test test-figleaf figleaf-output
115 @echo "ERROR: Not all of Tahoe's dependencies are in place. Please\
116 see the README for help on installing dependencies."
119 signal-error-twisted-dep:
120 @echo "ERROR: Before running \"make build-deps\" you have to ensure that\
121 Twisted is installed (including its zope.interface dependency). Twisted and\
122 zope.interface are required for the automatic installation of certain other\
123 libraries that Tahoe requires). Please see the README for details."
126 signal-error-pywin32-dep:
127 @echo "ERROR: the pywin32 dependency is not in place. Please see the README\
128 for help on installing dependencies."
131 check-deps: check-twisted-dep $(CHECK_PYWIN32_DEP)
133 $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, OpenSSL' || $(MAKE) signal-error-deps
136 $(PYTHON) -c 'import twisted, zope.interface' || $(MAKE) signal-error-twisted-dep
139 $(PYTHON) -c 'import win32process' || $(MAKE) signal-error-pywin32-dep
145 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
146 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
150 # use 'make test REPORTER=--reporter=bwverbose' from buildbot, to
151 # suppress the ansi color sequences
153 test: .built .checked-deps
155 $(TRIAL) $(REPORTER) $(TEST)
157 test-figleaf: .built .checked-deps
160 $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
164 $(PYTHON) misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes
165 @echo "now point your browser at coverage-html/index.html"
167 # after doing test-figleaf and figleaf-output, point your browser at
168 # coverage-html/index.html
170 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines
171 .PHONY: check-memory check-memory-once clean
173 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
177 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
180 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
184 rsync -a coverage-html/ $(UPLOAD_TARGET)
185 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
188 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
192 .figleaf.el: .figleaf
194 $(PYTHON) misc/figleaf2el.py .figleaf src
197 $(PYTHON) -OOu `which pyflakes` src/allmydata
201 @find src -name '*.py' |grep -v /build/ |wc --lines
203 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
205 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
210 $(PYTHON) src/allmydata/test/check_memory.py upload
212 $(PYTHON) src/allmydata/test/check_memory.py upload-self
214 $(PYTHON) src/allmydata/test/check_memory.py upload-POST
216 $(PYTHON) src/allmydata/test/check_memory.py download
218 $(PYTHON) src/allmydata/test/check_memory.py download-GET
220 $(PYTHON) src/allmydata/test/check_memory.py download-GET-slow
222 $(PYTHON) src/allmydata/test/check_memory.py receive
224 check-memory-once: .built
227 $(PYTHON) src/allmydata/test/check_memory.py $(MODE)
229 # this target uses a pre-established client node to run a canned set of
230 # performance tests against a test network that is also pre-established
231 # (probably on a remote machine). Provide it with the path to a local
232 # directory where this client node has been created (and populated with the
233 # necessary FURLs of the test network). This target will start that client
234 # with the current code and then run the tests. Afterwards it will stop the
237 # The 'sleep 5' is in there to give the new client a chance to connect to its
238 # storageservers, since check_speed.py has no good way of doing that itself.
241 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
242 $(PYTHON) bin/allmydata-tahoe start $(TESTCLIENTDIR)
244 $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
245 $(PYTHON) bin/allmydata-tahoe stop $(TESTCLIENTDIR)
247 test-darcs-boringfile:
249 $(PYTHON) misc/test-darcs-boringfile.py
252 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.old
255 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.new
256 diff allfiles.tmp.old allfiles.tmp.new
259 rm -rf build _trial_temp _test_memory .checked-deps .built
261 rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
262 rm -rf tahoe_deps.egg-info allmydata_tahoe.egg-info
264 rm -rf setuptools*.egg *.pyc
270 VER=$(shell $(PYTHON) misc/get-version.py)
271 DEBCOMMENTS="'make deb' build"
276 .PHONY: setup-deb deb-ARCH is-known-debian-arch
277 .PHONY: deb-sid deb-feisty deb-edgy deb-etch
280 $(MAKE) deb-ARCH ARCH=sid
282 $(MAKE) deb-ARCH ARCH=feisty
283 # edgy uses the feisty control files for now
285 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty
286 # etch uses the feisty control files for now
288 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=feisty
290 # we know how to handle the following debian architectures
291 KNOWN_DEBIAN_ARCHES := sid feisty edgy etch
293 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
294 is-known-debian-arch:
295 @echo "ARCH must be set when using setup-deb or deb-ARCH"
296 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
299 is-known-debian-arch:
307 setup-deb: is-known-debian-arch
309 ln -s misc/$(TAHOE_ARCH)/debian debian
310 chmod +x debian/rules
312 # etch (current debian stable) has python-simplejson-1.3, which doesn't
314 # sid (debian unstable) currently has python-simplejson 1.7.1
315 # edgy has 1.3, which doesn't support indent=
316 # feisty has 1.4, which supports indent= but emits a deprecation warning
319 # we need 1.4 or newer
321 deb-ARCH: is-known-debian-arch setup-deb
322 fakeroot debian/rules binary
324 echo "The newly built .deb packages are in the parent directory from here."
326 .PHONY: increment-deb-version
327 .PHONY: deb-sid-head deb-edgy-head deb-feisty-head
328 .PHONY: deb-etch-head
330 # The buildbot runs the following targets after each change, to produce
331 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
333 increment-deb-version: make-version
334 debchange --newversion $(VER) $(DEBCOMMENTS)
336 $(MAKE) setup-deb ARCH=sid
337 $(MAKE) increment-deb-version
338 fakeroot debian/rules binary
340 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=feisty
341 $(MAKE) increment-deb-version
342 fakeroot debian/rules binary
344 $(MAKE) setup-deb ARCH=feisty
345 $(MAKE) increment-deb-version
346 fakeroot debian/rules binary
348 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=feisty
349 $(MAKE) increment-deb-version
350 fakeroot debian/rules binary