Fix build script and Makefile for Mac OS X

Removed some outdated build flags, set maximum optimization level, and fixed the build scripts.