[ovs-dev] [PATCH 13/13] Makefile: Add build-time check for files with initial tabs.

Ben Pfaff blp at ovn.org
Mon Jun 4 21:27:50 UTC 2018


This should make it harder to reintroduce inappropriate indentation.

Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 Makefile.am                     | 15 +++++++++++++++
 build-aux/automake.mk           |  1 +
 build-aux/initial-tab-whitelist | 16 ++++++++++++++++
 3 files changed, 32 insertions(+)
 create mode 100644 build-aux/initial-tab-whitelist

diff --git a/Makefile.am b/Makefile.am
index e34fb3455e3a..e02799a90fab 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -314,6 +314,21 @@ check-echo-n:
 	fi
 .PHONY: check-echo-n
 
+ALL_LOCAL += check-tabs
+check-tabs:
+	@cd $(srcdir); \
+	if test -e .git && (git --version) >/dev/null 2>&1 && \
+	  grep -ln "^	" \
+	    `git ls-files \
+	      | grep -v -f build-aux/initial-tab-whitelist` /dev/null \
+	      | $(EGREP) -v ':[ 	]*/?\*'; \
+	then \
+	  echo "See above for files that use tabs for indentation."; \
+	  echo "Please use spaces instead."; \
+	  exit 1; \
+	fi
+.PHONY: check-tabs
+
 ALL_LOCAL += thread-safety-check
 thread-safety-check:
 	@cd $(srcdir); \
diff --git a/build-aux/automake.mk b/build-aux/automake.mk
index a1f2f856f939..0e3b3a86e240 100644
--- a/build-aux/automake.mk
+++ b/build-aux/automake.mk
@@ -4,6 +4,7 @@ EXTRA_DIST += \
 	build-aux/cksum-schema-check \
 	build-aux/dist-docs \
 	build-aux/dpdkstrip.py \
+	build-aux/initial-tab-whitelist \
 	build-aux/sodepends.py \
 	build-aux/soexpand.py \
 	build-aux/text2c \
diff --git a/build-aux/initial-tab-whitelist b/build-aux/initial-tab-whitelist
new file mode 100644
index 000000000000..cde3ec4f6428
--- /dev/null
+++ b/build-aux/initial-tab-whitelist
@@ -0,0 +1,16 @@
+\.am$
+\.m4$
+\.mk$
+\.png$
+\.sln$
+^datapath/
+^include/linux/
+^include/windows/
+^lib/sflow
+^lib/getopt_long\.c$
+^lib/strsep\.c$
+^third-party/
+^windows/
+^xenserver/
+^debian/rules.modules$
+^debian/rules$
-- 
2.16.1



More information about the dev mailing list