2 # this Makefile requires GNU make
8 INSTDIR=$(BASE)/instdir
9 PATHSEP=$(shell python -c 'import os ; print os.pathsep')
10 TRIALPATH=$(shell which trial.py 2>/dev/null)
12 TRIALPATH=$(shell which trial 2>/dev/null)
15 TRIALPATH=$(shell $(PYTHON) -c "import os, sys; print repr(os.path.join(sys.prefix, \"Scripts\", \"trial.py\"))")
18 TRIALPATH=$(shell $(PYTHON) -c "import os, sys; print repr(os.path.join(sys.prefix, \"Scripts\", \"trial\"))")
24 PLAT = $(strip $(shell python -c "import sys ; print sys.platform"))
26 # The platform is Windows with cygwin build tools and the cygwin Python interpreter.
27 INSTDIR := $(shell cygpath -u $(INSTDIR))
30 # The platform is Windows with cygwin build tools and the native Python interpreter.
31 EXTRA_SETUP_ARGS=build -c mingw32
33 INSTDIR := $(shell cygpath -w $(INSTDIR))
34 TRIALPATH := $(shell cygpath -w $(TRIALPATH))
35 ifneq ($(PYTHONPATH),)
36 PYTHONPATH := $(shell cygpath -w $(PYTHONPATH))
41 ORIGPYTHONPATH=$(PYTHONPATH)
43 # Append instdir/lib instead of prepending it so that people can override
44 # things from lib with alternate packages of their choosing by setting their
47 ifneq ($(PYTHONPATH),)
48 PYTHONPATH := "$(PYTHONPATH)$(PATHSEP)$(INSTDIR)/lib"
50 PYTHONPATH := "$(INSTDIR)/lib"
53 TRIAL=$(PYTHON) -u "$(TRIALPATH)" --rterrors --reactor=$(REACTOR)
58 PP=PYTHONPATH=$(PYTHONPATH)
60 .PHONY: make-version build
62 $(PYTHON) misc/make-version.py
64 build: make-version build-zfec build-Crypto build-foolscap build-simplejson
65 $(PP) $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --prefix="$(INSTDIR)" --install-lib="$(INSTDIR)/lib" --install-scripts="$(INSTDIR)/bin"
69 $(PP) $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --single-version-externally-managed --prefix="$(INSTDIR)" --record="$(INSTDIR)/zfec_install.log" --install-lib="$(INSTDIR)/lib" --install-scripts="$(INSTDIR)/bin"
73 $(PP) $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --prefix="$(INSTDIR)" --record="$(INSTDIR)/foolscap_install.log" --install-lib="$(INSTDIR)/lib" --install-scripts="$(INSTDIR)/bin"
76 cd src/simplejson && \
77 $(PP) $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --single-version-externally-managed --prefix="$(INSTDIR)" --record="$(INSTDIR)/simplejson_install.log" --install-lib="$(INSTDIR)/lib" --install-scripts="$(INSTDIR)/bin"
81 $(PP) $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --prefix="$(INSTDIR)" --record="$(INSTDIR)/Crypto_install.log" --install-lib="$(INSTDIR)/lib" --install-scripts="$(INSTDIR)/bin"
85 $(PP) $(PYTHON) ./setup.py clean --all
89 $(PP) $(PYTHON) ./setup.py clean --all
93 $(PP) $(PYTHON) ./setup.py clean --all
98 # these targets let you create a client node in the current directory and
101 .PHONY: create-client start-client stop-client run-client
102 .PHONY: create-introducer start-introducer stop-introducer
105 $(PP) $(PYTHON) bin/allmydata-tahoe create-client -C CLIENTDIR
107 $(PP) $(PYTHON) bin/allmydata-tahoe start -C CLIENTDIR
109 $(PP) $(PYTHON) bin/allmydata-tahoe stop -C CLIENTDIR
111 create-introducer: build
112 $(PP) $(PYTHON) bin/allmydata-tahoe create-introducer -C INTRODUCERDIR
113 start-introducer: build
114 $(PP) $(PYTHON) bin/allmydata-tahoe start -C INTRODUCERDIR
115 stop-introducer: build
116 $(PP) $(PYTHON) bin/allmydata-tahoe stop -C INTRODUCERDIR
122 .PHONY: test-all test test-foolscap test-figleaf figleaf-output
124 # you can use 'make test TEST=allmydata.test.test_introducer' to run just a
125 # specific test. TEST=allmydata.test.test_client.Basic.test_permute works
130 test-all: test-foolscap test
132 # use 'make test REPORTER=--reporter=bwverbose' from buildbot, to supress the
133 # ansi color sequences
136 $(PP) $(TRIAL) $(REPORTER) $(TEST)
138 # foolscap tests need to be run in their own source dir, so that the paths to
139 # the .pyc files are correct (since some of the foolscap tests depend upon
140 # stack traces having actual source code in them, and they don't when the
141 # tests are run from the 'instdir' that the tahoe makefile uses).
143 cd src/foolscap && PYTHONPATH=$(ORIGPYTHONPATH) $(TRIAL) $(REPORTER) foolscap
146 find $(INSTDIR) -name '*.pyc' |xargs rm
148 $(PP) $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
151 $(PP) $(PYTHON) misc/figleaf2html -d coverage-html -r $(INSTDIR)/lib -x misc/figleaf.excludes
152 @echo "now point your browser at coverage-html/index.html"
154 # after doing test-figleaf and figleaf-output, point your browser at
155 # coverage-html/index.html
157 .PHONY: upload-figleaf .figleaf.el pyflakes count-lines check-memory clean
159 # 'upload-figleaf' is meant to be run with an UPLOAD_TARGET=host:/dir setting
163 $(error UPLOAD_HOST must be set when using UPLOAD_TARGET)
166 $(error COVERAGEDIR must be set when using UPLOAD_TARGET)
170 rsync -a coverage-html/ $(UPLOAD_TARGET)
171 ssh $(UPLOAD_HOST) make update-tahoe-figleaf COVERAGEDIR=$(COVERAGEDIR)
174 echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
178 .figleaf.el: .figleaf
179 $(PP) $(PYTHON) misc/figleaf2el.py .figleaf $(INSTDIR)/lib
182 $(PP) $(PYTHON) -OOu `which pyflakes` src/allmydata
186 @find src -name '*.py' |grep -v /build/ |wc --lines
188 @cat `find src -name '*.py' |grep -v /build/` |wc --lines
190 @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
194 $(PP) $(PYTHON) src/allmydata/test/check_memory.py upload
195 cat _test_memory/stats.out >>memstats.out
196 $(PP) $(PYTHON) src/allmydata/test/check_memory.py upload-POST
197 cat _test_memory/stats.out >>memstats.out
199 test-darcs-boringfile:
201 $(PYTHON) misc/test-darcs-boringfile.py
204 find . |sort >allfiles.tmp.old
207 find . |grep -v allfiles.tmp |sort >allfiles.tmp.new
208 diff allfiles.tmp.old allfiles.tmp.new
210 clean: clean-zfec clean-Crypto clean-foolscap
216 cd src/zfec && python ./setup.py install && cd ../..
217 cd src/foolscap && python ./setup.py install && cd ../..
218 cd src/Crypto && python ./setup.py install && cd ../..
219 python ./setup.py install
224 VER=$(shell $(PYTHON) misc/get-version.py)
225 DEBCOMMENTS="'make deb' build"
230 .PHONY: setup-deb deb-ARCH is-known-debian-arch
231 .PHONY: deb-sid deb-feisty deb-edgy deb-etch
234 $(MAKE) deb-ARCH ARCH=sid
236 $(MAKE) deb-ARCH ARCH=feisty
237 # edgy uses the feisty control files for now
239 $(MAKE) deb-ARCH ARCH=edgy TAHOE_ARCH=feisty
240 # etch uses the feisty control files for now
242 $(MAKE) deb-ARCH ARCH=etch FOOLSCAP_ARCH=sid TAHOE_ARCH=feisty
244 # we know how to handle the following debian architectures
245 KNOWN_DEBIAN_ARCHES := sid feisty edgy etch
247 ifeq ($(findstring x-$(ARCH)-x,$(foreach arch,$(KNOWN_DEBIAN_ARCHES),"x-$(arch)-x")),)
248 is-known-debian-arch:
249 @echo "ARCH must be set when using setup-deb or deb-ARCH"
250 @echo "I know how to handle:" $(KNOWN_DEBIAN_ARCHES)
253 is-known-debian-arch:
258 FOOLSCAP_ARCH=$(ARCH)
264 setup-deb: is-known-debian-arch
266 ln -s misc/$(TAHOE_ARCH)/debian debian
267 chmod +x debian/rules
269 deb-foolscap-ARCH: is-known-debian-arch
270 $(MAKE) -C src/foolscap debian-$(FOOLSCAP_ARCH)
271 mv src/python-foolscap*.deb ..
273 # etch (current debian stable) has python-simplejson-1.3
274 # sid (debian unstable) currently has python-simplejson 1.7.1
279 deb-ARCH: is-known-debian-arch setup-deb
280 fakeroot debian/rules binary
281 $(MAKE) deb-foolscap-ARCH
283 echo "The newly built .deb packages are in the parent directory from here."
285 .PHONY: increment-deb-version
286 .PHONY: deb-sid-head deb-edgy-head deb-feisty-head
287 .PHONY: deb-etch-head
289 # The buildbot runs the following targets after each change, to produce
290 # up-to-date tahoe .debs. These steps do not create foolscap or simplejson
291 # .debs, only the deb-$ARCH targets (above) do that.
293 increment-deb-version: make-version
294 debchange --newversion $(VER) $(DEBCOMMENTS)
296 $(MAKE) setup-deb ARCH=sid
297 $(MAKE) increment-deb-version
298 fakeroot debian/rules binary
300 $(MAKE) setup-deb ARCH=edgy TAHOE_ARCH=feisty
301 $(MAKE) increment-deb-version
302 fakeroot debian/rules binary
304 $(MAKE) setup-deb ARCH=feisty
305 $(MAKE) increment-deb-version
306 fakeroot debian/rules binary
308 $(MAKE) setup-deb ARCH=etch TAHOE_ARCH=feisty
309 $(MAKE) increment-deb-version
310 fakeroot debian/rules binary