r18760 - gnucash/trunk - Add a "make indent" target, but watch out with using its result.

Christian Stimming cstim at code.gnucash.org
Sun Feb 28 08:40:39 EST 2010


Author: cstim
Date: 2010-02-28 08:40:38 -0500 (Sun, 28 Feb 2010)
New Revision: 18760
Trac: http://svn.gnucash.org/trac/changeset/18760

Modified:
   gnucash/trunk/Makefile.am
Log:
Add a "make indent" target, but watch out with using its result.

The "astyle" indent tool unfortunately behaves significantly different
in its different versions (1.22, 1.23, 1.24) even with identical
options. That is, the basic indentation is the same, but in a large
project such as ours, there are just too many special cases which
astyle doesn't get identical due to its bugfixes and new features.
Hence, please use the result of this target with great care, and
if in doubt, just use it for your own amusement but don't commit the
resulting changes. Thanks!

Modified: gnucash/trunk/Makefile.am
===================================================================
--- gnucash/trunk/Makefile.am	2010-02-28 13:18:40 UTC (rev 18759)
+++ gnucash/trunk/Makefile.am	2010-02-28 13:40:38 UTC (rev 18760)
@@ -195,3 +195,13 @@
 	  $(XSLTPROC) --stringparam strip-prefix "gnucash/trunk" \
 	  --stringparam include-rev "yes" $(srcdir)/macros/svn2cl.xsl - > $@
 endif
+
+ASTYLE = /usr/bin/astyle
+.PHONY: indent
+indent:
+	$(ASTYLE) --indent=spaces=4 --brackets=break --suffix=none `find ${srcdir}/src -name '*.[hc]'`
+# Use the following line if you've got astyle-1.24, but don't use
+# --pad=oper with astyle 1.22 as it will reformat e.g. "return +1;" in
+# a very ugly way.
+#	$(ASTYLE) --indent=spaces=4 --brackets=break --pad-oper -pad-header --suffix=none `find ${srcdir}/src -name '*.[hc]'`
+	@echo "### GnuCash development hint: The above command might have re-indented much more files than what you intended. Please commit only those which you really want to have changed, and revert the changes in the others so that other devevelopers do not have unnecessary merge conflicts. Thanks! ###"



More information about the gnucash-changes mailing list