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
36 MANDIR=$(DESTDIR)$(PREFIX)/share/man
37 DOCDIR=$(DESTDIR)$(PREFIX)/share/doc/bup
38 BINDIR=$(DESTDIR)$(PREFIX)/bin
39 LIBDIR=$(DESTDIR)$(PREFIX)/lib/bup
41 $(INSTALL) -d $(MANDIR)/man1 $(DOCDIR) $(BINDIR) \
42 $(LIBDIR)/bup $(LIBDIR)/cmd \
43 $(LIBDIR)/web $(LIBDIR)/web/static
44 [ ! -e Documentation/.docs-available ] || \
48 [ ! -e Documentation/.docs-available ] || \
50 Documentation/*.html \
52 $(INSTALL) -pm 0755 bup $(BINDIR)
74 config/config.h: config/Makefile config/configure config/configure.inc \
75 $(wildcard config/*.in)
76 cd config && $(MAKE) config.h
78 lib/bup/_helpers$(SOEXT): \
80 lib/bup/bupsplit.c lib/bup/_helpers.c lib/bup/csetup.py
83 LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" $(PYTHON) csetup.py build
84 cp lib/bup/build/*/_helpers$(SOEXT) lib/bup/
87 @echo "Something has gone wrong; $@ should already exist."
88 @echo 'Check "./configure-version --update"'
94 runtests: runtests-python runtests-cmdline
96 runtests-python: all t/tmp
97 TMPDIR="$(test_tmp)" $(PYTHON) wvtest.py t/t*.py lib/*/t/t*.py
103 t/test-compression.sh \
105 t/test-index-clear.sh \
106 t/test-index-check-device.sh \
110 t/test-restore-map-owner.sh \
111 t/test-restore-single-file.sh \
112 t/test-rm-between-index-and-save.sh \
113 t/test-sparse-files.sh \
114 t/test-command-without-init-fails.sh \
115 t/test-redundant-saves.sh \
116 t/test-save-creates-no-unrefs.sh \
117 t/test-save-restore-excludes.sh \
118 t/test-save-strip-graft.sh \
119 t/test-import-duplicity.sh \
120 t/test-import-rdiff-backup.sh \
125 tmp-target-run-test%: all t/tmp
126 TMPDIR="$(test_tmp)" t/test$*
128 runtests-cmdline: $(subst t/test,tmp-target-run-test,$(cmdline_tests))
131 PATH=/bin:/usr/bin $(MAKE) test
134 ./wvtestrun $(MAKE) PYTHON=$(PYTHON) runtests-python runtests-cmdline
139 $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
140 $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
142 cmd/bup-%: cmd/%-cmd.py
146 cmd/bup-%: cmd/%-cmd.sh
150 # update the local 'man' and 'html' branches with pregenerated output files, for
151 # people who don't have pandoc (and maybe to aid in google searches or something)
152 export-docs: Documentation/all
153 git update-ref refs/heads/man origin/man '' 2>/dev/null || true
154 git update-ref refs/heads/html origin/html '' 2>/dev/null || true
155 GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
156 rm -f $${GIT_INDEX_FILE} && \
157 git add -f Documentation/*.1 && \
158 git update-ref refs/heads/man \
159 $$(echo "Autogenerated man pages for $$(git describe --always)" \
160 | git commit-tree $$(git write-tree --prefix=Documentation) \
161 -p refs/heads/man) && \
162 rm -f $${GIT_INDEX_FILE} && \
163 git add -f Documentation/*.html && \
164 git update-ref refs/heads/html \
165 $$(echo "Autogenerated html pages for $$(git describe --always)" \
166 | git commit-tree $$(git write-tree --prefix=Documentation) \
169 # push the pregenerated doc files to origin/man and origin/html
170 push-docs: export-docs
171 git push origin man html
173 # import pregenerated doc files from origin/man and origin/html, in case you
174 # don't have pandoc but still want to be able to install the docs.
175 import-docs: Documentation/clean
176 git archive origin/html | (cd Documentation; tar -xvf -)
177 git archive origin/man | (cd Documentation; tar -xvf -)
179 clean: Documentation/clean config/clean
180 rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll lib/*/*.dll *.exe \
181 .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
182 *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
183 bup bup-* cmd/bup-* \
185 testfs.img lib/bup/t/testfs.img
186 if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi
187 if test -e t/mnt; then rm -r t/mnt; fi
188 if test -e t/tmp; then t/cleanup-mounts-under t/tmp; fi
189 # FIXME: migrate these to t/mnt/
190 if test -e lib/bup/t/testfs; \
191 then umount lib/bup/t/testfs || true; fi
192 rm -rf *.tmp *.tmp.meta t/*.tmp lib/*/*/*.tmp build lib/bup/build lib/bup/t/testfs
193 if test -e t/tmp; then t/force-delete t/tmp; fi
194 ./configure-version --clean
195 t/configure-sampledata --clean