From f6ae9357704950b4121ac4dc194d53363af34238 Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Thu, 2 Jul 2009 17:44:33 -0400 Subject: [PATCH] [#1777] Add code indentation/formatting in the buil system --- astylerc | 15 +++++++++++++++ sflphone-common/Makefile.am | 12 +++++++++++- sflphone-common/globals.mak | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 astylerc diff --git a/astylerc b/astylerc new file mode 100644 index 0000000000..14177d0fa0 --- /dev/null +++ b/astylerc @@ -0,0 +1,15 @@ +# Filename: sflphone-common/astylerc +# Purpose: config file for astyle +# http://astyle.sourceforge.net/astyle.html +# Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> +# Savoir-faire Linux Inc +# http://www.sflphone.org + +style=kr # Kernighan & Ritchie style formatting/indenting uses linux bracket +indent=spaces=4 # Use spaces instead of tabs for indentation +indent-classes # Indent 'class' and 'struct' blocks so that the blocks 'public:', 'protected:' and 'private:' are indented +indent-switches # Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block +break-blocks # Pad empty lines around header blocks (e.g. 'if', 'while'...). +brackets=linux +unpad=paren +-d diff --git a/sflphone-common/Makefile.am b/sflphone-common/Makefile.am index ffd473d7d1..64ee4c390b 100644 --- a/sflphone-common/Makefile.am +++ b/sflphone-common/Makefile.am @@ -1,5 +1,9 @@ +include globals.mak + # Makefile.am +SOURCES= + if BUILD_TEST TESTS_DIR=test unittest: @@ -14,8 +18,14 @@ unittest: @echo " -- You need the cppunit devel package to compile the unitary tests." endif -ACLOCAL_AMFLAGS = -I m4 +indent: + @echo "Indenting code:" + if [ -f $(ASTYLERC) ] ; then \ + $(indent) --options=$(ASTYLERC) --recursive *.cpp *.h; \ + fi + +ACLOCAL_AMFLAGS = -I m4 SUBDIRS = libs src ringtones po man $(TESTS_DIR) EXTRA_DIST = m4/*.m4 tools/*.sh platform/* images/* README.gentoo diff --git a/sflphone-common/globals.mak b/sflphone-common/globals.mak index 3bd883bd30..e6f165a1ac 100644 --- a/sflphone-common/globals.mak +++ b/sflphone-common/globals.mak @@ -3,6 +3,9 @@ src=$(top_srcdir) sflcodecdir=$(DESTDIR)$(libdir)/sflphone/codecs sflplugindir=$(DESTDIR)$(libdir)/sflphone/plugins +ASTYLERC="../astylerc" +indent="/usr/bin/astyle" + PJSIP_VERSION="1.0.2" # for pjsip -- GitLab