Xcode seems to allow specifying a custom compiler for source files via the Build Rules tab (copy the system C rule to the target, select "Custom Script". Just for testing the concept, I wrote echo $*
as the script.
However it doesn't really run that script (no output is sent to the console); the end result is that no file gets built, so later I get a link error.
Am I using it wrong? What's the correct way of using a custom compiler in Xcode 4.x?
I tried your example. The script would not run unless I added an output file to the Output Files table for the build rule. Then the script ran, but the results appear in the build transcript instead of the console. Open the log navigator by choosing View > Navigators > Show Log Navigator. Select your build from the log navigator to open the build results window. There should be a run custom shell script step in the build results window. On the right side of the step is a small button with several horizontal lines. Click that button to show the build transcript.
If you want to use a custom compiler on some of the files in your project, you may find it easier to add a Run Script build phase to your target and add the files you want to compile to the Run Script build phase.