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 \
52 --prefix="$(SUPPORT)" || \
53 echo "Build of Tahoe's bundled, automatically built dependent libraries failed -- please see docs/install.html for instructions."
55 # The following target is here because I don't know how to tell the buildmaster
56 # to start instructing his slaves to "build-auto-deps" instead of instructing
57 # them to "build-deps". --Z
58 build-deps: build-auto-deps
60 EGGSPATH = $(shell $(PYTHON) misc/find-dep-eggs.py)
64 ifneq ($(PYTHONPATH),)
65 PYTHONPATH := $(PYTHONPATH)$(PATHSEP)
67 PP=PYTHONPATH="$(SRCPATH)$(PATHSEP)$(PYTHONPATH)$(PATHSEP)$(EGGSPATH)"
69 .PHONY: make-version build
71 # The 'darcsver' setup.py command comes in the 'darcsver' package:
72 # http://pypi.python.org/pypi/darcsver It is necessary only if you want to
73 # automatically produce a new _version.py file from the current darcs history.
75 $(PYTHON) ./setup.py darcsver
77 # We want src/allmydata/_version.py to be up-to-date, but it's a fairly
78 # expensive operation (about 6 seconds on a just-before-0.7.0 tree, probably
79 # because of the 332 patches since the last tag), and we've removed the need
80 # for an explicit 'build' step by removing the C code from src/allmydata and
81 # by running everything in place. It would be neat to do:
83 #src/allmydata/_version.py: _darcs/patches
84 # $(MAKE) make-version
86 # since that would update the embedded version string each time new darcs
87 # patches were pulled, but 1) this would break non-darcs trees (i.e. building
88 # from an exported tarball), and 2) without an obligatory 'build' step this
89 # rule wouldn't be run frequently enought anyways.
91 # So instead, I'll just make sure that we update the version at least once
92 # when we first start using the tree, and again whenever an explicit
93 # 'make-version' is run, since then at least the developer has some means to
94 # update things. It would be nice if 'make clean' deleted any
95 # automatically-generated _version.py too, so that 'make clean; make all'
96 # could be useable as a "what the heck is going on, get me back to a clean
97 # state', but we need 'make clean' to work on non-darcs trees without
98 # destroying useful information.
104 simple-build: build-auto-deps build
106 src/allmydata/_version.py:
109 build: src/allmydata/_version.py
110 $(PYTHON) ./setup.py build_ext -i $(INCLUDE_DIRS_ARG) $(LIBRARY_DIRS_ARG) || \
111 echo "Build of Allmydata-Tahoe failed -- please see docs/install.html for instructions."
114 # 'make install' will do the following:
115 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
116 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
117 # a different location
119 install: src/allmydata/_version.py
122 $(PP) $(PYTHON) ./setup.py install \
123 --single-version-externally-managed \
124 --prefix=$(PREFIX) --record=./tahoe.files
126 $(PP) $(PYTHON) ./setup.py install \
127 --single-version-externally-managed
133 .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
139 @echo "ERROR: Not all of Tahoe's dependencies are in place. Please \
140 see the README for help on installing dependencies."
145 signal-error-twisted-dep:
148 @echo "ERROR: Before running \"make build-auto-deps\" you have to ensure that \
149 Twisted is installed (including its zope.interface dependency). Twisted and \
150 zope.interface are required for the automatic installation of certain other \
151 libraries that Tahoe requires). Please see the README for details."
156 signal-error-pywin32-dep:
159 @echo "ERROR: the pywin32 dependency is not in place. Please see the README \
160 for help on installing dependencies."
165 signal-error-pyopenssl-dep:
168 @echo "ERROR: the pyOpenSSL dependency is not in place (note that pyOpenSSL required \
169 OpenSSL). Please see the README for help on installing dependencies."
174 check-all-deps: check-deps
176 $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, pycryptopp' || $(MAKE) signal-error-deps
179 $(PYTHON) -c 'import twisted, zope.interface' || $(MAKE) signal-error-twisted-dep
182 $(PYTHON) -c 'import win32process' || $(MAKE) signal-error-pywin32-dep
185 $(PYTHON) -c 'import OpenSSL' || $(MAKE) signal-error-pyopenssl-dep
187 check-deps: check-twisted-dep $(CHECK_PYWIN32_DEP) check-pyopenssl-dep
190 $(MAKE) check-all-deps
193 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
194 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
198 # use 'make test TRIALARGS=--reporter=bwverbose' from buildbot, to
199 # suppress the ansi color sequences
201 test: .built .checked-deps
203 $(TRIAL) $(TRIALARGS) $(TEST)
205 test-figleaf: .built .checked-deps
208 $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
212 $(PYTHON) misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes
213 @echo "now point your browser at coverage-html/index.html"
215 # after doing test-figleaf and figleaf-output, point your browser at
216 # coverage-html/index.html
218 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines
219 .PHONY: check-memory check-memory-once clean
221 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
225 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
228 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
232 rsync -a coverage-html/ $(UPLOAD_TARGET)
233 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
236 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
240 .figleaf.el: .figleaf
242 $(PYTHON) misc/figleaf2el.py .figleaf src
245 $(PYTHON) -OOu `which pyflakes` src/allmydata
249 @find src -name '*.py' |grep -v /build/ |wc --lines
251 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
253 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
258 $(PYTHON) src/allmydata/test/check_memory.py upload
260 $(PYTHON) src/allmydata/test/check_memory.py upload-self
262 $(PYTHON) src/allmydata/test/check_memory.py upload-POST
264 $(PYTHON) src/allmydata/test/check_memory.py download
266 $(PYTHON) src/allmydata/test/check_memory.py download-GET
268 $(PYTHON) src/allmydata/test/check_memory.py download-GET-slow
270 $(PYTHON) src/allmydata/test/check_memory.py receive
272 check-memory-once: .built
275 $(PYTHON) src/allmydata/test/check_memory.py $(MODE)
277 # this target uses a pre-established client node to run a canned set of
278 # performance tests against a test network that is also pre-established
279 # (probably on a remote machine). Provide it with the path to a local
280 # directory where this client node has been created (and populated with the
281 # necessary FURLs of the test network). This target will start that client
282 # with the current code and then run the tests. Afterwards it will stop the
285 # The 'sleep 5' is in there to give the new client a chance to connect to its
286 # storageservers, since check_speed.py has no good way of doing that itself.
289 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
290 @echo "stopping any leftover client code"
291 -$(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
292 $(PYTHON) bin/tahoe start $(TESTCLIENTDIR)
294 $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
295 $(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
297 # 'make repl' is a simple-to-type command to get a Python interpreter loop
298 # from which you can type 'import allmydata'
302 test-darcs-boringfile:
304 $(PYTHON) misc/test-darcs-boringfile.py
307 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.old
310 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.new
311 diff allfiles.tmp.old allfiles.tmp.new
314 rm -rf build _trial_temp _test_memory .checked-deps .built
316 rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
317 rm -rf tahoe_deps.egg-info allmydata_tahoe.egg-info
319 rm -rf setuptools*.egg *.pyc darcsver*.egg
321 find-trailing-spaces:
322 $(PYTHON) misc/find-trailing-spaces.py -r src
327 VER=$(shell $(PYTHON) misc/get-version.py)
328 DEBCOMMENTS="'make deb' build"
333 .PHONY: setup-deb deb-ARCH is-known-debian-arch
334 .PHONY: deb-sid deb-feisty deb-edgy deb-etch
337 $(MAKE) deb-ARCH ARCH=sid
339 $(MAKE) deb-ARCH ARCH=feisty
340 # edgy uses the feisty control files for now
342 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty
343 # etch uses the feisty control files for now
345 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=feisty
346 # same with gutsy, the process has been nicely stable for a while now
348 $(MAKE) deb-ARCH ARCH=gutsy TAHOE_ARCH=feisty
350 # we know how to handle the following debian architectures
351 KNOWN_DEBIAN_ARCHES := sid feisty edgy etch gutsy
353 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
354 is-known-debian-arch:
355 @echo "ARCH must be set when using setup-deb or deb-ARCH"
356 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
359 is-known-debian-arch:
367 setup-deb: is-known-debian-arch
369 ln -s misc/$(TAHOE_ARCH)/debian debian
370 chmod +x debian/rules
372 # etch (current debian stable) has python-simplejson-1.3, which doesn't
374 # sid (debian unstable) currently has python-simplejson 1.7.1
375 # edgy has 1.3, which doesn't support indent=
376 # feisty has 1.4, which supports indent= but emits a deprecation warning
379 # we need 1.4 or newer
381 deb-ARCH: is-known-debian-arch setup-deb
382 fakeroot debian/rules binary
384 @echo "The newly built .deb packages are in the parent directory from here."
386 .PHONY: increment-deb-version
387 .PHONY: deb-sid-head deb-edgy-head deb-feisty-head
388 .PHONY: deb-etch-head
390 # The buildbot runs the following targets after each change, to produce
391 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
393 increment-deb-version: make-version
394 debchange --newversion $(VER) $(DEBCOMMENTS)
396 $(MAKE) setup-deb ARCH=sid
397 $(MAKE) increment-deb-version
398 fakeroot debian/rules binary
400 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=feisty
401 $(MAKE) increment-deb-version
402 fakeroot debian/rules binary
404 $(MAKE) setup-deb ARCH=feisty
405 $(MAKE) increment-deb-version
406 fakeroot debian/rules binary
408 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=feisty
409 $(MAKE) increment-deb-version
410 fakeroot debian/rules binary
412 $(MAKE) setup-deb ARCH=gutsy TAHOE_ARCH=feisty
413 $(MAKE) increment-deb-version
414 fakeroot debian/rules binary