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
81 # N.B.: the first argument to make-version.py is used to find darcs tags that
82 # represent released versions, so it needs to match whatever release
83 # conventions are in use.
85 $(PYTHON) misc/make-version.py "allmydata-tahoe" "src/allmydata/_version.py"
92 $(PYTHON) ./setup.py build_ext -i
95 # 'make install' will do the following:
96 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
97 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
98 # a different location
103 $(PP) $(PYTHON) ./setup.py install \
104 --single-version-externally-managed \
105 --prefix=$(PREFIX) --record=./tahoe.files
107 $(PP) $(PYTHON) ./setup.py install \
108 --single-version-externally-managed
114 .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
118 @echo "ERROR: Not all of Tahoe's dependencies are in place. Please\
119 see the README for help on installing dependencies."
122 signal-error-twisted-dep:
123 @echo "ERROR: Before running \"make build-deps\" you have to ensure that\
124 Twisted is installed (including its zope.interface dependency). Twisted and\
125 zope.interface are required for the automatic installation of certain other\
126 libraries that Tahoe requires). Please see the README for details."
129 signal-error-pywin32-dep:
130 @echo "ERROR: the pywin32 dependency is not in place. Please see the README\
131 for help on installing dependencies."
134 check-deps: check-twisted-dep $(CHECK_PYWIN32_DEP)
136 $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, OpenSSL' || $(MAKE) signal-error-deps
139 $(PYTHON) -c 'import twisted, zope.interface' || $(MAKE) signal-error-twisted-dep
142 $(PYTHON) -c 'import win32process' || $(MAKE) signal-error-pywin32-dep
148 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
149 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
153 # use 'make test REPORTER=--reporter=bwverbose' from buildbot, to
154 # suppress the ansi color sequences
156 test: .built .checked-deps
158 $(TRIAL) $(REPORTER) $(TEST)
160 test-figleaf: .built .checked-deps
163 $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
167 $(PYTHON) misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes
168 @echo "now point your browser at coverage-html/index.html"
170 # after doing test-figleaf and figleaf-output, point your browser at
171 # coverage-html/index.html
173 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines
174 .PHONY: check-memory check-memory-once clean
176 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
180 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
183 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
187 rsync -a coverage-html/ $(UPLOAD_TARGET)
188 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
191 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
195 .figleaf.el: .figleaf
197 $(PYTHON) misc/figleaf2el.py .figleaf src
200 $(PYTHON) -OOu `which pyflakes` src/allmydata
204 @find src -name '*.py' |grep -v /build/ |wc --lines
206 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
208 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
213 $(PYTHON) src/allmydata/test/check_memory.py upload
215 $(PYTHON) src/allmydata/test/check_memory.py upload-self
217 $(PYTHON) src/allmydata/test/check_memory.py upload-POST
219 $(PYTHON) src/allmydata/test/check_memory.py download
221 $(PYTHON) src/allmydata/test/check_memory.py download-GET
223 $(PYTHON) src/allmydata/test/check_memory.py download-GET-slow
225 $(PYTHON) src/allmydata/test/check_memory.py receive
227 check-memory-once: .built
230 $(PYTHON) src/allmydata/test/check_memory.py $(MODE)
232 # this target uses a pre-established client node to run a canned set of
233 # performance tests against a test network that is also pre-established
234 # (probably on a remote machine). Provide it with the path to a local
235 # directory where this client node has been created (and populated with the
236 # necessary FURLs of the test network). This target will start that client
237 # with the current code and then run the tests. Afterwards it will stop the
240 # The 'sleep 5' is in there to give the new client a chance to connect to its
241 # storageservers, since check_speed.py has no good way of doing that itself.
244 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
245 $(PYTHON) bin/tahoe start $(TESTCLIENTDIR)
247 $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
248 $(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
250 test-darcs-boringfile:
252 $(PYTHON) misc/test-darcs-boringfile.py
255 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.old
258 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.new
259 diff allfiles.tmp.old allfiles.tmp.new
262 rm -rf build _trial_temp _test_memory .checked-deps .built
264 rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
265 rm -rf tahoe_deps.egg-info allmydata_tahoe.egg-info
267 rm -rf setuptools*.egg *.pyc
273 VER=$(shell $(PYTHON) misc/get-version.py)
274 DEBCOMMENTS="'make deb' build"
279 .PHONY: setup-deb deb-ARCH is-known-debian-arch
280 .PHONY: deb-sid deb-feisty deb-edgy deb-etch
283 $(MAKE) deb-ARCH ARCH=sid
285 $(MAKE) deb-ARCH ARCH=feisty
286 # edgy uses the feisty control files for now
288 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty
289 # etch uses the feisty control files for now
291 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=feisty
293 # we know how to handle the following debian architectures
294 KNOWN_DEBIAN_ARCHES := sid feisty edgy etch
296 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
297 is-known-debian-arch:
298 @echo "ARCH must be set when using setup-deb or deb-ARCH"
299 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
302 is-known-debian-arch:
310 setup-deb: is-known-debian-arch
312 ln -s misc/$(TAHOE_ARCH)/debian debian
313 chmod +x debian/rules
315 # etch (current debian stable) has python-simplejson-1.3, which doesn't
317 # sid (debian unstable) currently has python-simplejson 1.7.1
318 # edgy has 1.3, which doesn't support indent=
319 # feisty has 1.4, which supports indent= but emits a deprecation warning
322 # we need 1.4 or newer
324 deb-ARCH: is-known-debian-arch setup-deb
325 fakeroot debian/rules binary
327 echo "The newly built .deb packages are in the parent directory from here."
329 .PHONY: increment-deb-version
330 .PHONY: deb-sid-head deb-edgy-head deb-feisty-head
331 .PHONY: deb-etch-head
333 # The buildbot runs the following targets after each change, to produce
334 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
336 increment-deb-version: make-version
337 debchange --newversion $(VER) $(DEBCOMMENTS)
339 $(MAKE) setup-deb ARCH=sid
340 $(MAKE) increment-deb-version
341 fakeroot debian/rules binary
343 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=feisty
344 $(MAKE) increment-deb-version
345 fakeroot debian/rules binary
347 $(MAKE) setup-deb ARCH=feisty
348 $(MAKE) increment-deb-version
349 fakeroot debian/rules binary
351 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=feisty
352 $(MAKE) increment-deb-version
353 fakeroot debian/rules binary