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