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