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

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri Feb 8 06:43:59 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>
---
 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..cedc250 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_SYNTAX=../script/checkpatch.pl -f --no-summary --terse
+check-style:
+	@for dir in lib collie sheep include sheepfs; do \
+		make -C $$dir check-style CHECK_SYNTAX="$(CHECK_SYNTAX)"; \
+	done
diff --git a/collie/Makefile.am b/collie/Makefile.am
index 386ee24..c1cac3c 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_SYNTAX) $(collie_SOURCES) $(noinst_HEADERS)
diff --git a/include/Makefile.am b/include/Makefile.am
index 6413047..9ab3193 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_SYNTAX) $(noinst_HEADERS)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 8ee6cf2..f39b519 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_SYNTAX) $(libsheepdog_a_SOURCES)
diff --git a/sheep/Makefile.am b/sheep/Makefile.am
index 64b56d9..f1efeeb 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_SYNTAX) $(sheep_SOURCES) $(noinst_HEADERS)
\ No newline at end of file
diff --git a/sheepfs/Makefile.am b/sheepfs/Makefile.am
index 803cf02..55814c7 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_SYNTAX) $(sheepfs_SOURCES) $(noinst_HEADERS)
-- 
1.7.2.5




More information about the sheepdog mailing list