'make pretty' rule using uncrustify, detect uncrustify in configure script.
authorng0 <ng0@n0.is>
Mon, 14 Oct 2019 12:10:35 +0000 (12:10 +0000)
committerng0 <ng0@n0.is>
Mon, 14 Oct 2019 12:10:35 +0000 (12:10 +0000)
closes #5904

Makefile.am
configure.ac

index d69dd3a8232abe8dc00a7d167785407572a66e70..f2b48b35875bb24619149e8daca38aa34f326d47 100644 (file)
@@ -38,3 +38,8 @@ docdir = $(datadir)/doc/gnunet/
 doc_DATA = COPYING README
 
 ACLOCAL_AMFLAGS = -I m4
+
+if HAVE_UNCRUSTIFY
+pretty:
+       find $(top_srcdir) -type f ! -path '*/.*' ! -path '*/_*' -name '*.c' -name '*.h' -print0 | xargs -0 uncrustify -c $(top_srcdir) --replace --no-backup 2>&1 || true
+endif
index 7af7e83df2568a7f4024a307eaa054420d7d5376..e486a893daa07349ad8e9173a8e11f0c6031fa27 100644 (file)
@@ -313,6 +313,15 @@ AS_IF([test x"$VAR_UPNPC_BINARY" != x"false"],
   [AC_DEFINE_UNQUOTED([UPNPC], "$VAR_UPNPC_BINARY", [Path to upnpc binary])],
   [AC_MSG_WARN([warning: 'upnpc' binary not found.])])
 
+
+# uncrustify
+AC_PATH_TARGET_TOOL(VAR_UNCRUSTIFY_BINARY, uncrustify, false)
+
+AS_IF([test x"$VAR_UNCRUSTIFY_BINARY" != x"false"],
+  [AC_DEFINE_UNQUOTED([HAVE_UNCRUSTIFY], "$VAR_UNCRUSTIFY_BINARY", [Path to uncrustify binary])],
+  [AC_MSG_WARN([warning: 'uncrustify' binary not found.])])
+
+
 AC_CHECK_MEMBER(struct tm.tm_gmtoff,
   [AC_DEFINE(HAVE_TM_GMTOFF, 1,
      [Define if struct tm has the tm_gmtoff member.])],