Rework the indent target.

- Check indent is present at ./configure stage;
  - If gindent(1) is installed, use it instead of indent(1);
This commit is contained in:
Romain Tartiere 2010-07-21 13:09:48 +00:00
parent 2688de6500
commit 67fb1330f8
2 changed files with 14 additions and 2 deletions

View file

@ -20,6 +20,8 @@ doc : Doxyfile
.PHONY: doc
endif
INDENT_CMD = indent -br -brs -ce --line-length120 -nut -i2
if HAS_INDENT
INDENT_ARGS = -br -brs -ce --line-length120 -nut -i2
indent:
find $(top_srcdir)/libnfc $(top_srcdir)/include $(top_srcdir)/examples -name "*.[hc]" -exec $(INDENT_CMD) '{}' \;
find $(top_srcdir)/libnfc $(top_srcdir)/include $(top_srcdir)/examples -name "*.[hc]" -exec $(INDENT) $(INDENT_ARGS) '{}' ';'
endif

View file

@ -90,6 +90,16 @@ then
fi
AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
# The indent target require GNU indent
AC_PATH_PROG([INDENT], [indent])
AC_PATH_PROG([GINDENT], [gindent])
if test x"$GINDENT" != x""; then
INDENT="$GINDENT"
fi
AC_SUBST(INDENT)
AM_CONDITIONAL(HAS_INDENT, [test x"$INDENT" != x""])
# Dependencies
PKG_CONFIG_REQUIRES=""