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 bup_deps := bup lib/bup/_version.py lib/bup/_helpers$(SOEXT) cmds
22 all: $(bup_deps) Documentation/all $(current_sampledata)
27 Documentation/all: $(bup_deps)
29 $(current_sampledata):
30 t/configure-sampledata --setup
35 MANDIR=$(DESTDIR)$(PREFIX)/share/man
36 DOCDIR=$(DESTDIR)$(PREFIX)/share/doc/bup
37 BINDIR=$(DESTDIR)$(PREFIX)/bin
38 LIBDIR=$(DESTDIR)$(PREFIX)/lib/bup
40 $(INSTALL) -d $(MANDIR)/man1 $(DOCDIR) $(BINDIR) \
41 $(LIBDIR)/bup $(LIBDIR)/cmd \
42 $(LIBDIR)/web $(LIBDIR)/web/static
43 [ ! -e Documentation/.docs-available ] || \
47 [ ! -e Documentation/.docs-available ] || \
49 Documentation/*.html \
51 $(INSTALL) -pm 0755 bup $(BINDIR)
73 config/config.h: config/Makefile config/configure config/configure.inc \
74 $(wildcard config/*.in)
75 cd config && $(MAKE) config.h
77 lib/bup/_helpers$(SOEXT): \
79 lib/bup/bupsplit.c lib/bup/_helpers.c lib/bup/csetup.py
82 LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" $(PYTHON) csetup.py build
83 cp lib/bup/build/*/_helpers$(SOEXT) lib/bup/
85 # This must be completely atomic since it may be run (often) in
86 # parallel when "-j" is specified, either via targets here, or via
87 # tests that use an install tree as data.
88 .PHONY: lib/bup/_version.py
91 && ./format-subst.pl $@.pre > $@.tmp-$$$$ \
92 && (if ! test -e $@ || ! cmp $@ $@.tmp-$$$$; then mv $@.tmp-$$$$ $@; fi) \
98 runtests: runtests-python runtests-cmdline
100 runtests-python: all t/tmp
101 TMPDIR="$(test_tmp)" $(PYTHON) wvtest.py t/t*.py lib/*/t/t*.py
107 t/test-compression.sh \
109 t/test-index-clear.sh \
110 t/test-index-check-device.sh \
114 t/test-restore-map-owner.sh \
115 t/test-restore-single-file.sh \
116 t/test-rm-between-index-and-save.sh \
117 t/test-sparse-files.sh \
118 t/test-command-without-init-fails.sh \
119 t/test-redundant-saves.sh \
120 t/test-save-creates-no-unrefs.sh \
121 t/test-save-restore-excludes.sh \
122 t/test-save-strip-graft.sh \
123 t/test-import-duplicity.sh \
124 t/test-import-rdiff-backup.sh \
129 tmp-target-run-test-%: all t/tmp
130 TMPDIR="$(test_tmp)" t/test-$*
132 runtests-cmdline: $(subst t/test-,tmp-target-run-test-,$(cmdline_tests))
135 PATH=/bin:/usr/bin $(MAKE) test
138 ./wvtestrun $(MAKE) PYTHON=$(PYTHON) runtests-python runtests-cmdline
143 $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
144 $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
146 cmd/bup-%: cmd/%-cmd.py
150 cmd/bup-%: cmd/%-cmd.sh
154 # update the local 'man' and 'html' branches with pregenerated output files, for
155 # people who don't have pandoc (and maybe to aid in google searches or something)
156 export-docs: Documentation/all
157 git update-ref refs/heads/man origin/man '' 2>/dev/null || true
158 git update-ref refs/heads/html origin/html '' 2>/dev/null || true
159 GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
160 rm -f $${GIT_INDEX_FILE} && \
161 git add -f Documentation/*.1 && \
162 git update-ref refs/heads/man \
163 $$(echo "Autogenerated man pages for $$(git describe --always)" \
164 | git commit-tree $$(git write-tree --prefix=Documentation) \
165 -p refs/heads/man) && \
166 rm -f $${GIT_INDEX_FILE} && \
167 git add -f Documentation/*.html && \
168 git update-ref refs/heads/html \
169 $$(echo "Autogenerated html pages for $$(git describe --always)" \
170 | git commit-tree $$(git write-tree --prefix=Documentation) \
173 # push the pregenerated doc files to origin/man and origin/html
174 push-docs: export-docs
175 git push origin man html
177 # import pregenerated doc files from origin/man and origin/html, in case you
178 # don't have pandoc but still want to be able to install the docs.
179 import-docs: Documentation/clean
180 git archive origin/html | (cd Documentation; tar -xvf -)
181 git archive origin/man | (cd Documentation; tar -xvf -)
183 clean: Documentation/clean config/clean
184 rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll lib/*/*.dll *.exe \
185 .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
186 *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
187 bup bup-* cmd/bup-* \
188 lib/bup/_version.py lib/bup/_version.py.tmp-* \
190 testfs.img lib/bup/t/testfs.img
191 if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi
192 if test -e t/mnt; then rm -r t/mnt; fi
193 if test -e t/tmp; then t/cleanup-mounts-under t/tmp; fi
194 # FIXME: migrate these to t/mnt/
195 if test -e lib/bup/t/testfs; \
196 then umount lib/bup/t/testfs || true; fi
197 rm -rf *.tmp *.tmp.meta t/*.tmp lib/*/*/*.tmp build lib/bup/build lib/bup/t/testfs
198 if test -e t/tmp; then t/force-delete t/tmp; fi
199 t/configure-sampledata --clean