summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--ChangeLog4
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac7
4 files changed, 17 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 6842f759f..955c97d36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,8 +61,8 @@ doc/tutorial/gversion.texi
# top-level symlink can exist
.clang-format
-
uncrustify.cfg
+.style.yapf
# this exists outside of the main repository
cmake/
diff --git a/ChangeLog b/ChangeLog
index 76a4680ea..315c869e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Oct 14 00:00:00 UTC 2019
+ Add 'pretty' make rule to run uncrustify over the source tree.
+ -ng0
+
Mon Sep 16 00:00:00 UTC 2019
Remove checks for CXX and CPP. Scans found no
(remaining) cxx code. ccache with clang on
diff --git a/Makefile.am b/Makefile.am
index d69dd3a82..e8bd98da1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,3 +38,8 @@ docdir = $(datadir)/doc/gnunet/
doc_DATA = COPYING README
ACLOCAL_AMFLAGS = -I m4
+
+if HAVE_UNCRUSTIFY_BINARY
+pretty:
+ find $(top_srcdir) -type f -name '*.c' -or -name '*.h' -print0 | xargs -0 uncrustify -c $(top_srcdir)/contrib/uncrustify.cfg --replace --no-backup 2>&1 || true
+endif
diff --git a/configure.ac b/configure.ac
index 7af7e83df..5ca5f55d1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -313,6 +313,13 @@ 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
+# TODO: maybe add flag to pass location
+AC_CHECK_PROG(UNCRUSTIFY_BINARY, uncrustify, true)
+AM_CONDITIONAL(HAVE_UNCRUSTIFY_BINARY, $UNCRUSTIFY_BINARY)
+
+
AC_CHECK_MEMBER(struct tm.tm_gmtoff,
[AC_DEFINE(HAVE_TM_GMTOFF, 1,
[Define if struct tm has the tm_gmtoff member.])],