Re: Passing the result of one build phase to another
Re: Passing the result of one build phase to another
- Subject: Re: Passing the result of one build phase to another
- From: James Bucanek <email@hidden>
- Date: Mon, 17 Oct 2005 23:16:02 -0700
Wim Lewis wrote on Monday, October 17, 2005:
>I'd like to have a shell script phase which generates a .c file
>(containing information about the build environment) which then gets
>compiled and linked into the project. The shell script should run
>every time the project is built. Is there a way to do this using Xcode?
>
>I can approach pretty close to my goal in a handful of ways, but not
>quite get there. Unless I'm missing something, there isn't a good way
>to get the shell script's output file to be used in the Compile Files
>phase.
Can your script be a build rule rather than a custom build phase?
That is, can your script be written to take an input file (.special) and produce a single intermediate output file (.c), which is then compiled into an object file? Something like this:
.special --> .c --> .o
If this makes sense for your application, then the existing Compile Sources phase will do everything you need. You don't need to create an extra build phase, you just need to add a custom build rule to the Compile Source phase.
Whenever a rule is executed in the Compile Sources phase, the output file from that rule is run back through the rules. This continues indefinitely until the no more rules match the file. So even if you have some ungodly chain like
.rules --> .xml --> .y --> .l --> .c --> .o
It all "just works." Adding the .special file to that phase as an input file is all you need to do to kick off the chain of events.
Note that you might have to add the file to the phase manually rather than relaying on Xcode to corretly add the file to the Compiles Sources phase when you add your .special source file to the target. The reason is because Xcode doesn't normally compile files of type .special, so it's not sure which phase to add the file to. Expand the target group to show the individual phases, and then drag your .special file directly into that phase.
James
--
James Bucanek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden