6 && echo " ok" || echo " no"
9 # If ok, strip trailing " ok" and return the output, otherwise, error
11 $(if $(subst ok,,$(lastword $(1))),$(error $(2)),$(shell x="$(1)"; echo $${x%???}))
14 sampledata_rev := $(shell t/configure-sampledata --revision $(isok))
16 $(call shout,$(sampledata_rev),Could not parse sampledata revision)
18 current_sampledata := t/sampledata/var/rev/v$(sampledata_rev)
20 os := $(shell ($(pf); uname | sed 's/[-_].*//') $(isok))
21 os := $(call shout,$(os),Unable to determine OS)
23 CFLAGS := -Wall -O2 -Werror -Wno-unknown-pragmas $(PYINCLUDE) $(CFLAGS)
24 CFLAGS := -D_FILE_OFFSET_BITS=64 $(CFLAGS)
34 test_tmp := $(CURDIR)/t/tmp
37 initial_setup := $(shell ./configure-version --update $(isok))
38 initial_setup := $(call shout,$(initial_setup),Version configuration failed))
40 bup_deps := bup lib/bup/_version.py lib/bup/_helpers$(SOEXT) cmds
42 all: $(bup_deps) Documentation/all $(current_sampledata)
47 Documentation/all: $(bup_deps)
49 $(current_sampledata):
50 t/configure-sampledata --setup
52 # This needs to be a delayed assignment
53 PYTHON = $(shell cmd/bup-python -c 'import sys; print sys.executable')
55 define install-python-bin
57 sed -e '1 s|.*|#!$(PYTHON)|; 2,/^# end of bup preamble$$/d' $1 > $2; \
63 MANDIR=$(DESTDIR)$(PREFIX)/share/man
64 DOCDIR=$(DESTDIR)$(PREFIX)/share/doc/bup
65 BINDIR=$(DESTDIR)$(PREFIX)/bin
66 LIBDIR=$(DESTDIR)$(PREFIX)/lib/bup
68 $(INSTALL) -d $(MANDIR)/man1 $(DOCDIR) $(BINDIR) \
69 $(LIBDIR)/bup $(LIBDIR)/cmd \
70 $(LIBDIR)/web $(LIBDIR)/web/static
71 [ ! -e Documentation/.docs-available ] || \
75 [ ! -e Documentation/.docs-available ] || \
77 Documentation/*.html \
79 $(call install-python-bin,bup,"$(BINDIR)/bup")
81 for cmd in $$(ls cmd/bup-* | grep -v cmd/bup-python); do \
82 $(call install-python-bin,"$$cmd","$(LIBDIR)/$$cmd") \
102 config/config.h: config/Makefile config/configure config/configure.inc \
103 $(wildcard config/*.in)
104 cd config && $(MAKE) config.h
106 lib/bup/_helpers$(SOEXT): \
108 lib/bup/bupsplit.c lib/bup/_helpers.c lib/bup/csetup.py
111 LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" $(PYTHON) csetup.py build
112 cp lib/bup/build/*/_helpers$(SOEXT) lib/bup/
115 @echo "Something has gone wrong; $@ should already exist."
116 @echo 'Check "./configure-version --update"'
122 runtests: runtests-python runtests-cmdline
124 # The "pwd -P" here may not be appropriate in the long run, but we
125 # need it until we settle the relevant drecurse/exclusion questions:
126 # https://groups.google.com/forum/#!topic/bup-list/9ke-Mbp10Q0
127 runtests-python: all t/tmp
128 $(pf); cd $$(pwd -P); TMPDIR="$(test_tmp)" \
129 $(PYTHON) wvtest.py t/t*.py lib/*/t/t*.py 2>&1 \
130 | tee -a t/tmp/test-log/$$$$.log
134 t/test-split-join.sh \
138 t/test-compression.sh \
140 t/test-index-clear.sh \
141 t/test-index-check-device.sh \
146 t/test-restore-map-owner.sh \
147 t/test-restore-single-file.sh \
148 t/test-rm-between-index-and-save.sh \
149 t/test-sparse-files.sh \
150 t/test-command-without-init-fails.sh \
151 t/test-redundant-saves.sh \
152 t/test-save-creates-no-unrefs.sh \
153 t/test-save-restore-excludes.sh \
154 t/test-save-strip-graft.sh \
155 t/test-import-duplicity.sh \
156 t/test-import-rdiff-backup.sh \
161 # The "pwd -P" here may not be appropriate in the long run, but we
162 # need it until we settle the relevant drecurse/exclusion questions:
163 # https://groups.google.com/forum/#!topic/bup-list/9ke-Mbp10Q0
164 tmp-target-run-test%: all t/tmp
165 $(pf); cd $$(pwd -P); TMPDIR="$(test_tmp)" \
166 t/test$* 2>&1 | tee -a t/tmp/test-log/$$$$.log
168 runtests-cmdline: $(subst t/test,tmp-target-run-test,$(cmdline_tests))
171 PATH=/bin:/usr/bin $(MAKE) test
174 if test -e t/tmp/test-log; then rm -r t/tmp/test-log; fi
175 mkdir -p t/tmp/test-log
176 ./wvtest watch --no-counts \
177 $(MAKE) PYTHON=$(PYTHON) runtests-python runtests-cmdline
178 ./wvtest report t/tmp/test-log/*.log
182 cmd/python-cmd.sh: config/configure config/configure.inc
186 $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
187 $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
189 cmd/bup-%: cmd/%-cmd.py
193 cmd/bup-%: cmd/%-cmd.sh
197 # update the local 'man' and 'html' branches with pregenerated output files, for
198 # people who don't have pandoc (and maybe to aid in google searches or something)
199 export-docs: Documentation/all
200 git update-ref refs/heads/man origin/man '' 2>/dev/null || true
201 git update-ref refs/heads/html origin/html '' 2>/dev/null || true
203 GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
204 rm -f $${GIT_INDEX_FILE} && \
205 git add -f Documentation/*.1 && \
206 git update-ref refs/heads/man \
207 $$(echo "Autogenerated man pages for $$(git describe --always)" \
208 | git commit-tree $$(git write-tree --prefix=Documentation) \
209 -p refs/heads/man) && \
210 rm -f $${GIT_INDEX_FILE} && \
211 git add -f Documentation/*.html && \
212 git update-ref refs/heads/html \
213 $$(echo "Autogenerated html pages for $$(git describe --always)" \
214 | git commit-tree $$(git write-tree --prefix=Documentation) \
217 # push the pregenerated doc files to origin/man and origin/html
218 push-docs: export-docs
219 git push origin man html
221 # import pregenerated doc files from origin/man and origin/html, in case you
222 # don't have pandoc but still want to be able to install the docs.
223 import-docs: Documentation/clean
224 $(pf); git archive origin/html | (cd Documentation && tar -xvf -)
225 $(pf); git archive origin/man | (cd Documentation && tar -xvf -)
227 clean: Documentation/clean config/clean
228 rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll lib/*/*.dll *.exe \
229 .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
230 *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
231 bup bup-* cmd/bup-* \
234 testfs.img lib/bup/t/testfs.img
235 if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi
236 if test -e t/mnt; then rm -r t/mnt; fi
237 if test -e t/tmp; then t/cleanup-mounts-under t/tmp; fi
238 # FIXME: migrate these to t/mnt/
239 if test -e lib/bup/t/testfs; \
240 then umount lib/bup/t/testfs || true; fi
241 rm -rf *.tmp *.tmp.meta t/*.tmp lib/*/*/*.tmp build lib/bup/build lib/bup/t/testfs
242 if test -e t/tmp; then t/force-delete t/tmp; fi
243 ./configure-version --clean
244 t/configure-sampledata --clean