cons-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Clearcase and cons Link woes


From: Greg Spencer
Subject: RE: Clearcase and cons Link woes
Date: Fri, 29 Mar 2002 10:07:39 -0700

When I was developing my MSDEV extensions to Cons (which are now
woefully out of date, I realize), the tack I took was to allow cons to
go ahead and link the files into the build directory, but I added an
escape for the %< argument called ":S" that would interpret the path as
the source of the Link, rather than the destination.  That way, when you
compile, the MSDEV compiler uses the source of the link to compile with,
but cons decides to compile it when the destination of the link is out
of date.  The compiler still outputs all results into the "build" tree,
so there's no pollution of the source tree.

The reason for this was so that the user could double-click on an error
in MSDEV, and get the right file (the right file being the source file,
as in your case).

The two relevant modifications were to the CCOM environment variable,
and to the _variant helper function.  I've attached a copy of the ones I
use below.

I hope that helps...

                        -Greg.

--
CXXCOM  => '%CXX %CXXFLAGS %_IFLAGS /c %<:S /Fo%>:d\\',
--
# internal routine to process variable options.
# f: return file part
# F: return file part, but strip any suffix
# d: return directory part
# b: return path, but strip any suffix (a.k.a. return basename)
# s: return only the suffix (or an empty string, if no suffix is there)
# a: return the absolute path to the file.
# S: return the absolute path to the source file.
# no option: return path to file
sub _variant {
  my $opt = shift;
  my $tgt = shift;
  my $isrfile = shift;

  if ($opt eq 'f') { return $tgt->{entry}; }
  elsif ($opt eq 'd') { 
    return $isrfile ? $tgt->rfile->{dir}->path : $tgt->{dir}->path;
  }
  elsif ($opt eq 'F') {
    my $subst = $tgt->{entry};
    $subst =~ s/\.[^\.]+$//;
    return $subst;
  }
  elsif ($opt eq 'b') {
    my $subst = $isrfile ? $tgt->rpath : $tgt->path;
    $subst =~ s/\.[^\.]+$//;
    return $subst;
  }
  elsif ($opt eq 's') {
    my $file = $tgt->{entry};
    $file =~ m/(\.[^\.]+)$/;
    return $1;
  }
  elsif ($opt eq 'a') {
    my $cwd = Cwd::cwd();
    my $path = $isrfile ? $tgt->rpath : $tgt->path;
    $cwd .= $main::DIR_SEPARATOR.$path;
    return $cwd;
  }
  elsif ($opt eq 'S') {
    my $cwd = Cwd::cwd();
    $cwd =~ s,$main::DIR_SEP_REGEXP,$main::DIR_SEPARATOR,g;
    $cwd .= $main::DIR_SEPARATOR.$tgt->srcpath;
    return $cwd;
  }
  else {
    my $path = $isrfile ? $tgt->rpath : $tgt->path;
    return $path;
  }
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]