From 7717d233cfdf0b3c59f62cd6bf86e3b4261dcbf8 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 4 Jun 2018 14:16:40 -0700 Subject: [PATCH] Makefile: Add build-time check for files with initial tabs. This should make it harder to reintroduce inappropriate indentation. Signed-off-by: Ben Pfaff Acked-by: Justin Pettit --- 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 e34fb3455e..e02799a90f 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 3a3b31ce12..9007ecda9c 100644 --- a/build-aux/automake.mk +++ b/build-aux/automake.mk @@ -5,6 +5,7 @@ EXTRA_DIST += \ build-aux/dist-docs \ build-aux/dpdkstrip.py \ build-aux/generate-dhparams-c \ + 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 0000000000..cde3ec4f64 --- /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$