[sheepdog] [PATCH v2] Makefile: add target to check coding style

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri Feb 8 07:17:14 CET 2013


This enables us to run checkpatch.pl against all the source files with
'make check-style'.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
Changes from v1:
 rename CHECK_SYNTAX to CHECK_STYLE


 Makefile.am         |    6 ++++++
 collie/Makefile.am  |    3 +++
 include/Makefile.am |    3 +++
 lib/Makefile.am     |    3 +++
 sheep/Makefile.am   |    3 +++
 sheepfs/Makefile.am |    3 +++
 6 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4149ec8..bec8c9a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -74,3 +74,9 @@ CGCC_CFLAGS=-Wbitwise -Wno-return-void $(ARCH) -fno-common
 sparse: ARCH=$(shell sh script/checkarch.sh)
 sparse:
 	$(MAKE) CC=$(CGCC) CFLAGS="$(CFLAGS) $(CGCC_CFLAGS)"
+
+CHECK_STYLE=../script/checkpatch.pl -f --no-summary --terse
+check-style:
+	@for dir in lib collie sheep include sheepfs; do \
+		make -C $$dir check-style CHECK_STYLE="$(CHECK_STYLE)"; \
+	done
diff --git a/collie/Makefile.am b/collie/Makefile.am
index 386ee24..386aa49 100644
--- a/collie/Makefile.am
+++ b/collie/Makefile.am
@@ -46,3 +46,6 @@ clean-local:
 # support for GNU Flymake
 check-syntax:
 	$(COMPILE) -fsyntax-only $(CHK_SOURCES)
+
+check-style:
+	@$(CHECK_STYLE) $(collie_SOURCES) $(noinst_HEADERS)
diff --git a/include/Makefile.am b/include/Makefile.am
index 6413047..f8f0486 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -3,3 +3,6 @@ MAINTAINERCLEANFILES    = Makefile.in config.h.in
 noinst_HEADERS          = bitops.h event.h logger.h sheepdog_proto.h util.h \
 			  list.h net.h sheep.h exits.h strbuf.h rbtree.h \
 			  sha1.h option.h internal_proto.h
+
+check-style:
+	@$(CHECK_STYLE) $(noinst_HEADERS)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 8ee6cf2..7d4f93a 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -10,3 +10,6 @@ libsheepdog_a_SOURCES	= event.c logger.c net.c util.c rbtree.c strbuf.c \
 # support for GNU Flymake
 check-syntax:
 	$(COMPILE) -fsyntax-only $(CHK_SOURCES)
+
+check-style:
+	@$(CHECK_STYLE) $(libsheepdog_a_SOURCES)
diff --git a/sheep/Makefile.am b/sheep/Makefile.am
index 64b56d9..a1f564c 100644
--- a/sheep/Makefile.am
+++ b/sheep/Makefile.am
@@ -60,3 +60,6 @@ clean-local:
 # support for GNU Flymake
 check-syntax:
 	$(COMPILE) -fsyntax-only $(CHK_SOURCES)
+
+check-style:
+	@$(CHECK_STYLE) $(sheep_SOURCES) $(noinst_HEADERS)
\ No newline at end of file
diff --git a/sheepfs/Makefile.am b/sheepfs/Makefile.am
index 803cf02..10b8c3b 100644
--- a/sheepfs/Makefile.am
+++ b/sheepfs/Makefile.am
@@ -42,3 +42,6 @@ clean-local:
 # support for GNU Flymake
 check-syntax:
 	$(COMPILE) -fsyntax-only $(CHK_SOURCES)
+
+check-style:
+	@$(CHECK_STYLE) $(sheepfs_SOURCES) $(noinst_HEADERS)
-- 
1.7.2.5




More information about the sheepdog mailing list