]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - GNUmakefile
use select reactor instead of iocp reactor on Windows
[tahoe-lafs/tahoe-lafs.git] / GNUmakefile
1 default: build
2
3 BASE=$(shell pwd)
4 PYTHON=python
5 INSTDIR=$(BASE)/instdir
6 PATHSEP=$(shell python -c 'import os ; print os.pathsep')
7 TRIALPATH=$(shell which trial.py 2>/dev/null)
8 ifeq ($(TRIALPATH),)
9 TRIALPATH=$(shell which trial)
10 endif
11
12 EXTRA_SETUP_ARGS=
13 REACTOR=poll
14
15 PLAT = $(strip $(shell python -c "import sys ; print sys.platform"))
16 ifeq ($(PLAT),cygwin)
17  # The platform is Windows with cygwin build tools and the cygwin Python interpreter.
18  INSTDIR := $(shell cygpath -u $(INSTDIR))
19 else
20  ifeq ($(PLAT),win32)
21   # The platform is Windows with cygwin build tools and the native Python interpreter.
22   EXTRA_SETUP_ARGS=build -c mingw32
23   REACTOR=select
24   INSTDIR := $(shell cygpath -w $(INSTDIR))
25   TRIALPATH := $(shell cygpath -w $(TRIALPATH))
26   ifneq ($(PYTHONPATH),)
27    PYTHONPATH := $(shell cygpath -w $(PYTHONPATH))
28   endif
29  endif
30 endif
31
32 ifneq ($(PYTHONPATH),)
33 PYTHONPATH := "$(PYTHONPATH)$(PATHSEP)$(INSTDIR)"
34 else
35 PYTHONPATH := "$(INSTDIR)"
36 endif
37
38 TRIAL=$(PYTHON) -u "$(TRIALPATH)" --reactor=$(REACTOR)
39 # $(error $(TRIAL))
40
41 show-instdir:
42         @echo $(INSTDIR)
43
44 PP=PYTHONPATH=$(PYTHONPATH)
45
46 .PHONY: build
47 build: build-zfec build-Crypto
48         $(PYTHON) setup.py $(EXTRA_SETUP_ARGS) install --install-lib="$(INSTDIR)" --install-scripts="$(INSTDIR)/scripts"
49
50 build-zfec:
51         cd src/zfec && $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --install-lib="$(INSTDIR)" --install-scripts="$(INSTDIR)/scripts"
52
53 clean-zfec:
54         -cd src/zfec && python ./setup.py clean --all
55
56
57 build-Crypto:
58         cd src/Crypto && $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --install-lib="$(INSTDIR)" --install-scripts="$(INSTDIR)/scripts"
59
60 clean-Crypto:
61         cd src/Crypto && python ./setup.py clean --all
62
63
64 .PHONY: run-queen run-client test
65
66 run-queen:
67         cd queen-basedir && PYTHONPATH=.. twistd -noy ../queen.tac
68
69 run-client: build
70         cd client-basedir && $(PP) twistd -noy ../client.tac
71
72 run-client2:
73         cd client-basedir2 && PYTHONPATH=.. twistd -noy ../client.tac
74 run-client3:
75         cd client-basedir3 && PYTHONPATH=.. twistd -noy ../client.tac
76
77 ifeq ($(TEST),)
78 TEST=allmydata zfec
79 endif
80 REPORTER=
81
82 # use 'make test REPORTER=--reporter=bwverbose' from buildbot, to supress the
83 # ansi color sequences
84 test: build
85         $(PP) $(TRIAL) $(REPORTER) $(TEST)
86
87 test-figleaf: build
88         rm -f .figleaf
89         $(PP) $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
90
91 figleaf-output:
92         $(PP) $(PYTHON) misc/figleaf2html -d coverage-html -r $(INSTDIR) -x misc/figleaf.excludes
93         @echo "now point your browser at coverage-html/index.html"
94 # after doing test-figleaf and figleaf-output, point your browser at
95 # coverage-html/index.html
96
97 # this command is meant to be run with an
98 ifdef UPLOAD_TARGET
99 upload-figleaf:
100         rsync -a coverage-html/ $(UPLOAD_TARGET)
101 else
102 upload-figleaf:
103         echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
104         /bin/false
105 endif
106
107 .figleaf.el: .figleaf
108         $(PP) $(PYTHON) misc/figleaf2el.py .figleaf $(INSTDIR)
109
110 pyflakes:
111         pyflakes src/allmydata
112
113 count-lines:
114         @echo -n "files: "
115         @find src -name '*.py' |grep -v /build/ |wc --lines
116         @echo -n "lines: "
117         @cat `find src -name '*.py' |grep -v /build/` |wc --lines
118         @echo -n "TODO: "
119         @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
120
121 check-memory:
122         $(PP) $(PYTHON) src/allmydata/test/check_memory.py
123
124 clean: clean-zfec clean-Crypto
125         rm -rf build
126         rm -f debian
127         rm -rf instdir
128
129 create_dirs:
130         mkdir -p queen-basedir
131         mkdir -p client-basedir
132         mkdir -p client-basedir2
133         mkdir -p client-basedir/storage
134         mkdir -p client-basedir2/storage
135
136 DEBVER=`head -1 debian/changelog | sed -e 's/^[^(]*(\([^)]*\)).*$$/\1/' | sed -e 's/^\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$$/\1/'`
137 DEBSTRING=$(DEBVER)-T`date +%s`
138 DEBCOMMENTS="'make deb' build"
139
140 show:
141         echo $(DEBVER)
142         echo $(DEBSTRING)
143
144 .PHONY: setup-dapper setup-sid setup-edgy setup-feisty
145 .PHONY: deb-dapper deb-sid deb-edgy deb-feisty
146 .PHONY: increment-deb-version
147 .PHONY: deb-dapper-head deb-sid-head deb-edgy-head deb-feisty-head
148
149 setup-dapper:
150         rm -f debian
151         ln -s dapper/debian debian
152         chmod a+x debian/rules
153
154 setup-sid:
155         rm -f debian
156         ln -s sid/debian debian
157         chmod a+x debian/rules
158
159 # edgy uses the feisty control files for now
160 setup-edgy:
161         rm -f debian
162         ln -s feisty/debian debian
163         chmod a+x debian/rules
164
165 setup-feisty:
166         rm -f debian
167         ln -s feisty/debian debian
168         chmod a+x debian/rules
169
170
171 deb-dapper: setup-dapper
172         fakeroot debian/rules binary
173 deb-sid: setup-sid
174         fakeroot debian/rules binary
175 deb-edgy: setup-edgy
176         fakeroot debian/rules binary
177 deb-feisty: setup-feisty
178         fakeroot debian/rules binary
179
180 increment-deb-version:
181         debchange --newversion $(DEBSTRING) $(DEBCOMMENTS)
182 deb-dapper-head: setup-dapper increment-deb-version
183         fakeroot debian/rules binary
184 deb-sid-head: setup-sid increment-deb-version
185         fakeroot debian/rules binary
186 deb-edgy-head: setup-edgy increment-deb-version
187         fakeroot debian/rules binary
188 deb-feisty-head: setup-feisty increment-deb-version
189         fakeroot debian/rules binary
190