From 7945dd18fa0836c753996745f61af35fe1a1ae08 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Wed, 21 Jul 2010 22:32:02 +0000 Subject: [PATCH] Enhance 'make indent'. - Complete indent(1)'s arguments list; - Ensure files to be indented have no local edit; - Hide indent command-line details. Since everything is static, no need for V=1 support. --- Makefile.am | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 53388b4..1bf98ee 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,7 +21,30 @@ doc : Doxyfile endif if HAS_INDENT -INDENT_ARGS = -br -brs -ce --line-length120 -nut -i2 +INDENT_ARGS = --blank-before-sizeof \ + --blank-lines-after-commas \ + --blank-lines-after-procedures \ + --braces-after-func-def-line \ + --braces-on-if-line \ + --braces-on-struct-decl-line \ + --continue-at-parentheses \ + --cuddle-else \ + --declaration-indentation 8 \ + --indent-level 2 \ + --line-length 120 \ + --no-blank-lines-after-declarations \ + --no-tabs \ + --preprocessor-indentation 2 \ + --procnames-start-lines \ + --space-after-cast \ + --space-after-procedure-calls + indent: - find $(top_srcdir)/libnfc $(top_srcdir)/include $(top_srcdir)/examples -name "*.[hc]" -exec $(INDENT) $(INDENT_ARGS) '{}' ';' + @[ ! -d $(top_srcdir)/.svn ] || \ + [ 0 -eq $$(svn status | grep '\.[hc]$$' | tee /dev/fd/2 | wc -l) ] || \ + ( echo "These files are localy modified. 'commit' or 'reverse' them, then retry." >&2; false ) + @for f in $$(find $(top_srcdir)/libnfc $(top_srcdir)/include $(top_srcdir)/examples -name "*.[hc]"); do \ + echo " INDENT $$f"; \ + $(INDENT) $(INDENT_ARGS) "$$f" || exit 1; \ + done endif