2 ##===- utils/countloc.sh - Counts Lines Of Code --------------*- Script -*-===##
4 # The LLVM Compiler Infrastructure
6 # This file was developed by Reid Spencer and is distributed under the
7 # University of Illinois Open Source License. See LICENSE.TXT for details.
9 ##===----------------------------------------------------------------------===##
11 # This script finds all the source code files in the source code directories
12 # (excluding certain things), runs "wc -l" on them to get the number of lines in
13 # each file and then sums up and prints the total with awk.
15 # The script takes no arguments but does expect to be run from the top llvm
18 TOPDIR=`pwd | sed -e 's#(.*/llvm).*#$1#'`
19 if test -d "$TOPDIR" ; then
21 find include lib tools utils examples -type f -name '*.[cdhyltp]*' \
27 \! -name 'Sparc.burm.c' \
28 \! -name 'llvmAsmParser.cpp' \
29 \! -name 'llvmAsmParser.h' \
30 \! -name 'FileParser.cpp' \
31 \! -name 'FileParser.h' \
32 -exec wc -l {} \; | awk '\
37 echo "Can't find LLVM top directory in $TOPDIR"