Add support for replacement default #defines.
Fixed bugs and added support for platform-specific files.