2 # this Makefile requires GNU make
7 PATHSEP=$(shell python -c 'import os ; print os.pathsep')
8 OSSEP=$(shell python -c 'import os ; print os.sep')
12 ifneq ($(INCLUDE_DIRS),)
13 INCLUDE_DIRS_ARG = -I$(INCLUDE_DIRS)
15 ifneq ($(LIBRARY_DIRS),)
16 LIBRARY_DIRS_ARG = -L$(LIBRARY_DIRS)
19 PLAT = $(strip $(shell python -c "import sys ; print sys.platform"))
21 # The platform is Windows with cygwin build tools and the native Python interpreter.
22 SUPPORT = $(shell cygpath -w $(shell pwd))\support
23 SUPPORTLIB := $(SUPPORT)\Lib\site-packages
24 SRCPATH := $(shell cygpath -w $(shell pwd)/src)
25 CHECK_PYWIN32_DEP := check-pywin32-dep
27 PYVER=$(shell $(PYTHON) misc/pyver.py)
28 SUPPORT = $(shell pwd)/support
29 SUPPORTLIB = $(SUPPORT)/lib/$(PYVER)/site-packages
30 SRCPATH := $(shell pwd)/src
34 TRIALCMD = $(shell PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SRCPATH)" $(PYTHON) misc/find_trial.py)
41 REACTOROPT := --reactor=$(REACTOR)
46 TRIAL=PYTHONUNBUFFERED=1 $(TRIALCMD) --rterrors $(REACTOROPT)
48 build-auto-deps: check-deps
49 mkdir -p "$(SUPPORTLIB)"
50 PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)" \
51 $(PYTHON) misc/dependencies/build-deps-setup.py install \
54 # The following target is here because I don't know how to tell the buildmaster
55 # to start instructing his slaves to "build-auto-deps" instead of instructing
56 # them to "build-deps". --Z
57 build-deps: build-auto-deps
59 EGGSPATH = $(shell $(PYTHON) misc/find-dep-eggs.py)
63 ifneq ($(PYTHONPATH),)
64 PYTHONPATH := $(PYTHONPATH)$(PATHSEP)
66 PP=PYTHONPATH="$(SRCPATH)$(PATHSEP)$(PYTHONPATH)$(PATHSEP)$(EGGSPATH)"
68 .PHONY: make-version build
70 # The 'darcsver' setup.py command comes in the 'darcsver' package:
71 # http://pypi.python.org/pypi/darcsver It is necessary only if you want to
72 # automatically produce a new _version.py file from the current darcs history.
74 $(PYTHON) ./setup.py darcsver
76 # We want src/allmydata/_version.py to be up-to-date, but it's a fairly
77 # expensive operation (about 6 seconds on a just-before-0.7.0 tree, probably
78 # because of the 332 patches since the last tag), and we've removed the need
79 # for an explicit 'build' step by removing the C code from src/allmydata and
80 # by running everything in place. It would be neat to do:
82 #src/allmydata/_version.py: _darcs/patches
83 # $(MAKE) make-version
84 #build: src/allmydata/_version.py
87 # since that would update the embedded version string each time new darcs
88 # patches were pulled, but 1) this would break non-darcs trees (i.e. building
89 # from an exported tarball), and 2) without an obligatory 'build' step this
90 # rule wouldn't be run frequently enought anyways.
92 # So instead, I'll just make sure that we update the version at least once
93 # when we first start using the tree, and again whenever an explicit 'make'
94 # is run, since when things are confused, the first thing a developer does is
95 # a 'make clean; make all'. We do this by putting an explicit call to
96 # make-version in the 'build' target.
102 simple-build: build-auto-deps build
106 $(PYTHON) ./setup.py build_ext -i $(INCLUDE_DIRS_ARG) $(LIBRARY_DIRS_ARG)
109 # 'make install' will do the following:
110 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
111 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
112 # a different location
117 $(PP) $(PYTHON) ./setup.py install \
118 --single-version-externally-managed \
119 --prefix=$(PREFIX) --record=./tahoe.files
121 $(PP) $(PYTHON) ./setup.py install \
122 --single-version-externally-managed
128 .PHONY: check-all-deps check-twisted-dep $(CHECK_PYWIN32_DEP) signal-error-deps, signal-error-twisted-dep, signal-error-pywin32-dep, test test-figleaf figleaf-output
134 @echo "ERROR: Not all of Tahoe's dependencies are in place. Please \
135 see the README for help on installing dependencies."
140 signal-error-twisted-dep:
143 @echo "ERROR: Before running \"make build-auto-deps\" you have to ensure that \
144 Twisted is installed (including its zope.interface dependency). Twisted and \
145 zope.interface are required for the automatic installation of certain other \
146 libraries that Tahoe requires). Please see the README for details."
151 signal-error-pywin32-dep:
154 @echo "ERROR: the pywin32 dependency is not in place. Please see the README \
155 for help on installing dependencies."
160 signal-error-pyopenssl-dep:
163 @echo "ERROR: the pyOpenSSL dependency is not in place (note that pyOpenSSL required \
164 OpenSSL). Please see the README for help on installing dependencies."
169 check-all-deps: check-deps
171 $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, pycryptopp' || $(MAKE) signal-error-deps
174 $(PYTHON) -c 'import twisted, zope.interface' || $(MAKE) signal-error-twisted-dep
177 $(PYTHON) -c 'import win32process' || $(MAKE) signal-error-pywin32-dep
180 $(PYTHON) -c 'import OpenSSL' || $(MAKE) signal-error-pyopenssl-dep
182 check-deps: check-twisted-dep $(CHECK_PYWIN32_DEP) check-pyopenssl-dep
185 $(MAKE) check-all-deps
188 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
189 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
193 # use 'make test TRIALARGS=--reporter=bwverbose' from buildbot, to
194 # suppress the ansi color sequences
196 test: .built .checked-deps
198 $(TRIAL) $(TRIALARGS) $(TEST)
200 test-figleaf: .built .checked-deps
203 $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
207 $(PYTHON) misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes
208 @echo "now point your browser at coverage-html/index.html"
210 # after doing test-figleaf and figleaf-output, point your browser at
211 # coverage-html/index.html
213 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines
214 .PHONY: check-memory check-memory-once clean
216 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
220 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
223 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
227 rsync -a coverage-html/ $(UPLOAD_TARGET)
228 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
231 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
235 .figleaf.el: .figleaf
237 $(PYTHON) misc/figleaf2el.py .figleaf src
240 $(PYTHON) -OOu `which pyflakes` src/allmydata
244 @find src -name '*.py' |grep -v /build/ |wc --lines
246 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
248 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
253 $(PYTHON) src/allmydata/test/check_memory.py upload
255 $(PYTHON) src/allmydata/test/check_memory.py upload-self
257 $(PYTHON) src/allmydata/test/check_memory.py upload-POST
259 $(PYTHON) src/allmydata/test/check_memory.py download
261 $(PYTHON) src/allmydata/test/check_memory.py download-GET
263 $(PYTHON) src/allmydata/test/check_memory.py download-GET-slow
265 $(PYTHON) src/allmydata/test/check_memory.py receive
267 check-memory-once: .built
270 $(PYTHON) src/allmydata/test/check_memory.py $(MODE)
272 # this target uses a pre-established client node to run a canned set of
273 # performance tests against a test network that is also pre-established
274 # (probably on a remote machine). Provide it with the path to a local
275 # directory where this client node has been created (and populated with the
276 # necessary FURLs of the test network). This target will start that client
277 # with the current code and then run the tests. Afterwards it will stop the
280 # The 'sleep 5' is in there to give the new client a chance to connect to its
281 # storageservers, since check_speed.py has no good way of doing that itself.
284 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
285 @echo "stopping any leftover client code"
286 -$(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
287 $(PYTHON) bin/tahoe start $(TESTCLIENTDIR)
289 $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
290 $(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
292 # 'make repl' is a simple-to-type command to get a Python interpreter loop
293 # from which you can type 'import allmydata'
297 test-darcs-boringfile:
299 $(PYTHON) misc/test-darcs-boringfile.py
302 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.old
305 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.new
306 diff allfiles.tmp.old allfiles.tmp.new
309 rm -rf build _trial_temp _test_memory .checked-deps .built
311 rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
312 rm -rf tahoe_deps.egg-info allmydata_tahoe.egg-info
314 rm -rf setuptools*.egg *.pyc darcsver*.egg
316 find-trailing-spaces:
317 $(PYTHON) misc/find-trailing-spaces.py -r src
322 VER=$(shell $(PYTHON) misc/get-version.py)
323 DEBCOMMENTS="'make deb' build"
328 .PHONY: setup-deb deb-ARCH is-known-debian-arch
329 .PHONY: deb-sid deb-feisty deb-edgy deb-etch
332 $(MAKE) deb-ARCH ARCH=sid
334 $(MAKE) deb-ARCH ARCH=feisty
335 # edgy uses the feisty control files for now
337 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty
338 # etch uses the feisty control files for now
340 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=feisty
341 # same with gutsy, the process has been nicely stable for a while now
343 $(MAKE) deb-ARCH ARCH=gutsy TAHOE_ARCH=feisty
345 # we know how to handle the following debian architectures
346 KNOWN_DEBIAN_ARCHES := sid feisty edgy etch gutsy
348 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
349 is-known-debian-arch:
350 @echo "ARCH must be set when using setup-deb or deb-ARCH"
351 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
354 is-known-debian-arch:
362 setup-deb: is-known-debian-arch
364 ln -s misc/$(TAHOE_ARCH)/debian debian
365 chmod +x debian/rules
367 # etch (current debian stable) has python-simplejson-1.3, which doesn't
369 # sid (debian unstable) currently has python-simplejson 1.7.1
370 # edgy has 1.3, which doesn't support indent=
371 # feisty has 1.4, which supports indent= but emits a deprecation warning
374 # we need 1.4 or newer
376 deb-ARCH: is-known-debian-arch setup-deb
377 fakeroot debian/rules binary
379 @echo "The newly built .deb packages are in the parent directory from here."
381 .PHONY: increment-deb-version
382 .PHONY: deb-sid-head deb-edgy-head deb-feisty-head
383 .PHONY: deb-etch-head
385 # The buildbot runs the following targets after each change, to produce
386 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
388 increment-deb-version: make-version
389 debchange --newversion $(VER) $(DEBCOMMENTS)
391 $(MAKE) setup-deb ARCH=sid
392 $(MAKE) increment-deb-version
393 fakeroot debian/rules binary
395 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=feisty
396 $(MAKE) increment-deb-version
397 fakeroot debian/rules binary
399 $(MAKE) setup-deb ARCH=feisty
400 $(MAKE) increment-deb-version
401 fakeroot debian/rules binary
403 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=feisty
404 $(MAKE) increment-deb-version
405 fakeroot debian/rules binary
407 $(MAKE) setup-deb ARCH=gutsy TAHOE_ARCH=feisty
408 $(MAKE) increment-deb-version
409 fakeroot debian/rules binary