]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - GNUmakefile
GNUmakefile: clean up better
[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=iocp
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 test-zfec:
54         $(PP) $(PYTHON) src/zfec/fec/test/test_zfec.py
55
56 clean-zfec:
57         -cd src/zfec && python ./setup.py clean --all
58
59
60 build-Crypto:
61         cd src/Crypto && $(PYTHON) ./setup.py $(EXTRA_SETUP_ARGS) install --install-lib="$(INSTDIR)" --install-scripts="$(INSTDIR)/scripts"
62
63 clean-Crypto:
64         cd src/Crypto && python ./setup.py clean --all
65
66
67 .PHONY: run-queen run-client test
68
69 run-queen:
70         cd queen-basedir && PYTHONPATH=.. twistd -noy ../queen.tac
71
72 run-client: build
73         cd client-basedir && $(PP) twistd -noy ../client.tac
74
75 run-client2:
76         cd client-basedir2 && PYTHONPATH=.. twistd -noy ../client.tac
77 run-client3:
78         cd client-basedir3 && PYTHONPATH=.. twistd -noy ../client.tac
79
80 ifeq ($(TEST),)
81 TEST=allmydata fec
82 endif
83 REPORTER=
84
85 # use 'make test REPORTER=--reporter=bwverbose' from buildbot, to supress the
86 # ansi color sequences
87 test: build
88         $(PP) $(TRIAL) $(REPORTER) $(TEST)
89
90 test-figleaf: build
91         rm -f .figleaf
92         $(PP) $(TRIAL) --reporter=bwverbose-figleaf $(TEST)
93
94 figleaf-output:
95         $(PP) $(PYTHON) misc/figleaf2html -d coverage-html -r $(INSTDIR) -x misc/figleaf.excludes
96         @echo "now point your browser at coverage-html/index.html"
97 # after doing test-figleaf and figleaf-output, point your browser at
98 # coverage-html/index.html
99
100 # this command is meant to be run with an
101 ifdef UPLOAD_TARGET
102 upload-figleaf:
103         rsync -a coverage-html/ $(UPLOAD_TARGET)
104 else
105 upload-figleaf:
106         echo "this target is meant to be run with UPLOAD_TARGET=host:/path/"
107         /bin/false
108 endif
109
110 .figleaf.el: .figleaf
111         $(PP) $(PYTHON) misc/figleaf2el.py .figleaf $(INSTDIR)
112
113 pyflakes:
114         pyflakes src/allmydata
115
116 count-lines:
117         @echo -n "files: "
118         @find src -name '*.py' |grep -v /build/ |wc --lines
119         @echo -n "lines: "
120         @cat `find src -name '*.py' |grep -v /build/` |wc --lines
121         @echo -n "TODO: "
122         @grep TODO `find src -name '*.py' |grep -v /build/` | wc --lines
123
124 check-memory:
125         $(PP) $(PYTHON) src/allmydata/test/check_memory.py
126
127 clean: clean-zfec clean-Crypto
128         rm -rf build
129         rm -f debian
130         rm -rf instdir
131
132 create_dirs:
133         mkdir -p queen-basedir
134         mkdir -p client-basedir
135         mkdir -p client-basedir2
136         mkdir -p client-basedir/storage
137         mkdir -p client-basedir2/storage
138
139 DEBVER=`head -1 debian/changelog | sed -e 's/^[^(]*(\([^)]*\)).*$$/\1/' | sed -e 's/^\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$$/\1/'`
140 DEBSTRING=$(DEBVER)-T`date +%s`
141 DEBCOMMENTS="'make deb' build"
142
143 show:
144         echo $(DEBVER)
145         echo $(DEBSTRING)
146
147 .PHONY: setup-dapper setup-sid setup-edgy setup-feisty
148 .PHONY: deb-dapper deb-sid deb-edgy deb-feisty
149 .PHONY: increment-deb-version
150 .PHONY: deb-dapper-head deb-sid-head deb-edgy-head deb-feisty-head
151
152 setup-dapper:
153         rm -f debian
154         ln -s dapper/debian debian
155         chmod a+x debian/rules
156
157 setup-sid:
158         rm -f debian
159         ln -s sid/debian debian
160         chmod a+x debian/rules
161
162 # edgy uses the feisty control files for now
163 setup-edgy:
164         rm -f debian
165         ln -s feisty/debian debian
166         chmod a+x debian/rules
167
168 setup-feisty:
169         rm -f debian
170         ln -s feisty/debian debian
171         chmod a+x debian/rules
172
173
174 deb-dapper: setup-dapper
175         fakeroot debian/rules binary
176 deb-sid: setup-sid
177         fakeroot debian/rules binary
178 deb-edgy: setup-edgy
179         fakeroot debian/rules binary
180 deb-feisty: setup-feisty
181         fakeroot debian/rules binary
182
183 increment-deb-version:
184         debchange --newversion $(DEBSTRING) $(DEBCOMMENTS)
185 deb-dapper-head: setup-dapper increment-deb-version
186         fakeroot debian/rules binary
187 deb-sid-head: setup-sid increment-deb-version
188         fakeroot debian/rules binary
189 deb-edgy-head: setup-edgy increment-deb-version
190         fakeroot debian/rules binary
191 deb-feisty-head: setup-feisty increment-deb-version
192         fakeroot debian/rules binary
193