cons-discuss
[Top][All Lists]
Advanced

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

Re: [Cons-discuss] TAGS anyone? (long, sorry)


From: Doug Alcorn
Subject: Re: [Cons-discuss] TAGS anyone? (long, sorry)
Date: 21 Sep 2000 11:23:04 -0400
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Bryce Canyon)

Johan Holmberg <address@hidden> writes:

> #----------------------------------------------------------------------
> sub cons::TagsFile
> {
>     my($env) = shift;
>     my($tgt) = $dir::cwd->lookupfile($env->_subst(shift));
>     my($progenv) = $env->_resolve($tgt);
>     $tgt->bind(find build::command::linkedmodule($progenv,
>                                                  $progenv->{TAGSCOM}),
>              map($dir::cwd->lookupfile($env->_subst($_)), @_));
> }
> #----------------------------------------------------------------------

I don't really understand how this actually works.  I though I could
just "plug-n-chug".  However, after setting up all my Conscripts to
use it I have a few questions.

First, this function doesn't print out the command as it's executing.
I like to see what's going on.  The second question deals with when
the TagsFile command gets executed.  Here's what I have (sorry this is
so long, I trimmed it down as much as I thought I could):

,----[ ./topdir/Construct ]
| $TAGFILE = "#" . "TAGS";
| $common = "#commoon";
| $CONS = new cons( CC => 'g++', TAGSCOM => "etags --c++ -o %> %<",
|                   ENV => { PATH => "/usefull/path/setting" },
|                  );
| 
| Export qw (CONS TAGFILE common);
| Build qw( subdir1/Conscript );
|
| sub TagsFaile { ... }
`----

,----[ ./topdir/subdir/Conscript ]
| Import qw( TTSERVER OS common TAGFILE);
| 
| $BUILD = "#" . DirPath('.') . "/$OS/build";
| Export qw( BUILD CONS TAGFILE);
| Link "$BUILD/common" => $common;
| Build qw( $BUILD/common/Conscript );
| @files = ( "all.cpp", "my.cpp", "source.cpp", "files.cpp",  "in.cpp",
| "this.cpp", "dir.cpp", "$BUILD/common.o" );
| 
| Program $CONS "$BUILD/executable", @files;
| 
| foreach $file (@files) {
|   next if /\.o$/;                                       # skip objects
|   $file =~ s/\.cpp$/.h/;
|   next unless ( -f $file );
|   TagsFile $CONS $TAGFILE, $file;
| }
| 
| TagsFile $CONS $TAGFILE, qw( headerwithoutsource.h );
`----

,----[ ./topdir/common/Conscript ]
| Import qw(CONS TAGFILE);
| @files = qw( all.cpp my.cpp source.cpp files.cpp );
| LinkedModule $CONS "$BUILD/common.o", @files;
| 
| # make an array of header files that correspond to each 
| # source file.  If there are source files that don't have
| # header files of the same name, they will have to be
| # handled specially
| foreach $file (@files) {
|   next if /\.o$/;
|   $file =~ s/\.cpp$/.h/;
|   TagsFile $CONS $TAGFILE, $file;
| }
| 
| # add all the headers that don't have corresponding header
| # files
| TagsFile $CONS $TAGFILE, 
|   qw( TT_Constants.h
|       Registry.h
|       LogMessage.h
|       );
| 
| TagsFile $CONS $TAGFILE, @files;
`----

I have other subdirs, but this gets the idea across.  When I'm
building the executable in subdir1, I usually run 'cd ./topdir; cons
subdir1/'.  Notice that I'm putting the TAGS file in ./topdir and not
./topdir/subdir1.  I only want to build the TAGS file when I think it
needs to be updated; not with every compile.  I think rebuilding the
TAGS file with every compile isn't needed.  The TAGS file only needs
to be regenerated when new functions/variables have been added or the
layout of a specific file has changes dramatically.

Anyway, I want to do 'cd ./topdir; cons TAGS' to
generate the TAGS files.  This seems to work; however, when I do the
'cons subdir1' I get errors related to the TagsFile commands.
Specifically, before I put in the check of -f $file I was getting
complaints from cons about not knowing how to build
'subdir1/someheader.h' or 'common/anotherheader.h'.  Also, when I do
'cons TAGS' sometimes it goes off compiling some of my source files
into objects.  That's not what I expected at all.

Once again I would like to appologize for the length of this post.
The TagsFile command /does/ work.  I don't want to look like I'm
"looking a gift horse in the mouth".  I just had a couple of questions
about how it works.
-- 
 (__)  Doug Alcorn (mailto:address@hidden http://www.lathi.net)
 oo /  Unix Hacker
 |_/   "It's too late for paradise"



reply via email to

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