cons-discuss
[Top][All Lists]
Advanced

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

true path


From: Steven_Shaw
Subject: true path
Date: Fri, 27 Apr 2001 21:57:32 +1000

Hi.

I am currently attempting a conversion of my project custom make environment to
cons. I'm finding that adding a function such as:

     sub cons::truePath {
         my ($env) = shift;
         my ($file) = shift;
         $dir::cwd->lookupfile($env->_subst($file))->path;
     }

to my Construct is very helpful. This is because when linking an executable (via
cons::Program) I must alter the cons environment so that the appropriate
libraries are included. Unless I use truePath on them, they end up on the
command line as specified. Here is an example from a prototype Conscript:

     # Take a copy of the environment to add appropriate LIBS
     %regressEnv = $CONS->copy();

     for my $lib (@libs) {
         $regressEnv{LIBS} .= ' ' .
$CONS->truePath("#server/$lib/${lib}_s%SUFLIB");
     }

     $regressEnv{LIBS} .= ' ' . $CONS->truePath('sdm%SUFLIB');
     $regressEnv{LIBS} .= ' ' . $CONS->truePath('#tuxedo/tux_s%SUFLIB');
     $regressEnv{LIBS} .= " %ATALIBS";
     $regressEnv = new cons(%regressEnv);

     # build executable linking against the correct LIBS
     $regressEnv->Program('sdm_regress', 'c/sdm_regress.c');

Does this seem right?
Is there a way to avoid the use of truePath?
Is there a different way to build executables that require linking against
specific libraries?
Is there a better idiom for using a modified copy of the environment to add a
build rule (seems like a struggle)?

cheers,

Steve.





reply via email to

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