2 sampledata_rev := $(shell t/configure-sampledata --revision)
3 current_sampledata := t/sampledata/var/rev/v$(sampledata_rev)
5 OS:=$(shell uname | sed 's/[-_].*//')
6 CFLAGS := -Wall -O2 -Werror -Wno-unknown-pragmas $(PYINCLUDE) $(CFLAGS)
7 CFLAGS := -D_FILE_OFFSET_BITS=64 $(CFLAGS)
17 test_tmp := $(CURDIR)/t/tmp
20 initial_setup := $(shell ./configure-version --update)
21 bup_deps := bup lib/bup/_version.py lib/bup/_helpers$(SOEXT) cmds
23 all: $(bup_deps) Documentation/all $(current_sampledata)
28 Documentation/all: $(bup_deps)
30 $(current_sampledata):
31 t/configure-sampledata --setup
33 PYTHON = $(shell cmd/bup-python -c 'import sys; print sys.executable')
35 define install-python-bin
37 sed -e '1 s|.*|#!$(PYTHON)|; 2,/^# end of bup preamble$$/d' $1 > $2; \
43 MANDIR=$(DESTDIR)$(PREFIX)/share/man
44 DOCDIR=$(DESTDIR)$(PREFIX)/share/doc/bup
45 BINDIR=$(DESTDIR)$(PREFIX)/bin
46 LIBDIR=$(DESTDIR)$(PREFIX)/lib/bup
48 $(INSTALL) -d $(MANDIR)/man1 $(DOCDIR) $(BINDIR) \
49 $(LIBDIR)/bup $(LIBDIR)/cmd \
50 $(LIBDIR)/web $(LIBDIR)/web/static
51 [ ! -e Documentation/.docs-available ] || \
55 [ ! -e Documentation/.docs-available ] || \
57 Documentation/*.html \
59 $(call install-python-bin,bup,"$(BINDIR)/bup")
61 for cmd in $$(ls cmd/bup-* | grep -v cmd/bup-python); do \
62 $(call install-python-bin,"$$cmd","$(LIBDIR)/$$cmd") \
82 config/config.h: config/Makefile config/configure config/configure.inc \
83 $(wildcard config/*.in)
84 cd config && $(MAKE) config.h
86 lib/bup/_helpers$(SOEXT): \
88 lib/bup/bupsplit.c lib/bup/_helpers.c lib/bup/csetup.py
91 LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" $(PYTHON) csetup.py build
92 cp lib/bup/build/*/_helpers$(SOEXT) lib/bup/
95 @echo "Something has gone wrong; $@ should already exist."
96 @echo 'Check "./configure-version --update"'
102 runtests: runtests-python runtests-cmdline
104 runtests-python: all t/tmp
105 TMPDIR="$(test_tmp)" $(PYTHON) wvtest.py t/t*.py lib/*/t/t*.py 2>&1 \
106 | tee -a t/tmp/test-log/$$$$.log
110 t/test-split-join.sh \
114 t/test-compression.sh \
116 t/test-index-clear.sh \
117 t/test-index-check-device.sh \
122 t/test-restore-map-owner.sh \
123 t/test-restore-single-file.sh \
124 t/test-rm-between-index-and-save.sh \
125 t/test-sparse-files.sh \
126 t/test-command-without-init-fails.sh \
127 t/test-redundant-saves.sh \
128 t/test-save-creates-no-unrefs.sh \
129 t/test-save-restore-excludes.sh \
130 t/test-save-strip-graft.sh \
131 t/test-import-duplicity.sh \
132 t/test-import-rdiff-backup.sh \
137 tmp-target-run-test%: all t/tmp
138 TMPDIR="$(test_tmp)" t/test$* 2>&1 | tee -a t/tmp/test-log/$$$$.log
140 runtests-cmdline: $(subst t/test,tmp-target-run-test,$(cmdline_tests))
143 PATH=/bin:/usr/bin $(MAKE) test
146 if test -e t/tmp/test-log; then rm -r t/tmp/test-log; fi
147 mkdir -p t/tmp/test-log
148 ./wvtest watch --no-counts \
149 $(MAKE) PYTHON=$(PYTHON) runtests-python runtests-cmdline
150 ./wvtest report t/tmp/test-log/*.log
154 cmd/python-cmd.sh: config/configure config/configure.inc
158 $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
159 $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
161 cmd/bup-%: cmd/%-cmd.py
165 cmd/bup-%: cmd/%-cmd.sh
169 # update the local 'man' and 'html' branches with pregenerated output files, for
170 # people who don't have pandoc (and maybe to aid in google searches or something)
171 export-docs: Documentation/all
172 git update-ref refs/heads/man origin/man '' 2>/dev/null || true
173 git update-ref refs/heads/html origin/html '' 2>/dev/null || true
174 GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
175 rm -f $${GIT_INDEX_FILE} && \
176 git add -f Documentation/*.1 && \
177 git update-ref refs/heads/man \
178 $$(echo "Autogenerated man pages for $$(git describe --always)" \
179 | git commit-tree $$(git write-tree --prefix=Documentation) \
180 -p refs/heads/man) && \
181 rm -f $${GIT_INDEX_FILE} && \
182 git add -f Documentation/*.html && \
183 git update-ref refs/heads/html \
184 $$(echo "Autogenerated html pages for $$(git describe --always)" \
185 | git commit-tree $$(git write-tree --prefix=Documentation) \
188 # push the pregenerated doc files to origin/man and origin/html
189 push-docs: export-docs
190 git push origin man html
192 # import pregenerated doc files from origin/man and origin/html, in case you
193 # don't have pandoc but still want to be able to install the docs.
194 import-docs: Documentation/clean
195 git archive origin/html | (cd Documentation; tar -xvf -)
196 git archive origin/man | (cd Documentation; tar -xvf -)
198 clean: Documentation/clean config/clean
199 rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll lib/*/*.dll *.exe \
200 .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
201 *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
202 bup bup-* cmd/bup-* \
205 testfs.img lib/bup/t/testfs.img
206 if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi
207 if test -e t/mnt; then rm -r t/mnt; fi
208 if test -e t/tmp; then t/cleanup-mounts-under t/tmp; fi
209 # FIXME: migrate these to t/mnt/
210 if test -e lib/bup/t/testfs; \
211 then umount lib/bup/t/testfs || true; fi
212 rm -rf *.tmp *.tmp.meta t/*.tmp lib/*/*/*.tmp build lib/bup/build lib/bup/t/testfs
213 if test -e t/tmp; then t/force-delete t/tmp; fi
214 ./configure-version --clean
215 t/configure-sampledata --clean