Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Converting an existing Xcode project to a different build system...

676 views
Skip to first unread message

Randy Howard

unread,
Jan 19, 2007, 5:29:01 PM1/19/07
to

If you have an existing Xcode project, using for example the "command
line utility, Standard tool" option at new project creation, is there a
way to "convert" that project to one using an external build utility,
like standard make/makefile builds? Wanting to take a fairly large
project developed initially on OS X, but make it portable to a number
of other platforms, without having to manually create the Makefile.
Seems I recall Visual could do this on Windows, with an "export
Makefile" option or some such. Anyone ever encountered this before?

--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw

Michael Ash

unread,
Jan 19, 2007, 5:35:20 PM1/19/07
to
Randy Howard <randy...@fooverizonbar.net> wrote:
>
> If you have an existing Xcode project, using for example the "command
> line utility, Standard tool" option at new project creation, is there a
> way to "convert" that project to one using an external build utility,
> like standard make/makefile builds? Wanting to take a fairly large
> project developed initially on OS X, but make it portable to a number
> of other platforms, without having to manually create the Makefile.
> Seems I recall Visual could do this on Windows, with an "export
> Makefile" option or some such. Anyone ever encountered this before?

PBTOMAKE claims it can do it, although I have no experience with it:

http://members.bellatlantic.net/%7Evze35xda/software.html

--
Michael Ash
Rogue Amoeba Software

Randy Howard

unread,
Jan 19, 2007, 7:02:17 PM1/19/07
to
On Fri, 19 Jan 2007 16:35:20 -0600, Michael Ash wrote
(in article <11692461...@nfs-db1.segnet.com>):

Excellent, I'll give it a try. Thank you.

Along a similar direction, assuming the above doesn't already handle
it, does anyone have a link showing how to construct a simple makefile
for compiling a universal binary, for something like Hello World?

Do you have to build each individually, then manually use lipo to
stitch them together?

Michael Ash

unread,
Jan 19, 2007, 8:24:22 PM1/19/07
to
Randy Howard <randy...@fooverizonbar.net> wrote:
>
> Along a similar direction, assuming the above doesn't already handle
> it, does anyone have a link showing how to construct a simple makefile
> for compiling a universal binary, for something like Hello World?

If you don't need different compiler flags for each architecture, you can
just add -arch ppc -arch i386 to your compiler flags and off you go.

> Do you have to build each individually, then manually use lipo to
> stitch them together?

If you need per-arch compiler flags, this is the only way to go. Note that
there's nothing which says the lipo step can't be handled by your
makefile, though. You could have a rule which takes source files, compiles
each one twice, then uses lipo to produce a .o, and the rest of the build
system won't have to be altered.

vze3...@verizon.net

unread,
Jan 20, 2007, 7:20:47 AM1/20/07
to
Thought I'd weigh in here, I'm the author of pbtomake and I think it
will do what you want. It's quite good at converting XCode command
line type projects to make files. At the moment at my work we are
using it with a pretty large (> 300 file) XCode project with multiple
targets. We use pbotmake to convert the multitarget XCode project to
build make files for the individual targets (one app and 5 dylibs).
Then we use awk and some scripts to mod these make files to build makes
for Ubuntu Linux (app and .so's) and another set to mod the makes to
build uClinux output for a Blackfin processor in an embedded system.

You can specify compiler/linker flags to pbotmake which will be built
into your make file so you can tweek things for a particular make
design. In our current project we do that but since we have two very
different targets & tool chains we use some awk magic to make the
required changes.

The thing you must do is to set each of your file references in the
project to project relative Path Type (in the General Tab of the Get
Info window). This is the only reference form that has enough
information for pbtomake to build the make. Not a big deal and
pbtomake will tell you which files have incorrect path types. But
XCode seems to like to switch the files to the "Relative to Enclosing
Group" form behind your back.

It's not a real user friendly program but it's for developers and ment
to run inside scripts, XCode project in -> make file out. I will have
to check if the latest version is out on the web, we added a bunch of
stuff to handle the project I mentioned which has a multiple target
project file. You get the program and source which has been useful
since others have contributed some neat things (like adding make clean
and make install).

If you have any more questions contact me at the above email address.

--jim

Chris Hanson

unread,
Jan 20, 2007, 8:44:18 PM1/20/07
to
On 2007-01-19 14:29:01 -0800, Randy Howard
<randy...@FOOverizonBAR.net> said:

> If you have an existing Xcode project, using for example the "command
> line utility, Standard tool" option at new project creation, is there a
> way to "convert" that project to one using an external build utility,
> like standard make/makefile builds?

One way to do this is to write an AppleScript against Xcode that walks
your project, notes all of the important features about it, and
generates a Makefile from that.

-- Chris


0 new messages