some improvements to build system

the goal is to make it more mac friendly