ATARI cross-compiler for Mac OS X

Last updated on November 23th 2004

Written by Philipp Donzé, heavily inspired by Patrice Mandins HOWTO.
Tested under Mac OS 10.2 by Jens Syckor.

The following description was tested under Mac OS 10.3 and Mac OS 10.2. It supposes that you've installed Apples "Developer Tools". If you use Mac OS X 10.2, you have to install a GCC 3.3 update (August 2003 gcc updater) from ADC member page. (Yes you need to register as an Apple Developer to get the update.)

Step 1: Download files

First you'll have to download all the necessary tools from the web and move them into a directory cross-build in your home directory (i.e. /Users/<username>/):

Step 2: Compile and install

  1. Start the application "Terminal" (from "Applications/Utilities" directory)
  2. Change to the directory containing the downloaded files:
    cd ~/cross-build
    
  3. Extract the installation script:
    tar xvzf OSXcross-compile.tgz
    
  4. Start the installation script:
    ./compilescript.sh
    
    This script will compile and install a GCC cross-compiler for the m68k-atari-mint platform. Please have a look at the output of the script, as it probably will ask you an administrator password to create the directory /usr/local/cross-tools. If you don't trust this script, you can create this directory manually without entering any administrator password!
    This process takes a lot of time (1 - 2 hours). So be patient!

Step 3: Install gemlib

To compile GEM application (=using 'gem.h', i.e. AES and VDI calls), you need to install 'gemlib'. To do this we'll use the latest cvs release from the sparemint website:

  1. Download the libraries using CVS from the sparemint repository: (type cvsanon when you're asked to enter a password)
    	export CVSROOT=:pserver:cvsanon@sparemint.atariforge.net:/mint
    	cvs login
    	cvs checkout lib
    
  2. Compile and install gemlib: (At the time of writing November 23th 2004 cflib and gemma didn't compile with gcc 3.3.3 'out of the box'. I.e. patches have to be applied.)
    	export PATH=/usr/local/cross-tools/bin:$PATH
    	cd lib/gemlib
    	make CROSS=yes PREFIX=/usr/local/cross-tools/m68k-atari-mint all install
    

Step 4: Using the cross-compiler

From the command line :
To use the cross-compiler (instead apples gcc) from the terminal you have to make sure that "the system" finds the cross-compiler instead Apples compiler. To do this you'll need to modify the PATH environment variable.
	PATH=/usr/local/cross-tools/bin:$PATH

If you use 'bash' (=the default shell in Mac OS 10.3) you can use the following command:

	export PATH=/usr/local/cross-tools/bin:$PATH

If you use 'tcsh' (=the default shell in Mac OS 10.1 and 10.2) you can use the following commands:

	setenv PATH /usr/local/cross-tools/bin:$PATH

Now you can use gcc 'as normal' (see Using GCC for more details):

gcc main.c -o program.tos

From Xcode :
For using Apples Xcode development environment the installation script copied some project templates into /Library/Application Support/Apple/Developer Tools/Project Templates/.
The templates can be chosen when a new project is created. 2 templates are placed into the category ATARI:

Both templates are Makefile based. I.e. they use the GNU utility 'make' to compile. When adding files to the project don't forget to add them also to the 'Makefile'.

Where to continue

Now, you've got a very minimal setup. Which is still missing some things. Here are some suggestions, how you can continue: