Makefile fixes

- Move OSX specific linker switches to PLATFORM_LDFLAGS. 
- Make JAVA_HOME overridable on the command line.