Make CXX/CXXFLAGS overridable

This makes it easier to support systemwide compiler settings.
While here, link with pthreads in a more correct way (-pthread instead
of -lpthread).
Merge pull request #14 from AMDmi3/master

Make CXX/CXXFLAGS overridable