Detect Linux system in Makefile.

On Linux systems we need to use -pthread. Added code to detect
builds on Linux systems and add the switch to the base compilation
and linking flags.