Skip to content
Snippets Groups Projects
Commit aae097cc authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Added astyle script

I added a script located in src that applies astyle to
all source files and add them to git. This script can
be invoked as `make astyle`.

File .astyle.options contains the astyle command line options

See #215
parent 07cd3a27
No related branches found
No related tags found
No related merge requests found
-n --indent=spaces=2 --keep-one-line-statements --keep-one-line-blocks
......@@ -4,12 +4,12 @@ endif
SRCDIRS := src test
SUBDIRS := $(SRCDIRS) user-doc developer-doc regtest macports vim
SUBDIRS := $(SRCDIRS) user-doc developer-doc regtest macports vim astyle
SUBDIRSCLEAN:=$(addsuffix .clean,$(SUBDIRS))
.PHONY: all lib clean $(SRCDIRS) doc docclean check cppcheck distclean all_plus_docs macports codecheck plumedcheck
.PHONY: all lib clean $(SRCDIRS) doc docclean check cppcheck distclean all_plus_docs macports codecheck plumedcheck astyle
# if machine dependent configuration has been found:
ifdef GCCDEP
......@@ -111,5 +111,8 @@ stamp-h: sourceme.sh.in Makefile.conf.in config.status
config.status: configure
./config.status --recheck
astyle:
$(MAKE) -C astyle
$(MAKE) -C src astyle
astyle
.PHONY: astyle
astyle:
$(MAKE) -C build/gcc
ln -fs build/gcc/bin/astyle .
clean:
$(MAKE) -C build/gcc clean
rm -f astyle
......@@ -15,8 +15,6 @@
!/function
!/generic
!/gridtools
!/header.sh
!/release.sh
!/imd
!/lapack
!/lib
......@@ -33,6 +31,9 @@
!/vatom
!/vesselbase
!/wrapper
!/header.sh
!/release.sh
!/astyle.sh
# And just ignore these files
*.xxd
......
.PHONY: all clean lib install uninstall install-html
.PHONY: all clean lib install uninstall install-html astyle
# by default we compile the lib directory, which in turn requests all the needeed modules
all: lib
......@@ -49,4 +49,8 @@ help:
@echo " cppcheck: check source (requires cppcheck and gawk installed)"
@echo " plumedcheck: check source (requires gawk installed)"
astyle:
$(MAKE) -C ../astyle
./astyle.sh
#! /bin/bash
DIRS=$1
# remove trailing "/"
DIRS=${DIRS%%/*}
test -z "$DIRS" && DIRS=*
for dir in $DIRS
do
test -d "$dir" || continue
test "$dir" = lapack && continue
test "$dir" = blas && continue
test "$dir" = molfile && continue
cd $dir
for file in *.c *.cpp *.h *.inc.in
do
test -f "$file" || continue
echo -n "astyle $file"
../../astyle/astyle --options=../../.astyle.options < $file > $file.tmp && {
if cmp -s $file $file.tmp ; then
echo
else
cp $file.tmp $file
echo " +++ PATCHED"
git add $file
fi
}
rm $file.tmp
done
cd -
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment