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-deps wants setuptools to have been built first. It's easiest to
49 # accomplish this by depending upon the tahoe compile.
50 build-deps: .built check-twisted-dep
51 mkdir -p "$(SUPPORTLIB)"
52 PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)" \
53 $(PYTHON) misc/dependencies/build-deps-setup.py install \
56 EGGSPATH = $(shell $(PYTHON) misc/find-dep-eggs.py)
60 ifneq ($(PYTHONPATH),)
61 PYTHONPATH := $(PYTHONPATH)$(PATHSEP)
63 PP=PYTHONPATH="$(SRCPATH)$(PATHSEP)$(EGGSPATH)$(PATHSEP)$(PYTHONPATH)"
65 .PHONY: make-version build
66 # N.B.: the first argument to make-version.py is used to find darcs tags that
67 # represent released versions, so it needs to match whatever release
68 # conventions are in use.
70 $(PYTHON) misc/make-version.py "allmydata-tahoe" "src/allmydata/_version.py"
77 $(PYTHON) ./setup.py build_ext -i $(INCLUDE_DIRS_ARG) $(LIBRARY_DIRS_ARG)
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 check-twisted-dep $(CHECK_PYWIN32_DEP) signal-error-deps, signal-error-twisted-dep, signal-error-pywin32-dep, test test-figleaf figleaf-output
105 @echo "ERROR: Not all of Tahoe's dependencies are in place. Please \
106 see the README for help on installing dependencies."
111 signal-error-twisted-dep:
114 @echo "ERROR: Before running \"make build-deps\" you have to ensure that \
115 Twisted is installed (including its zope.interface dependency). Twisted and \
116 zope.interface are required for the automatic installation of certain other \
117 libraries that Tahoe requires). Please see the README for details."
122 signal-error-pywin32-dep:
125 @echo "ERROR: the pywin32 dependency is not in place. Please see the README \
126 for help on installing dependencies."
131 signal-error-pyopenssl-dep:
134 @echo "ERROR: the pyOpenSSL dependency is not in place (note that pyOpenSSL required \
135 OpenSSL). Please see the README for help on installing dependencies."
140 check-deps: check-twisted-dep $(CHECK_PYWIN32_DEP) check-pyopenssl-dep
142 $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, pycryptopp' || $(MAKE) signal-error-deps
145 $(PYTHON) -c 'import twisted, zope.interface' || $(MAKE) signal-error-twisted-dep
148 $(PYTHON) -c 'import win32process' || $(MAKE) signal-error-pywin32-dep
151 $(PYTHON) -c 'import OpenSSL' || $(MAKE) signal-error-pyopenssl-dep
157 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
158 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
162 # use 'make test TRIALARGS=--reporter=bwverbose' from buildbot, to
163 # suppress the ansi color sequences
165 test: .built .checked-deps
167 $(TRIAL) $(TRIALARGS) $(TEST)
169 test-figleaf: .built .checked-deps
172 $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
176 $(PYTHON) misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes
177 @echo "now point your browser at coverage-html/index.html"
179 # after doing test-figleaf and figleaf-output, point your browser at
180 # coverage-html/index.html
182 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines
183 .PHONY: check-memory check-memory-once clean
185 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
189 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
192 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
196 rsync -a coverage-html/ $(UPLOAD_TARGET)
197 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
200 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
204 .figleaf.el: .figleaf
206 $(PYTHON) misc/figleaf2el.py .figleaf src
209 $(PYTHON) -OOu `which pyflakes` src/allmydata
213 @find src -name '*.py' |grep -v /build/ |wc --lines
215 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
217 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
222 $(PYTHON) src/allmydata/test/check_memory.py upload
224 $(PYTHON) src/allmydata/test/check_memory.py upload-self
226 $(PYTHON) src/allmydata/test/check_memory.py upload-POST
228 $(PYTHON) src/allmydata/test/check_memory.py download
230 $(PYTHON) src/allmydata/test/check_memory.py download-GET
232 $(PYTHON) src/allmydata/test/check_memory.py download-GET-slow
234 $(PYTHON) src/allmydata/test/check_memory.py receive
236 check-memory-once: .built
239 $(PYTHON) src/allmydata/test/check_memory.py $(MODE)
241 # this target uses a pre-established client node to run a canned set of
242 # performance tests against a test network that is also pre-established
243 # (probably on a remote machine). Provide it with the path to a local
244 # directory where this client node has been created (and populated with the
245 # necessary FURLs of the test network). This target will start that client
246 # with the current code and then run the tests. Afterwards it will stop the
249 # The 'sleep 5' is in there to give the new client a chance to connect to its
250 # storageservers, since check_speed.py has no good way of doing that itself.
253 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
254 @echo "stopping any leftover client code"
255 -$(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
256 $(PYTHON) bin/tahoe start $(TESTCLIENTDIR)
258 $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
259 $(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
261 # 'make repl' is a simple-to-type command to get a Python interpreter loop
262 # from which you can type 'import allmydata'
266 test-darcs-boringfile:
268 $(PYTHON) misc/test-darcs-boringfile.py
271 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.old
274 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.new
275 diff allfiles.tmp.old allfiles.tmp.new
278 rm -rf build _trial_temp _test_memory .checked-deps .built
280 rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
281 rm -rf tahoe_deps.egg-info allmydata_tahoe.egg-info
283 rm -rf setuptools*.egg *.pyc
285 find-trailing-spaces:
286 $(PYTHON) misc/find-trailing-spaces.py -r src
291 VER=$(shell $(PYTHON) misc/get-version.py)
292 DEBCOMMENTS="'make deb' build"
297 .PHONY: setup-deb deb-ARCH is-known-debian-arch
298 .PHONY: deb-sid deb-feisty deb-edgy deb-etch
301 $(MAKE) deb-ARCH ARCH=sid
303 $(MAKE) deb-ARCH ARCH=feisty
304 # edgy uses the feisty control files for now
306 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty
307 # etch uses the feisty control files for now
309 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=feisty
310 # same with gutsy, the process has been nicely stable for a while now
312 $(MAKE) deb-ARCH ARCH=gutsy TAHOE_ARCH=feisty
314 # we know how to handle the following debian architectures
315 KNOWN_DEBIAN_ARCHES := sid feisty edgy etch gutsy
317 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
318 is-known-debian-arch:
319 @echo "ARCH must be set when using setup-deb or deb-ARCH"
320 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
323 is-known-debian-arch:
331 setup-deb: is-known-debian-arch
333 ln -s misc/$(TAHOE_ARCH)/debian debian
334 chmod +x debian/rules
336 # etch (current debian stable) has python-simplejson-1.3, which doesn't
338 # sid (debian unstable) currently has python-simplejson 1.7.1
339 # edgy has 1.3, which doesn't support indent=
340 # feisty has 1.4, which supports indent= but emits a deprecation warning
343 # we need 1.4 or newer
345 deb-ARCH: is-known-debian-arch setup-deb
346 fakeroot debian/rules binary
348 @echo "The newly built .deb packages are in the parent directory from here."
350 .PHONY: increment-deb-version
351 .PHONY: deb-sid-head deb-edgy-head deb-feisty-head
352 .PHONY: deb-etch-head
354 # The buildbot runs the following targets after each change, to produce
355 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
357 increment-deb-version: make-version
358 debchange --newversion $(VER) $(DEBCOMMENTS)
360 $(MAKE) setup-deb ARCH=sid
361 $(MAKE) increment-deb-version
362 fakeroot debian/rules binary
364 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=feisty
365 $(MAKE) increment-deb-version
366 fakeroot debian/rules binary
368 $(MAKE) setup-deb ARCH=feisty
369 $(MAKE) increment-deb-version
370 fakeroot debian/rules binary
372 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=feisty
373 $(MAKE) increment-deb-version
374 fakeroot debian/rules binary
376 $(MAKE) setup-deb ARCH=gutsy TAHOE_ARCH=feisty
377 $(MAKE) increment-deb-version
378 fakeroot debian/rules binary