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 TRIALPATH=$(shell which trial.py 2>/dev/null)
23 TRIALPATH=$(shell which trial 2>/dev/null)
26 TRIALPATH=$(shell $(PYTHON) -c "import os, sys; print repr(os.path.join(sys.prefix, \"Scripts\", \"trial.py\"))")
29 TRIALPATH=$(shell $(PYTHON) -c "import os, sys; print repr(os.path.join(sys.prefix, \"Scripts\", \"trial\"))")
34 PLAT = $(strip $(shell python -c "import sys ; print sys.platform"))
36 # The platform is Windows with cygwin build tools and the native Python interpreter.
37 TRIALPATH := $(shell cygpath -w $(TRIALPATH))
38 SUPPORT = $(shell cygpath -w $(shell pwd))\support
39 SUPPORTLIB := $(SUPPORT)\Lib\site-packages
40 SRCPATH := $(shell cygpath -w $(shell pwd))\src
42 PYVER=$(shell $(PYTHON) misc/pyver.py)
43 SUPPORT = $(shell pwd)/support
44 SUPPORTLIB = $(SUPPORT)/lib/$(PYVER)/site-packages
45 SRCPATH := $(shell pwd)/src
53 REACTOROPT := --reactor=$(REACTOR)
58 TRIAL=$(PYTHON) -u "$(TRIALPATH)" --rterrors $(REACTOROPT)
60 # build-deps wants setuptools to have been built first. It's easiest to
61 # accomplish this by depending upon the tahoe compile.
63 mkdir -p "$(SUPPORTLIB)"
64 PYTHONPATH="$(PYTHONPATH)$(PATHSEP)$(SUPPORTLIB)$(PATHSEP)." \
65 $(PYTHON) misc/dependencies/build-deps-setup.py install \
68 EGGSPATH = $(shell $(PYTHON) misc/find-dep-eggs.py)
72 PP=PYTHONPATH="$(SRCPATH)$(PATHSEP)$(EGGSPATH)$(PATHSEP)$(PYTHONPATH)"
74 .PHONY: make-version build
76 $(PYTHON) misc/make-version.py "allmydata-tahoe" "src/allmydata/_version.py"
83 $(PYTHON) ./setup.py build_ext -i
84 chmod +x bin/allmydata-tahoe
86 # 'make install' will do the following:
87 # build+install tahoe (probably to /usr/lib/pythonN.N/site-packages)
88 # 'make install PREFIX=/usr/local/stow/tahoe-N.N' will do the same, but to
89 # a different location
94 $(PP) $(PYTHON) ./setup.py install \
95 --single-version-externally-managed \
96 --prefix=$(PREFIX) --record=./tahoe.files
98 $(PP) $(PYTHON) ./setup.py install \
99 --single-version-externally-managed
105 .PHONY: check-deps test test-figleaf figleaf-output
110 $(PYTHON) -c 'import allmydata, zfec, foolscap, simplejson, nevow, OpenSSL' || \
111 echo "Not all of Tahoe's dependencies are in place. Please see the README for help on installing dependencies." && \
118 # you can use 'make test TEST=allmydata.test.test_introducer' to run just
119 # test_introducer. TEST=allmydata.test.test_client.Basic.test_permute works
123 # use 'make test REPORTER=--reporter=bwverbose' from buildbot, to
124 # suppress the ansi color sequences
126 test: .built .checked-deps
128 $(TRIAL) $(REPORTER) $(TEST)
130 test-figleaf: .built .checked-deps
133 $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
137 $(PYTHON) misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes
138 @echo "now point your browser at coverage-html/index.html"
140 # after doing test-figleaf and figleaf-output, point your browser at
141 # coverage-html/index.html
143 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines
144 .PHONY: check-memory check-memory-once clean
146 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
150 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
153 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
157 rsync -a coverage-html/ $(UPLOAD_TARGET)
158 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
161 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
165 .figleaf.el: .figleaf
167 $(PYTHON) misc/figleaf2el.py .figleaf src
170 $(PYTHON) -OOu `which pyflakes` src/allmydata
174 @find src -name '*.py' |grep -v /build/ |wc --lines
176 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
178 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
183 $(PYTHON) src/allmydata/test/check_memory.py upload
185 $(PYTHON) src/allmydata/test/check_memory.py upload-self
187 $(PYTHON) src/allmydata/test/check_memory.py upload-POST
189 $(PYTHON) src/allmydata/test/check_memory.py download
191 $(PYTHON) src/allmydata/test/check_memory.py download-GET
193 $(PYTHON) src/allmydata/test/check_memory.py download-GET-slow
195 $(PYTHON) src/allmydata/test/check_memory.py receive
197 check-memory-once: .built
200 $(PYTHON) src/allmydata/test/check_memory.py $(MODE)
203 test-darcs-boringfile:
205 $(PYTHON) misc/test-darcs-boringfile.py
208 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.old
211 find . |grep -v allfiles.tmp |grep -v src/allmydata/_version.py |sort >allfiles.tmp.new
212 diff allfiles.tmp.old allfiles.tmp.new
215 rm -rf build _trial_temp _test_memory .checked-deps .built
217 rm -f `find src/allmydata -name '*.so' -or -name '*.pyc'`
218 rm -rf tahoe_deps.egg-info allmydata_tahoe.egg-info
220 rm -rf setuptools*.egg *.pyc
226 VER=$(shell $(PYTHON) misc/get-version.py)
227 DEBCOMMENTS="'make deb' build"
232 .PHONY: setup-deb deb-ARCH is-known-debian-arch
233 .PHONY: deb-sid deb-feisty deb-edgy deb-etch
236 $(MAKE) deb-ARCH ARCH=sid
238 $(MAKE) deb-ARCH ARCH=feisty
239 # edgy uses the feisty control files for now
241 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty
242 # etch uses the feisty control files for now
244 $(MAKE) deb-ARCH ARCH=etch TAHOE_ARCH=feisty
246 # we know how to handle the following debian architectures
247 KNOWN_DEBIAN_ARCHES := sid feisty edgy etch
249 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
250 is-known-debian-arch:
251 @echo "ARCH must be set when using setup-deb or deb-ARCH"
252 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
255 is-known-debian-arch:
263 setup-deb: is-known-debian-arch
265 ln -s misc/$(TAHOE_ARCH)/debian debian
266 chmod +x debian/rules
268 # etch (current debian stable) has python-simplejson-1.3, which doesn't
270 # sid (debian unstable) currently has python-simplejson 1.7.1
271 # edgy has 1.3, which doesn't support indent=
272 # feisty has 1.4, which supports indent= but emits a deprecation warning
275 # we need 1.4 or newer
277 deb-ARCH: is-known-debian-arch setup-deb
278 fakeroot debian/rules binary
280 echo "The newly built .deb packages are in the parent directory from here."
282 .PHONY: increment-deb-version
283 .PHONY: deb-sid-head deb-edgy-head deb-feisty-head
284 .PHONY: deb-etch-head
286 # The buildbot runs the following targets after each change, to produce
287 # up-to-date tahoe .debs. These steps do not create .debs for anything else.
289 increment-deb-version: make-version
290 debchange --newversion $(VER) $(DEBCOMMENTS)
292 $(MAKE) setup-deb ARCH=sid
293 $(MAKE) increment-deb-version
294 fakeroot debian/rules binary
296 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=feisty
297 $(MAKE) increment-deb-version
298 fakeroot debian/rules binary
300 $(MAKE) setup-deb ARCH=feisty
301 $(MAKE) increment-deb-version
302 fakeroot debian/rules binary
304 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=feisty
305 $(MAKE) increment-deb-version
306 fakeroot debian/rules binary