Chapter 11. Compiling Source Code
The Xcode Tools that ship with Tiger provide a development environment for building applications with Cocoa, Carbon, Java, and even AppleScript . Xcode Tools include utilities that should be familiar to any Unix developer who works with command-line compilers . For details about obtaining these tools, see the "Xcode Tools" section in the Preface. Xcode Tools include all sorts of other goodies, including an advanced Integrated Development Environment (IDE), but coverage of those tools is beyond the scope and intent of this book. To learn more about the Xcode Tools, go to /Developer/ADC Reference Library/documentation /DeveloperTools/index.html.
The C compiler that comes with Xcode is based on the Free Software Foundation's GNU Compiler Collection, or GCC. Apple's modifications to GCC include an Objective-C compiler, as well as various modifications to deal with the Darwin operating system. The development environment in Mac OS X includes:
This is an English-like language used to script applications and the operating system. AppleScript is installed as part of the Mac OS X operating system and does not require Xcode. Instead, to write AppleScripts, use the Script Editor (/Applications/AppleScript).
This is a high-level development environment based on AppleScript that allows you to build GUI applications by hooking AppleScript into the Cocoa framework. If you plan to build AppleScript Studio applications, you will need to use the Xcode Tools instead of the Script Editor.
These compilers are based on GCC and provide support for C, C++, Objective-C, Objective-C++, and assembly. Apple's enhancements to GCC for Tiger include support for the G5 (also known as the PowerPC 970) and 64-bit arithmetic, as well as the ability to generate optimized code to run on G5, G4, and G3 systems
These include the Mac OS X Mach-O GNU-based assemblers, Mach-O static link editor, Mach-O dynamic link editor, and Mach-O object file tools, such as nm, otool, and otool64.
There is extensive documentation for Xcode, available in both HTML and PDF formats. The Xcode documentation can be found in /Developer/ADC Reference Library. These documents are also available online from the Apple Developer Connection (ADC) web site (http://developer.apple.com).
You can access the documentation for GCC after you've installed Xcode by opening /Developer/ADC Reference Library/documentation/DeveloperTools/gcc-4.0/gcc/index.html.
The Apple debugger is based on GNU gdb.
These include traditional development tools, such as make (both GNU, which is the default, and BSD) and GNU libtool, graphical and command-line performance tools, Xcode for WebObjects, parsing tools (such as lex, flex, yacc, and bison), standard Unix source code management tools (such as CVS and RCS), and an extensive set of Java development tools. There's also a frontend to GCC, distcc, which uses Bonjour to distribute builds of C, C++, Objective-C, or Objective-C++ code across computers on a network.
Formerly known as Xcode is an IDE for Mac OS X that supports Cocoa and Carbon programming with C, C++, Objective-C, and Java. (Xcode was known as Project Builder in pre-Panther releases of Mac OS X.)
This is a graphical user interface (GUI) editor for Cocoa and Carbon applications .
Header Doc 8
This is a set of command-line tools for including structured comments in source code and header files, which are later used to create HTML and XML output. A set of manpage generation tools is also included. Header Doc's two main Perl scripts are headerdoc2html and gatherheaderdoc. Kyle Hammond's Cocoa frontend to Header Doc is available at http://www.isd.net/dsl03002/CocoasProgramming.html. See /Developer/ADC Reference Library/documentation/DevelopTools/Conceptual/HeaderDoc/index.html for details.
We won't address the complete Mac OS X development suite in this chapter. Instead, we'll focus on the command-line development tools and how they differ from the implementations on other Unix platforms.
Java programmers will find that the Mac OS X command-line Java tools (see "Java Development Tools" in Appendix B) behave as they do under Unix and Linux. Another resource for Java developers is Mac OS X for Java Geeks (O'Reilly).
Perl programmers coming from previous Macintosh systems will find that Mac OS X does not use MacPerl (http://www.macperl.com), but instead uses the standard Unix build of the core Perl distribution (http://www.perl.org). For additional information on using Perl under Mac OS X, see Chapter 19.