Added preprocessor commands to make sure extern is applied if g++ used.
Minor fixes to makefile.