Re: XCode 3.0, external targets, recursive makefile, detecting directory changes [FIXED]
Re: XCode 3.0, external targets, recursive makefile, detecting directory changes [FIXED]
- Subject: Re: XCode 3.0, external targets, recursive makefile, detecting directory changes [FIXED]
- From: Alex Bligh <email@hidden>
- Date: Mon, 26 Nov 2007 21:44:15 +0000
--On 24 November 2007 00:18:08 +0000 Alex Bligh <email@hidden> wrote:
I am trying to get an external target to work with XCode 3.0. The
external target has a makefile generated using automake/autoconf/configure
etc (standard unix) which is recursive. The target is built "out of tree"
so to build it at the CLI I would do (e.g.)
$ ( cd debug ; ../configure ; make )
When building in XCode 3.0, I set "debug" as the target directory, and
it correctly cd's to that directory, then executes make. However, the
problem is parsing filenames in standard output. XCode 3.0 unlike 2.5
correctly interprets the someone arcane compiler lines used by
automake/autoconf to process dependency output (hurray!) but clicking
on errors or warnings does not work. This appears to be because the
stdout parser does not spot the lines "Making all in somedir" and
realize that a reference to "../../thisdir/thisfile.cpp" needs to be
translated to "../thisdir/thisfile.cpp" when referencing relative to
builddir (at least I am presuming this is what the problem is).
kdevelop copes with this fine.
I am an XCode newbie; any ideas on how I can fix this?
He's my fix. Use this little piece of perl instead of /usr/bin/make.
I don't claim to be a perl expert but despite not being beautiful
it does work.
Alex
!/usr/bin/perl
# xcodemake
#
# (c) 2007 Alex Bligh & Xara Ltd, GNU Public License v2
#
# Usage
# xcodemake [make option] ...
#
# Xcode suffers from brokenness in not supporting directory changes
# in multilevel makefiles. Further it appears not to uniformly
# dereference out-of-tree builds (i.e. where make is executed other
# than in the project root). GNU automake produces error lines which
# fortunately for us have "../" in front of them, and if all of
# those are removed we currently get back to the project root
use strict;
use warnings;
my $pdir;
$pdir=$ENV{"PROJECT_DIR"}."/" if defined($ENV{"PROJECT_DIR"});
sub xcodefilter
{
my $pid;
return if $pid = open STDERR, "|-";
die "cannot fork: $!" unless defined $pid;
while (<STDIN>)
{
s/^(\.\.\/)+(\S+):/$pdir$2:/;
print STDERR $_;
}
exit;
}
# Remove all buffering
select(STDIN);
$|=1;
select(STDOUT);
$|=1;
select(STDERR);
$|=1;
# Spawn a child to filter STDERR
xcodefilter();
# Call the real program
unshift @ARGV, "/usr/bin/make";
exec @ARGV;
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden