Cleanup: Put creation of defines file into helper function.
Also add system header pragmo to that file to prevent emission of warnings about macro redifinitions.