On Wed, Sep 5, 2012 at 5:59 PM, BB <
britt...@gmail.com> wrote:
> I worked through this problem for my own project this morning. I'm building
> various .a files with a Tupfile in each directory, then linking them with
> application code in another directory with it's own Tupfile. All of this
> going to a single variant directory at the top of the tree...
>
> What I had to do was use sed to convert the FUSE pwd under .tup to the
> actual directory where the source lives and combine that with gcc's
> -fdebug-prefix-map option...
>
> I had to create an @-variable in my variant's tup.config file:
>
> CONFIG_FILEPATH=`pwd|sed 's/.*tupjob-[0-9]*\(.*\)/\1/'|sed
> 's:build_default/::'`
>
> (my variant is called build_default, which you can see is encoded in the 2nd
> use of sed)
>
> Then I changed my !cc rules:
>
> !cc = |> ^ CC %f^ $(CC) -fdebug-prefix-map=`pwd`=@(FILEPATH) @(VAR_CFLAGS)
> -c `pwd`/%f -o %o $(CFLAGS) $(CFLAGS_%f) |> %B.o
>
> Now all of my .o files are compiled with the fullpath to the source so that
> gdb can find the source regardless of where I move the compiled binary.
>
> Enjoy!
>
> Britt
That is... inventive :). Definitely makes me realize that the current
implementation of variants is not ideal. It is supposed to be as
another. Having to add all this extra stuff for the debug build is a