title: Adding a new build rule to parse all rtf files
body: <p>Xcode includes a flexible build rules system. The documentation is all but non-existant however.</p>
  
  <p>A project I am working on for iOS 5 and iOS 6 includes an rtf help file. For iOS 6, I can convert the rtf file into an archived NSAttributedString object, then load that at runtimeand display it directly to a UITextView. For iOS 5, I can't (without a lot of work in Core Text...) so I want just the text without the style info.</p>
  
  <p>I wrote a command line tool, RTFToData that takes an RTF file as input and generates a .txt file and a .data file (where the .data file contains a version of the styled text that my project knows how to use.)</p>
  
  <p>Here is the syntax of my command line tool:</p>
  
  <p>RTFToData [-o] source_path [destination_path]
      -o (optional)  overwite existing files
      source_path (required) path to source RTF file (must have extension "rtf" or "RTF"
      destination_directory (optional.) writes output files to source file directory if no destination specified
         destination_directory must exist if specified.</p>
  
  <p>I want to set up my project so that I can add .rtf files as sources (with the "add to target" checkbox NOT checked.) I want Xcode to run my RTFToData command on each file specifying that the output files should be copied into a directory and then added to the target.</p>
  
  <p>Ideally, I'd like the build process to know about the dependencies between my source .rtf files and the processed .data and .txt files. If I touch a .rtf file, I'd like the build process to re-run the rtftodata command.</p>
  
  <p>I am a makefile and unix scripting neophyte. I THINK I can use a run script build rule that will do this, but I am unclear on how. I guess I need to write a script that finds all files of type ".rtf", pipes that list of files into an invocation of my RTFToData.</p>
  
  <p>Can somebody outline the steps I need to take in the Xcode IDE to make my project handle this smoothly?</p>
  
  <p>As a side-note, is there some directory where you can put command line tools so they are available to the current version of Xcode? So far I've been installing the RTFToData command in /Library/usr/bin, but I'd really like the build tool to be included in the project, or at the very least, not have to use sudo to set up every development machine that is used to build this project.</p>