]> arthur.barton.de Git - bup.git/blobdiff - Makefile
Makefile: fix test pattern to include t/test.sh
[bup.git] / Makefile
index a024dbeef1135db8e47f7b5e8c0522847d5b7ebd..c0f1edc821f1d88405033b4fa6f6ca184ed988a9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,7 @@
+
+sampledata_rev := $(shell t/configure-sampledata --revision)
+current_sampledata := t/sampledata/var/rev/v$(sampledata_rev)
+
 OS:=$(shell uname | sed 's/[-_].*//')
 CFLAGS := -Wall -O2 -Werror -Wno-unknown-pragmas $(PYINCLUDE) $(CFLAGS)
 CFLAGS := -D_FILE_OFFSET_BITS=64 $(CFLAGS)
@@ -13,14 +17,18 @@ else
   test_tmp := $(CURDIR)/t/tmp
 endif
 
-.PHONY: all
-all: bup Documentation/all
-       t/configure-sampledata --setup
+initial_setup := $(shell ./configure-version --update)
+bup_deps := bup lib/bup/_version.py lib/bup/_helpers$(SOEXT) cmds
 
-bup: lib/bup/_version.py lib/bup/_helpers$(SOEXT) cmds main.py
-       ln -sf main.py bup
+all: $(bup_deps) Documentation/all $(current_sampledata)
 
-Documentation/all: bup
+bup:
+       ln -s main.py bup
+
+Documentation/all: $(bup_deps)
+
+$(current_sampledata):
+       t/configure-sampledata --setup
 
 INSTALL=install
 PYTHON=python
@@ -75,15 +83,10 @@ lib/bup/_helpers$(SOEXT): \
        LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" $(PYTHON) csetup.py build
        cp lib/bup/build/*/_helpers$(SOEXT) lib/bup/
 
-# This must be completely atomic since it may be run (often) in
-# parallel when "-j" is specified, either via targets here, or via
-# tests that use an install tree as data.
-.PHONY: lib/bup/_version.py
 lib/bup/_version.py:
-       rm -f $@.tmp-$$$$ \
-       && ./format-subst.pl $@.pre > $@.tmp-$$$$ \
-       && (if ! test -e $@ || ! cmp $@ $@.tmp-$$$$; then mv $@.tmp-$$$$ $@; fi) \
-       && rm -f $@.tmp-$$$$
+       @echo "Something has gone wrong; $@ should already exist."
+       @echo 'Check "./configure-version --update"'
+       @false
 
 t/tmp:
        mkdir t/tmp
@@ -119,8 +122,8 @@ cmdline_tests := \
   t/test.sh
 
 # For parallel runs.
-tmp-target-run-test-%: all t/tmp
-       TMPDIR="$(test_tmp)" t/test-$*
+tmp-target-run-test%: all t/tmp
+       TMPDIR="$(test_tmp)" t/test$*
 
 runtests-cmdline: $(subst t/test-,tmp-target-run-test-,$(cmdline_tests))
 
@@ -178,7 +181,6 @@ clean: Documentation/clean config/clean
                .*~ *~ */*~ lib/*/*~ lib/*/*/*~ \
                *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \
                bup bup-* cmd/bup-* \
-               lib/bup/_version.py lib/bup/_version.py.tmp-* \
                randomgen memtest \
                testfs.img lib/bup/t/testfs.img
        if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi
@@ -189,4 +191,5 @@ clean: Documentation/clean config/clean
          then umount lib/bup/t/testfs || true; fi
        rm -rf *.tmp *.tmp.meta t/*.tmp lib/*/*/*.tmp build lib/bup/build lib/bup/t/testfs
        if test -e t/tmp; then t/force-delete t/tmp; fi
+       ./configure-version --clean
        t/configure-sampledata --clean