A bunch of changes for Mac.

Some work-arounds for WxMac-related bugs and changes to Makefile.