From 22b88f68688356eb4c48ae25bfb3cd65ad61fe0e Mon Sep 17 00:00:00 2001
From: Julien Bonjean <julien@bonjean.info>
Date: Tue, 3 Aug 2010 11:34:07 -0400
Subject: [PATCH] [#2402] Improved code indent for daemon

---
 astylerc                        | 1 +
 sflphone-common/Makefile.am     | 7 -------
 sflphone-common/globals.mak     | 9 ++++++++-
 sflphone-common/src/Makefile.am | 7 +------
 4 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/astylerc b/astylerc
index 0170fbdc94..460124f66d 100644
--- a/astylerc
+++ b/astylerc
@@ -12,4 +12,5 @@ indent-switches         # Indent 'switch' blocks so that the 'case X:' statement
 break-blocks            # Pad empty lines around header blocks (e.g. 'if', 'while'...).
 brackets=linux
 unpad=paren
+formatted
 -d
diff --git a/sflphone-common/Makefile.am b/sflphone-common/Makefile.am
index c5de2501fb..22a5bfd630 100644
--- a/sflphone-common/Makefile.am
+++ b/sflphone-common/Makefile.am
@@ -24,13 +24,6 @@ doc:
 	@echo "D-Bus API HTML documentation has been generated in doc/dbus-api/doc/spec"
 	@echo ""
 
-indent:
-	@echo "Indenting code:"
-	if [ -f $(ASTYLERC) ] ; then \
-		$(indent) --options=$(ASTYLERC) --recursive *.cpp *.h; \
-	fi
-
-
 ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = libs src ringtones 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 345259a8eb..82d93933f2 100644
--- a/sflphone-common/globals.mak
+++ b/sflphone-common/globals.mak
@@ -7,7 +7,7 @@ sfllibdir=$(DESTDIR)$(libdir)/sflphone
 sflcodecdir=$(sfllibdir)/codecs
 sflplugindir=$(sfllibdir)/plugins
 
-ASTYLERC="../astylerc"
+ASTYLERC="$(top_srcdir)/../astylerc"
 indent="/usr/bin/astyle"
 
 # for pjsip
@@ -69,3 +69,10 @@ AM_CPPFLAGS = \
 	-DENABLE_TRACE \
          $(SPEEXCODEC) \
          $(GSMCODEC)
+
+
+indent:
+	@echo "Indenting code:"
+	if [ -f $(ASTYLERC) ] ; then \
+		find $(top_srcdir)/src/ -regex ".*\.\(h\|cpp\)" -exec $(indent) --options=$(ASTYLERC) {} \; ; \
+	fi
diff --git a/sflphone-common/src/Makefile.am b/sflphone-common/src/Makefile.am
index d97477c85f..fff3507833 100644
--- a/sflphone-common/src/Makefile.am
+++ b/sflphone-common/src/Makefile.am
@@ -102,9 +102,4 @@ libsflphone_la_CFLAGS = \
 
 libsflphone_la_SOURCES =
 
-indent:
-	@echo "Indenting code:"
-	if [ -f $(ASTYLERC) ] ; then \
-		$(indent) --options=$(ASTYLERC) --recursive *.cpp *.h; \
-	fi
-
+all: indent
-- 
GitLab