Show categories
Show categories
Working with XCode is a lot easier (for me, who's used to it) than with a bunch of text windows and typing 'make' into a console. In case there are other people with this malady, here's how to get XCode to play nice with your Makefile...

Step 1:Create a new project


The first thing to do is to create a new project, and make sure you specify the 'external build system'. This tells XCode that all the dependency-management is done using 'make' (at least in this instance). The next screen will ask you where to create the project, which is of course up to you.

Step 2:Add your Makefile to the project


Then just add your Makefile to the project as an 'existing file'. XCode is smart enough to recognise it as 'the' Makefile. In case you've not been using a Makefile already, here's one to start off with. This has the advantage of automatic dependency management, will build your project in parallel (assuming you set the CPUS variable appropriately), and will install your finished app on the phone, if there were no errors during build. All from a single click... Note that I had to change my CC definition in my Makefile.

Step 3:Set your SDK to point to the iPhone


Now we need to tell XCode which SDK we'll be using. To do this, right-click on the project and select 'Get Info', you ought to see a dialogue similar to the above - make sure you're on 'Build' at the top of the dialogue, that you've selected 'All Configurations' for the config, and 'Build locations' for the category, as above. Then just double-click on the SDK path, and change it to the iPhone one.

Et voila, you're done. Start adding files to your project, and make sure you update the Makefile when you do (you can group the files in XCode for convenience, but leave them all in one directory for the Makefile). Click 'build' and the Makefile will be run, any errors will be flagged up as usual, and clicking them will take you to the offending source-line. Assuming all goes ok, the above Makefile will install your app onto the phone.

To actually see the build taking place, you can click the 'Build -> Build Results' menu item, and click on the text-like icon (third along) in the bar on the window that pops up. Just to make sure everything is working ok :)

Enjoy.
Show categories