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 2>&1 \
98 | tee -a t/tmp/test-log/$$$$.log
104 t/test-compression.sh \
106 t/test-index-clear.sh \
107 t/test-index-check-device.sh \
111 t/test-restore-map-owner.sh \
112 t/test-restore-single-file.sh \
113 t/test-rm-between-index-and-save.sh \
114 t/test-sparse-files.sh \
115 t/test-command-without-init-fails.sh \
116 t/test-redundant-saves.sh \
117 t/test-save-creates-no-unrefs.sh \
118 t/test-save-restore-excludes.sh \
119 t/test-save-strip-graft.sh \
120 t/test-import-duplicity.sh \
121 t/test-import-rdiff-backup.sh \
126 tmp-target-run-test%: all t/tmp
127 TMPDIR="$(test_tmp)" t/test$* 2>&1 | tee -a t/tmp/test-log/$$$$.log
129 runtests-cmdline: $(subst t/test,tmp-target-run-test,$(cmdline_tests))
132 PATH=/bin:/usr/bin $(MAKE) test
135 if test -e t/tmp/test-log; then rm -r t/tmp/test-log; fi
136 mkdir -p t/tmp/test-log
137 ./wvtest watch --no-counts \
138 $(MAKE) PYTHON=$(PYTHON) runtests-python runtests-cmdline
139 ./wvtest report t/tmp/test-log/*.log
144 $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
145 $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
147 cmd/bup-%: cmd/%-cmd.py
151 cmd/bup-%: cmd/%-cmd.sh
155 # update the local 'man' and 'html' branches with pregenerated output files, for
156 # people who don't have pandoc (and maybe to aid in google searches or something)
157 export-docs: Documentation/all
158 git update-ref refs/heads/man origin/man '' 2>/dev/null || true
159 git update-ref refs/heads/html origin/html '' 2>/dev/null || true
160 GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
161 rm -f $${GIT_INDEX_FILE} && \
162 git add -f Documentation/*.1 && \
163 git update-ref refs/heads/man \
164 $$(echo "Autogenerated man pages for $$(git describe --always)" \
165 | git commit-tree $$(git write-tree --prefix=Documentation) \
166 -p refs/heads/man) && \
167 rm -f $${GIT_INDEX_FILE} && \
168 git add -f Documentation/*.html && \
169 git update-ref refs/heads/html \
170 $$(echo "Autogenerated html pages for $$(git describe --always)" \
171 | git commit-tree $$(git write-tree --prefix=Documentation) \
174 # push the pregenerated doc files to origin/man and origin/html
175 push-docs: export-docs
176 git push origin man html
178 # import pregenerated doc files from origin/man and origin/html, in case you
179 # don't have pandoc but still want to be able to install the docs.
180 import-docs: Documentation/clean
181 git archive origin/html | (cd Documentation; tar -xvf -)
182 git archive origin/man | (cd Documentation; tar -xvf -)
184 clean: Documentation/clean config/clean
185 rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll lib/*/*.dll *.exe \
186 .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
187 *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
188 bup bup-* cmd/bup-* \
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 ./configure-version --clean
200 t/configure-sampledata --clean