• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to generate preprocessed intermediate files?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to generate preprocessed intermediate files?


  • Subject: Re: How to generate preprocessed intermediate files?
  • From: Chris Espinosa <email@hidden>
  • Date: Tue, 14 Aug 2007 16:39:54 -0700

On Aug 14, 2007, at 3:29 PM, Yves Poissant wrote:

Is there a way, in the project's build configuration, to generate intermediate preprocessor files and save them? I currently use the contextual menu "Preprocess" option to generate the .i file but I would like to get them generated and saved for all the files in a library. Is it possible to specify that in the build configuration?

The general technique is:

1) Project > Edit Active Target
2) Click "Rules" tab
3) Click "+" to create a new rule
4) Change the "Process" popup to "C Source Files" and the "using:" popup to "Custom script:"
5) Set the script to gcc -E ${INPUT_FILE_PATH} > ${TARGET_TEMP_DIR}/${INPUT_FILE_BASE}.i
     and the "with output files:" to ${TARGET_TEMP_DIR}/${INPUT_FILE_BASE}.i
6) Close the Inspector and build

Your intermediates folder should now be full of .i files instead of .o files.

Note that in order to get your project to preprocess correctly you may need to pass a lot of the other Xcode build settings on the gcc command line.  They'll be listed in the full build transcript.  For example, if you're compiling against the SDK, you'll want the headers from the SDK while preprocessing, so you'd pass -isysroot ${SDKROOT} too.

Note that this doesn't actually build your build product.  You'd have to add the -o ${INPUT_FILE_BASE}.o as well and really make sure that you have all bases covered.  It's probably best to define the rule, do a build to get the .i files, then undefine it form normal use, or to set up another target (rules are not per-configuration, they're per-target).

Chris
 _______________________________________________
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

References: 
 >How to generate preprocessed intermediate files? (From: "Yves Poissant" <email@hidden>)

  • Prev by Date: How to generate preprocessed intermediate files?
  • Next by Date: Linker issue: static lib which uses a dylib
  • Previous by thread: How to generate preprocessed intermediate files?
  • Next by thread: Linker issue: static lib which uses a dylib
  • Index(es):
    • Date
    • Thread