I'm trying to integrate a tool into Xcode 4 that generates a C header from a descriptor file. In Xcode 3 it worked to add a custom build step for files with a specific extension. Those files then get compiled before the .m/.mm/.cpp files that included them. When I try to do this with Xcode 4 it seems like it runs my custom step after compiling the other source. This doesn't work of course. Is there any way to tell Xcode to run the step before?
Here's a simple repro setup:

My main.m contains a:
#include <mytest.h>
and I've added ${DERIVED_FILE_DIR} to the header search path. When I compile this project I get the following:

If I remove the include and build it again I get this:

So the rule is indeed working, but it's executed way too late. Is there any way to change this behavior?
Rather than adding a Build Rule: In the Build Phases tab, using the Add Build Phase button, choose Add Run Script. A Run Script phase will be added in which you can implement your script requirements. The new run script phase can be dragged to before the Compile Sources phase which is when you want your functionality executed.