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
102 t/test-split-join.sh \
106 t/test-compression.sh \
108 t/test-index-clear.sh \
109 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$* 2>&1 | tee -a t/tmp/test-log/$$$$.log
132 runtests-cmdline: $(subst t/test,tmp-target-run-test,$(cmdline_tests))
135 PATH=/bin:/usr/bin $(MAKE) test
138 if test -e t/tmp/test-log; then rm -r t/tmp/test-log; fi
139 mkdir -p t/tmp/test-log
140 ./wvtest watch --no-counts \
141 $(MAKE) PYTHON=$(PYTHON) runtests-python runtests-cmdline
142 ./wvtest report t/tmp/test-log/*.log
147 $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
148 $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
150 cmd/bup-%: cmd/%-cmd.py
154 cmd/bup-%: cmd/%-cmd.sh
158 # update the local 'man' and 'html' branches with pregenerated output files, for
159 # people who don't have pandoc (and maybe to aid in google searches or something)
160 export-docs: Documentation/all
161 git update-ref refs/heads/man origin/man '' 2>/dev/null || true
162 git update-ref refs/heads/html origin/html '' 2>/dev/null || true
163 GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
164 rm -f $${GIT_INDEX_FILE} && \
165 git add -f Documentation/*.1 && \
166 git update-ref refs/heads/man \
167 $$(echo "Autogenerated man pages for $$(git describe --always)" \
168 | git commit-tree $$(git write-tree --prefix=Documentation) \
169 -p refs/heads/man) && \
170 rm -f $${GIT_INDEX_FILE} && \
171 git add -f Documentation/*.html && \
172 git update-ref refs/heads/html \
173 $$(echo "Autogenerated html pages for $$(git describe --always)" \
174 | git commit-tree $$(git write-tree --prefix=Documentation) \
177 # push the pregenerated doc files to origin/man and origin/html
178 push-docs: export-docs
179 git push origin man html
181 # import pregenerated doc files from origin/man and origin/html, in case you
182 # don't have pandoc but still want to be able to install the docs.
183 import-docs: Documentation/clean
184 git archive origin/html | (cd Documentation; tar -xvf -)
185 git archive origin/man | (cd Documentation; tar -xvf -)
187 clean: Documentation/clean config/clean
188 rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll lib/*/*.dll *.exe \
189 .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
190 *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
191 bup bup-* cmd/bup-* \
193 testfs.img lib/bup/t/testfs.img
194 if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi
195 if test -e t/mnt; then rm -r t/mnt; fi
196 if test -e t/tmp; then t/cleanup-mounts-under t/tmp; fi
197 # FIXME: migrate these to t/mnt/
198 if test -e lib/bup/t/testfs; \
199 then umount lib/bup/t/testfs || true; fi
200 rm -rf *.tmp *.tmp.meta t/*.tmp lib/*/*/*.tmp build lib/bup/build lib/bup/t/testfs
201 if test -e t/tmp; then t/force-delete t/tmp; fi
202 ./configure-version --clean
203 t/configure-sampledata --clean