1 | #!/bin/bash
|
---|
2 |
|
---|
3 | test ! -z "$1" || { echo "Usage: $0 <srcdir>"; exit 255; }
|
---|
4 | SOURCEDIR=$1
|
---|
5 | test -e $SOURCEDIR || { echo "srcdir $SOURCEDIR does not exist."; exit 255; }
|
---|
6 |
|
---|
7 | INCLUDES="-I$SOURCEDIR -I$SOURCEDIR/unittests -I$SOURCEDIR/Actions -I$SOURCEDIR/UIElements -I$SOURCEDIR/../LinearAlgebra/src"
|
---|
8 | CODEPATTERNS="-I/home/heber/packages/CodePatterns-1.2.8/include"
|
---|
9 | BOOST=""
|
---|
10 | JOBMARKET="-I/home/heber/packages/JobMarket-1.1.4_1.2.8/include"
|
---|
11 | PYTHON="-I/usr/include/python2.7"
|
---|
12 | QT="-I/usr/include/qt4 -I/usr/include/qt4/Qt -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore"
|
---|
13 | QWT="-I/usr/include/qwt-qt4"
|
---|
14 | BUILDDIR="-I/home/heber/workspace_C/molecuilder/build64/src"
|
---|
15 | SCAFACOS="-I/home/heber/packages/ScaFaCoS-0.1.0-debug_open/include -I/home/heber/workspace_C/scafacos/lib/vmg/src"
|
---|
16 | COMMON="-I/usr/include"
|
---|
17 | MPI="-DMPI"
|
---|
18 |
|
---|
19 | list=`find $SOURCEDIR -name '*.cpp'`
|
---|
20 |
|
---|
21 | test ! -e test.cpp || { echo "There already is a test.cpp in the current dir."; exit 255; }
|
---|
22 |
|
---|
23 | files=0
|
---|
24 | worlds=0
|
---|
25 | averagesize=0
|
---|
26 | for file in $list; do
|
---|
27 | CURRENTDIR=`dirname $file`
|
---|
28 | cpp -E -I$CURRENTDIR -I$CURRENTDIR/.. $INCLUDES $COMMON $BUILDDIR $CODEPATTERNS $JOBMARKET $BOOST $PYTHON $QT $QWT $SCAFACOS $MPI -DHAVE_CONFIG_H $file >test.cpp
|
---|
29 | test $? -eq 0 || { echo "Some includes still missing for $file."; exit 255; }
|
---|
30 | lines=`wc -l test.cpp | awk -F" " '{print $1}'`
|
---|
31 | let averagesize=$averagesize+$lines
|
---|
32 | grep World.hpp $file >/dev/null
|
---|
33 | world=$?
|
---|
34 | let files=$files+1
|
---|
35 | let worlds=$worlds+$world
|
---|
36 | rm -f test.cpp
|
---|
37 | echo -n "`basename $file`: $lines, "
|
---|
38 | if test $world -eq 0; then
|
---|
39 | echo "not present."
|
---|
40 | else
|
---|
41 | echo "PRESENT."
|
---|
42 | fi
|
---|
43 | done
|
---|
44 | mean=`echo "$averagesize $files" | awk -F" " '{print $1/$2}'`
|
---|
45 | echo "$worlds of $files contain World.hpp in include tree."
|
---|
46 | echo "The mean number of lines is $mean."
|
---|
47 |
|
---|
48 | exit 0
|
---|
49 |
|
---|