You can use xcodebuild with the latest SDK using :
xcodebuild -sdk iphoneos
xcodebuild -sdk iphonesimulator
We use these options for our automated builds and it's been working since XCode 3.2.5
I believe you can use xcodebuild -sdk iphoneos (no version number) to accomplish this.
I tried @jenningj 's solution and it worked for me. Maciek Sawicki, if this works for you, you should mark it as the right solution.
Also, xcodebuild -showsdk should be xcodebuild -showsdks.
xcodebuild -showsdk
xcodebuild -showsdks