#!/bin/bash test ! -z "$1" || { echo "Usage: $0 "; exit 255; } SOURCEDIR=$1 test -e $SOURCEDIR || { echo "srcdir $SOURCEDIR does not exist."; exit 255; } INCLUDES="-I$SOURCEDIR -I$SOURCEDIR/unittests -I$SOURCEDIR/Actions -I$SOURCEDIR/UIElements -I$SOURCEDIR/../LinearAlgebra/src" CODEPATTERNS="-I/home/heber/packages/CodePatterns-1.2.8/include" BOOST="" JOBMARKET="-I/home/heber/packages/JobMarket-1.1.4_1.2.8/include" PYTHON="-I/usr/include/python2.7" QT="-I/usr/include/qt4 -I/usr/include/qt4/Qt -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore" QWT="-I/usr/include/qwt-qt4" BUILDDIR="-I/home/heber/workspace_C/molecuilder/build64/src" SCAFACOS="-I/home/heber/packages/ScaFaCoS-0.1.0-debug_open/include -I/home/heber/workspace_C/scafacos/lib/vmg/src" COMMON="-I/usr/include" MPI="-DMPI" list=`find $SOURCEDIR -name '*.cpp'` test ! -e test.cpp || { echo "There already is a test.cpp in the current dir."; exit 255; } files=0 worlds=0 averagesize=0 for file in $list; do CURRENTDIR=`dirname $file` cpp -E -I$CURRENTDIR -I$CURRENTDIR/.. $INCLUDES $COMMON $BUILDDIR $CODEPATTERNS $JOBMARKET $BOOST $PYTHON $QT $QWT $SCAFACOS $MPI -DHAVE_CONFIG_H $file >test.cpp test $? -eq 0 || { echo "Some includes still missing for $file."; exit 255; } lines=`wc -l test.cpp | awk -F" " '{print $1}'` let averagesize=$averagesize+$lines grep World.hpp $file >/dev/null world=$? let files=$files+1 let worlds=$worlds+$world rm -f test.cpp echo -n "`basename $file`: $lines, " if test $world -eq 0; then echo "not present." else echo "PRESENT." fi done mean=`echo "$averagesize $files" | awk -F" " '{print $1/$2}'` echo "$worlds of $files contain World.hpp in include tree." echo "The mean number of lines is $mean." exit 0