Try SLOCCount and it is GPL. Once it's installed all you need to do is type this to measure all the code in a given directory (including its descendants):
sloccount directoryname
SLOCCount can automatically identify and measure the following languages (common extensions for the language are listed in parentheses):
Ada (.ada, .ads, .adb)
Assembly (.s, .S, .asm)
awk (.awk)
Bourne shell and variants (.sh)
C (.c)
C++ (.C, .cpp, .cxx, .cc)
C shell (.csh)
COBOL (.cob, .cbl) as of version 2.10
C# (.cs) as of version 2.11
Expect (.exp)
Fortran (.f)
Haskell (.hs) as of version 2.11
Java (.java)
lex/flex (.l)
LISP/Scheme (.el, .scm, .lsp, .jl)
Makefile (makefile) - not normally shown.
Modula-3 (.m3, .i3) as of version 2.07
Objective-C (.m)
Pascal (.p, .pas)
Perl (.pl, .pm, .perl)
PHP (.php, .php[3456], .inc) as of version 2.05
Python (.py)
Ruby (.rb) as of version 2.09
sed (.sed)
SQL (.sql) - not normally shown.
TCL (.tcl, .tk, .itk)
Yacc/Bison (.y)
For more detail please look at the documentation.