5 sampledata_rev := $(shell t/configure-sampledata --revision)
6 current_sampledata := t/sampledata/var/rev/v$(sampledata_rev)
8 OS:=$(shell uname | sed 's/[-_].*//')
9 CFLAGS := -Wall -O2 -Werror -Wno-unknown-pragmas $(PYINCLUDE) $(CFLAGS)
10 CFLAGS := -D_FILE_OFFSET_BITS=64 $(CFLAGS)
20 test_tmp := $(CURDIR)/t/tmp
23 initial_setup := $(shell ./configure-version --update)
24 bup_deps := bup lib/bup/_version.py lib/bup/_helpers$(SOEXT) cmds
26 all: $(bup_deps) Documentation/all $(current_sampledata)
31 Documentation/all: $(bup_deps)
33 $(current_sampledata):
34 t/configure-sampledata --setup
36 PYTHON = $(shell cmd/bup-python -c 'import sys; print sys.executable')
38 define install-python-bin
40 sed -e '1 s|.*|#!$(PYTHON)|; 2,/^# end of bup preamble$$/d' $1 > $2; \
46 MANDIR=$(DESTDIR)$(PREFIX)/share/man
47 DOCDIR=$(DESTDIR)$(PREFIX)/share/doc/bup
48 BINDIR=$(DESTDIR)$(PREFIX)/bin
49 LIBDIR=$(DESTDIR)$(PREFIX)/lib/bup
51 $(INSTALL) -d $(MANDIR)/man1 $(DOCDIR) $(BINDIR) \
52 $(LIBDIR)/bup $(LIBDIR)/cmd \
53 $(LIBDIR)/web $(LIBDIR)/web/static
54 [ ! -e Documentation/.docs-available ] || \
58 [ ! -e Documentation/.docs-available ] || \
60 Documentation/*.html \
62 $(call install-python-bin,bup,"$(BINDIR)/bup")
64 for cmd in $$(ls cmd/bup-* | grep -v cmd/bup-python); do \
65 $(call install-python-bin,"$$cmd","$(LIBDIR)/$$cmd") \
85 config/config.h: config/Makefile config/configure config/configure.inc \
86 $(wildcard config/*.in)
87 cd config && $(MAKE) config.h
89 lib/bup/_helpers$(SOEXT): \
91 lib/bup/bupsplit.c lib/bup/_helpers.c lib/bup/csetup.py
94 LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" $(PYTHON) csetup.py build
95 cp lib/bup/build/*/_helpers$(SOEXT) lib/bup/
98 @echo "Something has gone wrong; $@ should already exist."
99 @echo 'Check "./configure-version --update"'
105 runtests: runtests-python runtests-cmdline
107 runtests-python: all t/tmp
108 $(pf); TMPDIR="$(test_tmp)" \
109 $(PYTHON) wvtest.py t/t*.py lib/*/t/t*.py 2>&1 \
110 | tee -a t/tmp/test-log/$$$$.log
114 t/test-split-join.sh \
118 t/test-compression.sh \
120 t/test-index-clear.sh \
121 t/test-index-check-device.sh \
126 t/test-restore-map-owner.sh \
127 t/test-restore-single-file.sh \
128 t/test-rm-between-index-and-save.sh \
129 t/test-sparse-files.sh \
130 t/test-command-without-init-fails.sh \
131 t/test-redundant-saves.sh \
132 t/test-save-creates-no-unrefs.sh \
133 t/test-save-restore-excludes.sh \
134 t/test-save-strip-graft.sh \
135 t/test-import-duplicity.sh \
136 t/test-import-rdiff-backup.sh \
141 tmp-target-run-test%: all t/tmp
142 $(pf); TMPDIR="$(test_tmp)" \
143 t/test$* 2>&1 | tee -a t/tmp/test-log/$$$$.log
145 runtests-cmdline: $(subst t/test,tmp-target-run-test,$(cmdline_tests))
148 PATH=/bin:/usr/bin $(MAKE) test
151 if test -e t/tmp/test-log; then rm -r t/tmp/test-log; fi
152 mkdir -p t/tmp/test-log
153 ./wvtest watch --no-counts \
154 $(MAKE) PYTHON=$(PYTHON) runtests-python runtests-cmdline
155 ./wvtest report t/tmp/test-log/*.log
159 cmd/python-cmd.sh: config/configure config/configure.inc
163 $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
164 $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
166 cmd/bup-%: cmd/%-cmd.py
170 cmd/bup-%: cmd/%-cmd.sh
174 # update the local 'man' and 'html' branches with pregenerated output files, for
175 # people who don't have pandoc (and maybe to aid in google searches or something)
176 export-docs: Documentation/all
177 git update-ref refs/heads/man origin/man '' 2>/dev/null || true
178 git update-ref refs/heads/html origin/html '' 2>/dev/null || true
180 GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
181 rm -f $${GIT_INDEX_FILE} && \
182 git add -f Documentation/*.1 && \
183 git update-ref refs/heads/man \
184 $$(echo "Autogenerated man pages for $$(git describe --always)" \
185 | git commit-tree $$(git write-tree --prefix=Documentation) \
186 -p refs/heads/man) && \
187 rm -f $${GIT_INDEX_FILE} && \
188 git add -f Documentation/*.html && \
189 git update-ref refs/heads/html \
190 $$(echo "Autogenerated html pages for $$(git describe --always)" \
191 | git commit-tree $$(git write-tree --prefix=Documentation) \
194 # push the pregenerated doc files to origin/man and origin/html
195 push-docs: export-docs
196 git push origin man html
198 # import pregenerated doc files from origin/man and origin/html, in case you
199 # don't have pandoc but still want to be able to install the docs.
200 import-docs: Documentation/clean
201 $(pf); git archive origin/html | (cd Documentation && tar -xvf -)
202 $(pf); git archive origin/man | (cd Documentation && tar -xvf -)
204 clean: Documentation/clean config/clean
205 rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll lib/*/*.dll *.exe \
206 .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
207 *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
208 bup bup-* cmd/bup-* \
211 testfs.img lib/bup/t/testfs.img
212 if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi
213 if test -e t/mnt; then rm -r t/mnt; fi
214 if test -e t/tmp; then t/cleanup-mounts-under t/tmp; fi
215 # FIXME: migrate these to t/mnt/
216 if test -e lib/bup/t/testfs; \
217 then umount lib/bup/t/testfs || true; fi
218 rm -rf *.tmp *.tmp.meta t/*.tmp lib/*/*/*.tmp build lib/bup/build lib/bup/t/testfs
219 if test -e t/tmp; then t/force-delete t/tmp; fi
220 ./configure-version --clean
221 t/configure-sampledata --clean