Fix header generation
Previous commit incorrectly copied un-preprocessed headers. This fixes that and improves triggering the build phase to regenerate them.