From d14fc142df1a4f7f486b623fe7a82eac18befe78 Mon Sep 17 00:00:00 2001 From: Rick Altherr Date: Mon, 8 Jan 2018 13:44:26 -0800 Subject: [PATCH] Makefile: target to format source code Signed-off-by: Rick Altherr --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 6cde83dc..b5b0e459 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,13 @@ JOBS ?= $(shell nproc) JOBS ?= 2 +CLANG_FORMAT ?= clang-format go: git submodule update --init --recursive mkdir -p build cd build; cmake ..; make -j$(JOBS) + +format: + find . -name \*.cc -and -not -path './third_party/*' -exec $(CLANG_FORMAT) -style=file -i {} \; + find . -name \*.h -and -not -path './third_party/*' -exec $(CLANG_FORMAT) -style=file -i {} \; + find . -name \*.py -and -not -path './third_party/*' -exec autopep8 -i {} \;