Re: Usage

Gary Oberbrunner <[email protected]> Tue, 23 Apr 2002 16:35:52 -0400
Newsgroups gmane.comp.gnu.cons.general
Message-ID <[email protected]>
The usual way to do this is to use Library in each conscript; Library is 
special because it allows multiple invocations, each contributes more 
.o's to the final library.

Then you'd just use Program in one of the conscripts to link the library 
in with your main.c (if any).  If you do it like this your dependencies 
will be correct.

Don't use AfterBuild for this.

-- Gary

Jason Thomas wrote:
> I have a large hierarchical system with a conscript file in
> each directory listing the details for the files in that directory.
> I include in the conscript file a call to Objects.  Most of my
> conscripts look like this:
> 
> Import qw( CONS );
> @SOURCES = qw(
>    foo.c
> );
> Objects $CONS @SOURCES;
> 
> In my Construct file I use the Build command to refer to all of
> the conscript files.
> 
> This of course produces a bunch of .o's.  Now I want to link
> them together.  If I use Program I get a message like:
> <whatever>
>    built (at least) two different ways:
> 
> If I use Command I don't see a way to assure that Command
> only executes at the end of all the objects being built.  Is AfterBuild
> supposed to run at the end of all other production rules?  I
> couldn't tell since I couldn't get it to run at all.
> 
> I've arranged my system this way because I only want the top
> level Construct to know about conscript files, but not the list of
> sources contained there.  I can abandon this if it's wishful thinking
> with cons.


_______________________________________________
[email protected]
http://mail.gnu.org/mailman/listinfo/cons-discuss
Cons URL: http://www.dsmit.com/cons/