Makefile: detect OS and perform Mac-specific logic automatically