Wouldn't it be easier to do shadow builds so that makefiles for each platform end up in different directories? Your problem would vanish instantly.