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 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)
Bourne shell and variants (.sh)
C++ (.C, .cpp, .cxx, .cc)
C shell (.csh)
COBOL (.cob, .cbl) as of version 2.10
C# (.cs) as of version 2.11
Haskell (.hs) as of version 2.11
LISP/Scheme (.el, .scm, .lsp, .jl)
Makefile (makefile) - not normally shown.
Modula-3 (.m3, .i3) as of version 2.07
Pascal (.p, .pas)
Perl (.pl, .pm, .perl)
PHP (.php, .php, .inc) as of version 2.05
Ruby (.rb) as of version 2.09
SQL (.sql) - not normally shown.
TCL (.tcl, .tk, .itk)
For more detail please look at the documentation.