How can you generate a Makefile from an Xcode project?

By : Tim
Source: Stackoverflow.com
Question!

I want to generate a Makefile from an existing Xcode project on the Mac. Specifically, an existing iPhone, Objective-C program on the Mac.

I found PBToMake, but it looks like it is for Xcode 2.1 and when I tried using it, it did not work for an Xcode 3.1 project.

By : Tim


Answers

GNUStep provides 'pbxbuild' to convert a .xcodeproj file into a GNUMakefile.

UPDATE: pbxbuild is now deprecated

By : rage


It's not an automated way of generating a Makefile, but I found it at least gets a list of source files that are built for a target.

I'm using XCode 4.0.2 in this case..

  • select the project top node
  • select the target in the target list.
  • Choose "Build Phases"
  • Open the "Compile Sources"
  • Select one of the source files
  • PRess Command-A to select all
  • Press Command-C to copy
  • Paste in your favorite text editor and Regex away to restructure.

The pasted output is FULL pathnames to each source file.

By : Urkle


You could try mfg. It is template based and I think (I haven't played with it too much) you could get it to generate a suitable makefile.



This video can help you solving your question :)
By: admin