#!/bin/sh

# klocs
#
# Count the number of kilos of lines of code (klocs)
# in the directory src.
#
# This script should be run from the top level directory.
                                                                                                    
IMPL=`find dolfin -name '*.cpp' | xargs wc -l | grep total | awk '{ printf "%d", $1/1000 }'`
HEAD=`find dolfin -name '*.h'   | grep -v elements | grep -v ffc-forms | xargs wc -l | grep total | awk '{ printf "%d", $1/1000 }'`

TOTAL=`echo $IMPL $HEAD | awk '{ print $1 + $2 }'`

echo $HEAD' klocs in .h files'
echo $IMPL' klocs in .cpp files'
echo $TOTAL' klocs total'
