]> arthur.barton.de Git - bup.git/blobdiff - GNUmakefile
test_index: don't create an extra writer
[bup.git] / GNUmakefile
index fd4931b7dd881350ad0df8cab1c251b471b23bb4..5c0f72501f0c5f25acaa1b8dce1ee9ac4f020bb1 100644 (file)
@@ -34,14 +34,17 @@ os := $(call shout,$(os),Unable to determine OS)
 
 # Satisfy --warn-undefined-variables
 CFLAGS ?=
+DESTDIR ?=
 CPPFLAGS ?=
 LDFLAGS ?=
 TARGET_ARCH ?=
 
 bup_shared_cflags := -O2 -Wall -Werror -Wformat=2
-bup_shared_cflags := -Wno-unused-command-line-argument $(bup_shared_cflags)
 bup_shared_cflags := -Wno-unknown-pragmas -Wsign-compare $(bup_shared_cflags)
 bup_shared_cflags := -D_FILE_OFFSET_BITS=64 $(bup_shared_cflags)
+bup_shared_cflags := $(bup_config_cflags) $(bup_shared_cflags)
+
+bup_shared_ldflags :=
 
 soext := .so
 ifeq ($(os),CYGWIN)
@@ -66,7 +69,7 @@ config/config.vars: configure config/configure config/configure.inc config/*.in
 # _XOPEN_SOURCE version, i.e. -Werror crashes on a mismatch, so for
 # now, we're just going to let Python's version win.
 
-helpers_cflags := $(bup_python_cflags) $(bup_shared_cflags)
+helpers_cflags := $(bup_python_cflags) $(bup_shared_cflags) -I$(CURDIR)/src
 helpers_ldflags := $(bup_python_ldflags) $(bup_shared_ldflags)
 
 ifneq ($(strip $(bup_readline_cflags)),)
@@ -129,7 +132,8 @@ install: all
        $(INSTALL) -pm 0755 lib/cmd/bup "$(dest_libdir)/cmd/bup"
        $(INSTALL) -pm 0755 $(bup_ext_cmds) "$(dest_libdir)/cmd/"
        cd "$(dest_bindir)" && \
-         ln -sf "$$($(bup_python) -c 'import os; print(os.path.relpath("$(abspath $(dest_libdir))/cmd/bup"))')"
+         ln -sf "$$($(CURDIR)/dev/python -c 'import os; print(os.path.relpath("$(abspath $(dest_libdir))/cmd/bup"))')" \
+           .
        set -e; \
        $(INSTALL) -pm 0644 lib/bup/*.py $(dest_libdir)/bup/
        $(INSTALL) -pm 0644 lib/bup/cmd/*.py $(dest_libdir)/bup/cmd/
@@ -190,7 +194,7 @@ lib/cmd/bup: lib/cmd/bup.c src/bup/compat.c src/bup/io.c
 clean_paths += lib/bup/_helpers$(soext)
 generated_dependencies += lib/bup/_helpers.d
 lib/bup/_helpers$(soext): lib/bup/_helpers.c lib/bup/bupsplit.c
-       $(CC) $(helpers_cflags) $(CFLAGS) -shared -fPIC $^ \
+       $(CC) $(helpers_cflags) $(CFLAGS) $^ \
          $(helpers_ldflags) $(LDFLAGS) $(OUTPUT_OPTION)
 
 test/tmp:
@@ -202,12 +206,16 @@ get_parallel_n = $(patsubst -j%,%,$(parallel_opt))
 maybe_specific_n = $(if $(filter -j%,$(parallel_opt)),-n$(get_parallel_n))
 xdist_opt = $(if $(filter -j,$(parallel_opt)),-nauto,$(maybe_specific_n))
 
-test: all test/tmp dev/python
-        if test yes = "$$(dev/python -c 'import xdist; print("yes")' 2>/dev/null)"; then \
+lint: dev/bup-exec dev/bup-python
+       ./pylint
+
+test: all test/tmp dev/python lint
+       ./bup features
+       if test yes = "$$(dev/python -c 'import xdist; print("yes")' 2>/dev/null)"; then \
           (set -x; ./pytest $(xdist_opt);) \
-        else \
-          (set -x; ./pytest;) \
-        fi
+       else \
+         (set -x; ./pytest;) \
+       fi
 
 stupid:
        PATH=/bin:/usr/bin $(MAKE) test
@@ -227,10 +235,14 @@ long-test: test
 long-check: export BUP_TEST_LEVEL=11
 long-check: check
 
-.PHONY: check-both
-check-both:
+.PHONY: check-py2 check-py3 check-both
+check-py3:
        $(MAKE) clean && BUP_PYTHON_CONFIG=python3-config $(MAKE) check
+check-py2:
        $(MAKE) clean && BUP_PYTHON_CONFIG=python2.7-config $(MAKE) check
+check-both:
+       $(MAKE) check-py3
+       $(MAKE) check-py2
 
 .PHONY: Documentation/all
 Documentation/all: $(man_roff) $(man_html)
@@ -244,11 +256,11 @@ Documentation/substvars: $(bup_deps)
 
 Documentation/%.1: Documentation/%.md Documentation/substvars
        $(pf); sed -f Documentation/substvars $< \
-         | $(PANDOC) -s -r markdown -w man -o $@
+         | "$(PANDOC)" -s -r markdown -w man -o $@
 
 Documentation/%.html: Documentation/%.md Documentation/substvars
        $(pf); sed -f Documentation/substvars $< \
-         | $(PANDOC) -s -r markdown -w html -o $@
+         | "$(PANDOC)" -s -r markdown -w html -o $@
 
 .PHONY: Documentation/clean
 Documentation/clean:
@@ -273,11 +285,8 @@ import-docs: Documentation/clean
 
 clean: Documentation/clean
        cd config && rm -rf finished bin config.var
-       cd config && rm -f \
-         ${CONFIGURE_DETRITUS} ${CONFIGURE_FILES} ${GENERATED_FILES}
-       rm -rf $(clean_paths) .pytest_cache
-       rm -f $(generated_dependencies)
-       find . -name __pycache__ -exec rm -rf {} +
+
+        # Clean up the mounts first, so that find, etc. won't crash later
        if test -e test/mnt; then dev/cleanup-mounts-under test/mnt; fi
        if test -e test/mnt; then rm -r test/mnt; fi
        if test -e test/tmp; then dev/cleanup-mounts-under test/tmp; fi
@@ -285,5 +294,13 @@ clean: Documentation/clean
        if test -e test/int/testfs; \
          then umount test/int/testfs || true; fi
        rm -rf test/int/testfs test/int/testfs.img testfs.img
+
+       cd config && rm -f \
+         ${CONFIGURE_DETRITUS} ${CONFIGURE_FILES} ${GENERATED_FILES}
+       rm -rf $(clean_paths) .pytest_cache
+       rm -f $(generated_dependencies)
+       find . -name __pycache__ -exec rm -rf {} +
+        # Remove this *.pyc cleanup once we drop py2
+       rm -f lib/bup/*.pyc lib/bup/cmd/*.pyc test/__init__.pyc
        if test -e test/tmp; then dev/force-delete test/tmp; fi
        dev/configure-sampledata --clean