cons-discuss
[Top][All Lists]
Advanced

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

Re: $cons{LIBS} and dependencies


From: Steven Knight
Subject: Re: $cons{LIBS} and dependencies
Date: Sat, 28 Apr 2001 22:21:54 -0500 (CDT)

> > > Depends $CONS "$TARGET", ( "$EXPORT/lib/libfoo.a",
> > > "$EXPORT/lib/libbar.a","$EXPORT/lib/libbaz.a");
> > >
> > > In order to get the libraries built.  Is this normal?  Note that I do
> > > have Library commands in my Conscripts to build libfoo.a libbar.a and
> > > libbaz.a.
> >
> > Assuming you have the $EXPORT/lib directory somewhere in the
> > environment's LIBPATH, you shouldn't have to specify the dependencies
> > explicitly like this.
>
> I have several "modules" within the same build environment.  I create
> the cons environment in the main Construct and export it.  Then in the
> main directory I modify that cons environment with a bunch of module
> specific stuff (like LIBPATH, LIBS, CPPPATH, and CFLAGS).  Here's what
> I have in the main Conscript for one of the modules.
>
> Import qw( CONS OS PLATFORM CHIP common SERVERDIR );
>
> $EXPORT = "$SERVERDIR/export";
> ${$CONS}{LIBPATH} .= "$EXPORT/libs";

Um... Cons also assumes that you don't have typos in your specification
of LIBPATH... :-)  Since all of your libraries below are in the
"$EXPORT/lib" directory, you might want to remove the 's' from "libs" in
the line above.

> ${$CONS}{LIBS} .= "-lfoo -lbar -lbaz";
> @LIBS = ("$EXPORT/lib/libfoo.a","$EXPORT/lib/libbar.a","$EXPORT/lib/libbaz.a" 
> );
> push @{${$CONS}{CPPPATH}}, ("#foodir", "#bardir", "#bazdir");

Wayne Scott's right about using clone() being the right way to build
something with a modified environment.  Directly modifying construction
variables like this is not guaranteed to work (although it does for many
of them).  Roughly equivalent to the above (modulo typos of my own ;-):

        $CONS->clone(
                LIBPATH => $CONS->{LIBPATH} . "$EXPORTS/libs",
                LIBS => $CONS->{LIBS} . "-lfoo -lbar -lbaz",
                CPPPATH => address@hidden>{CPPPATH}}, "#foodir", "#bardir", 
"#bazdir"],
        );

Note also the use of $CONS->{LIBPATH} (e.g.), which most people find a
more readable way to access variables than ${$CONS}{LIBPATH}.

        --SK




reply via email to

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