mdbx-make: add 'reformat' target.

This commit is contained in:
Leonid Yuriev 2020-05-01 21:20:17 +03:00
parent a2c39f34a0
commit df90263b00
2 changed files with 9 additions and 1 deletions

View File

@ -128,6 +128,14 @@ CXX ?= g++
CXXSTD ?= $(shell $(CXX) -std=c++27 -c test/test.cc -o /dev/null 2>/dev/null && echo -std=c++17 || echo -std=c++11)
CXXFLAGS := $(CXXSTD) $(filter-out -std=gnu11,$(CFLAGS))
TAR ?= $(shell which gnu-tar || echo tar)
CLANG_FORMAT ?= $(shell (which clang-format || which clang-format-8 || which clang-format-9 || which clang-format-10 || which clang-format-11 || which clang-format-12) 2>/dev/null)
reformat:
@if [ -n "$(CLANG_FORMAT)" ]; then \
git ls-files | grep -E '\.(c|cxx|cc|cpp|h|hxx|hpp)(\.in)?$$' | xargs -r $(CLANG_FORMAT) -i --style=file; \
else \
echo "clang-format version 8..12 not found for 'reformat'"; \
fi
MAN_SRCDIR := src/man1/
ALLOY_DEPS := $(wildcard src/*)

View File

@ -1,4 +1,4 @@
all install mdbx tools strip clean test check dist test-singleprocess test-fault memcheck test-valgrind cross-gcc cross-qemu bench bench-quartet clean-bench:
all install mdbx tools strip clean test check dist test-singleprocess test-fault memcheck test-valgrind cross-gcc cross-qemu bench bench-quartet clean-bench reformat:
@CC=$(CC) \
CXX=`if test -n "$(CXX)" && which "$(CXX)" > /dev/null; then echo "$(CXX)"; elif test -n "$(CCC)" && which "$(CCC)" > /dev/null; then echo "$(CCC)"; else echo "c++"; fi` \
`which gmake || which gnumake || echo 'echo "GNU Make is required"; exit 2;'` \