492Target Conditionals

TargetConditionals.h

#include <TargetConditionals.h>;
 
// Gives you TARGET_IPHONE_SIMULATOR and TARGET_OS_IPHONE target conditionals.
// Set hello to "Hello, <device or simulator>"!
#if TARGET_IPHONE_SIMULATOR
   NSString *hello = @"Hello, iPhone Simulator!";
#else
   NSString *hello = @"Hello, iPhone device!";
#endif
 
//Determining whether you’re compiling for the iPhone OS
#if TARGET_OS_IPHONE
   #import <UIKit/UIKit.h>
#else
   #import <Cocoa/Cocoa.h>
#endif

Conditionalizing Compilation and Linking from the Apple Dev Library.

I came across a simple and short IPHONE target conditional at some framework, but that did not seemed to do the trick. I am probably missing something there.

-

Update 1.
tconf might be a step into the right directions.

Just out of curiosity, here a incomplete list of available target conditionals:

TARGET_IPHONE_SIMULATOR
TARGET_CARBON
TARGET_OS_IPHONE
TARGET_CPU_PPC 
TARGET_CPU_PPC64
TARGET_CPU_68K
TARGET_API_MAC_OSX
PRAGMA_ALIGN_SUPPORTED
TARGET_OS_UNIX
TARGET_OS_EMBEDDED
TARGET_OS_MAC
TARGET_OS_WIN32
TARGET_OS_UNIX
TARGET_OS_EMBEDDED
TARGET_RT_MAC_CFM
TARGET_RT_MAC_MACHO
...

Update 2.
And that’s the motherload. Nice of Apple to open-source that.