2 # NOTE: 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 INNOSETUP := $(shell cygpath -au "$(PROGRAMFILES)/Inno Setup 5/Compil32.exe")
27 PYVER=$(shell $(PYTHON) misc/pyver.py)
28 SUPPORT = $(shell pwd)/support
29 SUPPORTLIB = $(SUPPORT)/lib/$(PYVER)/site-packages
30 SRCPATH := $(shell pwd)/src
39 REACTOROPT := --reactor=$(REACTOR)
44 ifneq ($(PYTHONPATH),)
45 PP=PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)"
47 PP=PYTHONPATH="$(SUPPORTLIB)"
50 TRIALCMD = $(shell PATH=${PATH}:${PWD}/support/bin $(PP) $(PYTHON) misc/find_trial.py)
51 TRIAL=PATH="${PATH}:${PWD}/support/bin" PYTHONUNBUFFERED=1 "$(TRIALCMD)" --rterrors "$(REACTOROPT)"
53 .PHONY: make-version build
55 # The 'darcsver' setup.py command comes in the 'darcsver' package:
56 # http://pypi.python.org/pypi/darcsver It is necessary only if you want to
57 # automatically produce a new _version.py file from the current darcs history.
59 $(PP) $(PYTHON) ./setup.py darcsver --count-all-patches
61 # We want src/allmydata/_version.py to be up-to-date, but it's a fairly
62 # expensive operation (about 6 seconds on a just-before-0.7.0 tree, probably
63 # because of the 332 patches since the last tag), and we've removed the need
64 # for an explicit 'build' step by removing the C code from src/allmydata and
65 # by running everything in place. It would be neat to do:
67 #src/allmydata/_version.py: _darcs/patches
68 # $(MAKE) make-version
70 # since that would update the embedded version string each time new darcs
71 # patches were pulled, but 1) this would break non-darcs trees (i.e. building
72 # from an exported tarball), and 2) without an obligatory 'build' step this
73 # rule wouldn't be run frequently enought anyways.
75 # So instead, I'll just make sure that we update the version at least once
76 # when we first start using the tree, and again whenever an explicit
77 # 'make-version' is run, since then at least the developer has some means to
78 # update things. It would be nice if 'make clean' deleted any
79 # automatically-generated _version.py too, so that 'make clean; make all'
80 # could be useable as a "what the heck is going on, get me back to a clean
81 # state', but we need 'make clean' to work on non-darcs trees without
82 # destroying useful information.
87 src/allmydata/_version.py:
90 build: src/allmydata/_version.py
91 mkdir -p "$(SUPPORTLIB)"
92 $(PP) $(PYTHON) ./setup.py develop --prefix="$(SUPPORT)"
96 # 'make install' will do the following:
97 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
98 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
99 # a different location
101 install: src/allmydata/_version.py
104 $(PP) $(PYTHON) ./setup.py install \
105 --single-version-externally-managed \
106 --prefix=$(PREFIX) --record=./tahoe.files
108 $(PP) $(PYTHON) ./setup.py install \
109 --single-version-externally-managed
115 .PHONY: signal-error-deps test test-figleaf figleaf-output
121 @echo "ERROR: Not all of Tahoe's dependencies are in place. Please see docs/install.html for help on installing dependencies."
127 @$(PP) $(PYTHON) -c 'import _auto_deps ; _auto_deps.require_auto_deps()' || $(MAKE) signal-error-deps
130 $(MAKE) check-auto-deps
133 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
134 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
138 # use 'make test TRIALARGS=--reporter=bwverbose' from buildbot, to
139 # suppress the ansi color sequences
141 test: build src/allmydata/_version.py
142 $(PP) $(TRIAL) $(TRIALARGS) $(TEST)
144 quicktest: .built .checked-deps
145 $(PP) $(TRIAL) $(TRIALARGS) $(TEST)
147 test-figleaf: build src/allmydata/_version.py
149 $(PP) $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
151 quicktest-figleaf: src/allmydata/_version.py
153 $(PP) $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
157 $(PYTHON) misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes
158 @echo "now point your browser at coverage-html/index.html"
160 # after doing test-figleaf and figleaf-output, point your browser at
161 # coverage-html/index.html
163 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines
164 .PHONY: check-memory check-memory-once clean
166 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
170 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
173 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
177 rsync -a coverage-html/ $(UPLOAD_TARGET)
178 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
181 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
185 .figleaf.el: .figleaf
186 $(PP) $(PYTHON) misc/figleaf2el.py .figleaf src
189 $(PYTHON) -OOu `which pyflakes` src/allmydata |sort |uniq
193 @find src -name '*.py' |grep -v /build/ |wc --lines
195 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
197 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
202 $(PYTHON) src/allmydata/test/check_memory.py upload
204 $(PYTHON) src/allmydata/test/check_memory.py upload-self
206 $(PYTHON) src/allmydata/test/check_memory.py upload-POST
208 $(PYTHON) src/allmydata/test/check_memory.py download
210 $(PYTHON) src/allmydata/test/check_memory.py download-GET
212 $(PYTHON) src/allmydata/test/check_memory.py download-GET-slow
214 $(PYTHON) src/allmydata/test/check_memory.py receive
216 check-memory-once: .built
219 $(PYTHON) src/allmydata/test/check_memory.py $(MODE)
221 # this target uses a pre-established client node to run a canned set of
222 # performance tests against a test network that is also pre-established
223 # (probably on a remote machine). Provide it with the path to a local
224 # directory where this client node has been created (and populated with the
225 # necessary FURLs of the test network). This target will start that client
226 # with the current code and then run the tests. Afterwards it will stop the
229 # The 'sleep 5' is in there to give the new client a chance to connect to its
230 # storageservers, since check_speed.py has no good way of doing that itself.
233 if [ -z '$(TESTCLIENTDIR)' ]; then exit 1; fi
234 @echo "stopping any leftover client code"
235 -$(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
236 $(PYTHON) bin/tahoe start $(TESTCLIENTDIR)
238 $(PYTHON) src/allmydata/test/check_speed.py $(TESTCLIENTDIR)
239 $(PYTHON) bin/tahoe stop $(TESTCLIENTDIR)
241 # 'make repl' is a simple-to-type command to get a Python interpreter loop
242 # from which you can type 'import allmydata'
246 test-darcs-boringfile:
248 $(PYTHON) misc/test-darcs-boringfile.py
251 find . |grep -vEe"allfiles.tmp|src/allmydata/_(version|auto_deps).py|src/allmydata_tahoe.egg-info" |sort >allfiles.tmp.old
254 find . |grep -vEe"allfiles.tmp|src/allmydata/_(version|auto_deps).py|src/allmydata_tahoe.egg-info" |sort >allfiles.tmp.new
255 diff allfiles.tmp.old allfiles.tmp.new
258 rm -rf build _trial_temp _test_memory .checked-deps .built
260 rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
261 rm -rf tahoe_deps.egg-info allmydata_tahoe.egg-info
263 rm -rf setuptools*.egg *.pyc darcsver*.egg pyutil*.egg
264 rm -rf misc/dependencies/build misc/dependencies/temp
265 rm -rf misc/dependencies/tahoe_deps.egg-info
267 find-trailing-spaces:
268 $(PYTHON) misc/find-trailing-spaces.py -r src
271 .PHONY: tarballs upload-tarballs
274 $(PYTHON) setup.py sdist --formats=bztar,gztar,zip
276 for f in dist/allmydata-tahoe-*; do \
277 xfer-client --furlfile ~/.tahoe-tarball-upload.furl $$f; \
282 VER=$(shell $(PYTHON) misc/get-version.py)
283 DEBCOMMENTS="'make deb' build"
288 .PHONY: setup-deb deb-ARCH is-known-debian-arch
289 .PHONY: deb-sid deb-feisty deb-edgy deb-etch
292 $(MAKE) deb-ARCH ARCH=sid
294 $(MAKE) deb-ARCH ARCH=feisty
295 # edgy uses the feisty control files for now
297 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty
298 # etch uses the feisty control files for now
300 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=feisty
301 # same with gutsy, the process has been nicely stable for a while now
303 $(MAKE) deb-ARCH ARCH=gutsy TAHOE_ARCH=feisty
305 # we know how to handle the following debian architectures
306 KNOWN_DEBIAN_ARCHES := sid feisty edgy etch gutsy
308 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
309 is-known-debian-arch:
310 @echo "ARCH must be set when using setup-deb or deb-ARCH"
311 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
314 is-known-debian-arch:
322 setup-deb: is-known-debian-arch
324 ln -s misc/$(TAHOE_ARCH)/debian debian
325 chmod +x debian/rules
327 # etch (current debian stable) has python-simplejson-1.3, which doesn't
329 # sid (debian unstable) currently has python-simplejson 1.7.1
330 # edgy has 1.3, which doesn't support indent=
331 # feisty has 1.4, which supports indent= but emits a deprecation warning
334 # we need 1.4 or newer
336 deb-ARCH: is-known-debian-arch setup-deb
337 fakeroot debian/rules binary
339 @echo "The newly built .deb packages are in the parent directory from here."
341 .PHONY: increment-deb-version
342 .PHONY: deb-sid-head deb-edgy-head deb-feisty-head
343 .PHONY: deb-etch-head
345 # The buildbot runs the following targets after each change, to produce
346 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
348 increment-deb-version: make-version
349 debchange --newversion $(VER) $(DEBCOMMENTS)
351 $(MAKE) setup-deb ARCH=sid
352 $(MAKE) increment-deb-version
353 fakeroot debian/rules binary
355 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=feisty
356 $(MAKE) increment-deb-version
357 fakeroot debian/rules binary
359 $(MAKE) setup-deb ARCH=feisty
360 $(MAKE) increment-deb-version
361 fakeroot debian/rules binary
363 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=feisty
364 $(MAKE) increment-deb-version
365 fakeroot debian/rules binary
367 $(MAKE) setup-deb ARCH=gutsy TAHOE_ARCH=feisty
368 $(MAKE) increment-deb-version
369 fakeroot debian/rules binary
371 # These targets provide for windows native builds
372 .PHONY: windows-exe windows-installer windows-installer-upload
375 cd windows && $(PP) $(PYTHON) setup.py py2exe
377 windows-installer: windows-exe
378 $(PP) $(PYTHON) misc/sub-ver.py windows/installer.tmpl >windows/installer.iss
379 cd windows && "$(INNOSETUP)" /cc installer.iss
381 windows-installer-upload:
382 chmod -R o+rx windows/dist/installer
383 rsync -av -e /usr/bin/ssh windows/dist/installer/ amduser@dev:/home/amduser/public_html/dist/tahoe/windows/
385 # These targets provide for mac native builds
386 .PHONY: mac-exe mac-upload mac-cleanup mac-dbg
390 VERSION=$(VER) $(PP) $(MAKE) -C mac build
393 VERSION=$(VER) $(MAKE) -C mac diskimage
396 VERSION=$(VER) $(MAKE) -C mac upload UPLOAD_DEST=$(UPLOAD_DEST)
399 VERSION=$(VER) $(MAKE) -C mac cleanup
402 cd mac && $(PP) $(PYTHON)w allmydata_tahoe.py
404 # This target runs a stats gatherer server
405 .PHONY: stats-gatherer-run
407 cd stats_gatherer && $(PP) $(PYTHON) ../src/allmydata/stats.py