Changing Xcode compiler

macavenger

Registered
Is there a way to change what compiler Xcode uses (other than between GCC 3.1 or 3.3)? I work with writing code for the motorola 68HC1x, and would like to be able to write and assemble/compile the code using Xcode. Currently I write the code in Xcode (since it has nice code formating features, such as automatic tabing), but then have to exit Xcode and use a command line tool to assemble the code. I would like to be able to simply click the build button and have it call said command, although obviously it would not be able to run the assembled code. Thanks.
 
You have to do a bit of custom work to do this, but it can be done. In fact, I did something very much like this for TIGCC, which is a custom GCC compiler aimed at producing software for the 68k TI calculators (89, 92+, Voyage). The trick is that you have to create an external target and write up a script which does the actual compile through your command-line tools. If you don't, then the linking will go through the native ld, and mess things up good.

If you like, I can send you the script I use along with the target template, or you can download TIGCC from www.ticalc.org and look through it yourself. The script I install is located at /usr/local/tigcc/bin/tixcode, while the templates are in the normal /Library/Application Support/Apple/Developer Tools/ directory after the install.

Be warned that my script isn't complete, as it doesn't handle cleaning of targets yet, and doesn't grab listings of files from XCode (which never passes them, so I just compile all the files in the directory into the object file, a bad practice, but I am looking into alternatives).
 
Thanks for you response. I would be very interested in seeing your script and target template. Although I have used Xcode a fair amount, I have done very little work with targets, and most of that was pre-Xcode developer tools.
 
Thanks. I've downloaded the files, but it might be a little while before I get a chance to really look at them. All depends on what my class schedule ends up like over the next few weeks.
 
Back
Top