1 OS:=$(shell uname | sed 's/[-_].*//')
2 CFLAGS := -Wall -O2 -Werror -Wno-unknown-pragmas $(PYINCLUDE) $(CFLAGS)
3 CFLAGS := -D_FILE_OFFSET_BITS=64 $(CFLAGS)
13 test_tmp := $(CURDIR)/t/tmp
17 all: bup Documentation/all
18 t/configure-sampledata --setup
20 bup: lib/bup/_version.py lib/bup/_helpers$(SOEXT) cmds main.py
23 Documentation/all: bup
28 MANDIR=$(DESTDIR)$(PREFIX)/share/man
29 DOCDIR=$(DESTDIR)$(PREFIX)/share/doc/bup
30 BINDIR=$(DESTDIR)$(PREFIX)/bin
31 LIBDIR=$(DESTDIR)$(PREFIX)/lib/bup
33 $(INSTALL) -d $(MANDIR)/man1 $(DOCDIR) $(BINDIR) \
34 $(LIBDIR)/bup $(LIBDIR)/cmd \
35 $(LIBDIR)/web $(LIBDIR)/web/static
36 [ ! -e Documentation/.docs-available ] || \
40 [ ! -e Documentation/.docs-available ] || \
42 Documentation/*.html \
44 $(INSTALL) -pm 0755 bup $(BINDIR)
66 config/config.h: config/Makefile config/configure config/configure.inc \
67 $(wildcard config/*.in)
68 cd config && $(MAKE) config.h
70 lib/bup/_helpers$(SOEXT): \
72 lib/bup/bupsplit.c lib/bup/_helpers.c lib/bup/csetup.py
75 LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" $(PYTHON) csetup.py build
76 cp lib/bup/build/*/_helpers$(SOEXT) lib/bup/
78 # This must be completely atomic since it may be run (often) in
79 # parallel when "-j" is specified, either via targets here, or via
80 # tests that use an install tree as data.
81 .PHONY: lib/bup/_version.py
84 && ./format-subst.pl $@.pre > $@.tmp-$$$$ \
85 && (if ! test -e $@ || ! cmp $@ $@.tmp-$$$$; then mv $@.tmp-$$$$ $@; fi) \
91 runtests: runtests-python runtests-cmdline
93 runtests-python: all t/tmp
94 TMPDIR="$(test_tmp)" $(PYTHON) wvtest.py t/t*.py lib/*/t/t*.py
100 t/test-compression.sh \
102 t/test-index-clear.sh \
103 t/test-index-check-device.sh \
107 t/test-restore-map-owner.sh \
108 t/test-restore-single-file.sh \
109 t/test-rm-between-index-and-save.sh \
110 t/test-sparse-files.sh \
111 t/test-command-without-init-fails.sh \
112 t/test-redundant-saves.sh \
113 t/test-save-creates-no-unrefs.sh \
114 t/test-save-restore-excludes.sh \
115 t/test-save-strip-graft.sh \
116 t/test-import-duplicity.sh \
117 t/test-import-rdiff-backup.sh \
122 tmp-target-run-test-%: all t/tmp
123 TMPDIR="$(test_tmp)" t/test-$*
125 runtests-cmdline: $(subst t/test-,tmp-target-run-test-,$(cmdline_tests))
128 PATH=/bin:/usr/bin $(MAKE) test
131 ./wvtestrun $(MAKE) PYTHON=$(PYTHON) runtests-python runtests-cmdline
136 $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
137 $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
139 cmd/bup-%: cmd/%-cmd.py
143 cmd/bup-%: cmd/%-cmd.sh
147 # update the local 'man' and 'html' branches with pregenerated output files, for
148 # people who don't have pandoc (and maybe to aid in google searches or something)
149 export-docs: Documentation/all
150 git update-ref refs/heads/man origin/man '' 2>/dev/null || true
151 git update-ref refs/heads/html origin/html '' 2>/dev/null || true
152 GIT_INDEX_FILE=gitindex.tmp; export GIT_INDEX_FILE; \
153 rm -f $${GIT_INDEX_FILE} && \
154 git add -f Documentation/*.1 && \
155 git update-ref refs/heads/man \
156 $$(echo "Autogenerated man pages for $$(git describe --always)" \
157 | git commit-tree $$(git write-tree --prefix=Documentation) \
158 -p refs/heads/man) && \
159 rm -f $${GIT_INDEX_FILE} && \
160 git add -f Documentation/*.html && \
161 git update-ref refs/heads/html \
162 $$(echo "Autogenerated html pages for $$(git describe --always)" \
163 | git commit-tree $$(git write-tree --prefix=Documentation) \
166 # push the pregenerated doc files to origin/man and origin/html
167 push-docs: export-docs
168 git push origin man html
170 # import pregenerated doc files from origin/man and origin/html, in case you
171 # don't have pandoc but still want to be able to install the docs.
172 import-docs: Documentation/clean
173 git archive origin/html | (cd Documentation; tar -xvf -)
174 git archive origin/man | (cd Documentation; tar -xvf -)
176 clean: Documentation/clean config/clean
177 rm -f *.o lib/*/*.o *.so lib/*/*.so *.dll lib/*/*.dll *.exe \
178 .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
179 *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
180 bup bup-* cmd/bup-* \
181 lib/bup/_version.py lib/bup/_version.py.tmp-* \
183 testfs.img lib/bup/t/testfs.img
184 if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi
185 if test -e t/mnt; then rm -r t/mnt; fi
186 if test -e t/tmp; then t/cleanup-mounts-under t/tmp; fi
187 # FIXME: migrate these to t/mnt/
188 if test -e lib/bup/t/testfs; \
189 then umount lib/bup/t/testfs || true; fi
190 rm -rf *.tmp *.tmp.meta t/*.tmp lib/*/*/*.tmp build lib/bup/build lib/bup/t/testfs
191 if test -e t/tmp; then t/force-delete t/tmp; fi
192 t/configure-sampledata --clean