Eric MSP Veith | 9 Aug 2009 13:42
Gravatar

Question on handling directory trees


Hello List!

For this first time using Jam, I'm going to convert a project from CMake to 
it. I'm new to the list also, so: Hello everybody, please be kind to me. :-)

My directory structure looks like this:

Jamfile
Jamrules
src/foo
src/bar
src/baz
src/quux
src/quuz
include/myproject.h
include/myproject/foo.h
include/myproject/bar.h
...

The directories under src/ contain the .c source files, the headers reside 
in include/myproject.

What I want to archive is: Some source directories make up a static library, 
others verious tools that are linked against the library. E.g., src/foo and 
src/bar contain the .c files that will make up libmyproject.a, src/baz, 
src/quux and src/quuz the sources for three binaries that I want to link 
against libmyproject.a.

I'm following the guidelines in the Jam docu, but I'm stuck at the first 
(Continue reading)

Craig Allsop | 10 Aug 2009 06:27
Picon

Re: Question on handling directory trees

On Sun, Aug 9, 2009 at 9:42 PM, Eric MSP Veith<eveith <at> wwweb-library.net> wrote:
> This already makes Jam fail with "No SubInclude TOP src without prior SubDir
> TOP". I'm just confused because I didn't find that in the documentation. But
> I assume adding "SubDir TOP ;" in the toplevel Jamfile is correct and the
> way to go?

Yes, always have SubDir for each jamfile.

> Next, I want to build all the similar files under src/* in the same fasion.
> I though I could introduce a variable like "LIBRARY_SRC = foo bar ;", then
> glob all *.c files in those directories and hand them over to the "Objects"
> rule.
>
> When cd'ing into src, the follwing works:
>
>        SubDirHdrs $(TOP) include ;
>        SubDirHdrs $(TOP) include  myproject ;
>        LIBRARY_SRC = foo bar ;
>        Objects [ Glob $(LIBRARY_SRC) : *.c ] ;
>
> When running it from the toplevel directory, the glob just doesn't pick up
> anything. Do I have to use some variable with the Glob directive?

It expects a path, so you could use: $(SUBDIR)/$(LIBRARY_SRC) but
portable method is to use FDirName, however it only produces one path
so you'll need to invent another rule to accept your path list and
return multiple paths.

> And, finally, my third question: How can I automatically turn the list Glob
> creates from *.c to *.o? I don't want to use Glob again.
(Continue reading)

eveith | 10 Aug 2009 09:19
Gravatar

Re: Question on handling directory trees


Craig,

thanks, that's good help and a lot of information on where to read further.
:-)

        -- Eric

On Mon, Aug 10, 2009 at 02:27:16PM +1000, Craig Allsop wrote:
> On Sun, Aug 9, 2009 at 9:42 PM, Eric MSP Veith<eveith <at> wwweb-library.net> wrote:
> > This already makes Jam fail with "No SubInclude TOP src without prior SubDir
> > TOP". I'm just confused because I didn't find that in the documentation. But
> > I assume adding "SubDir TOP ;" in the toplevel Jamfile is correct and the
> > way to go?
> 
> Yes, always have SubDir for each jamfile.
> 
> > Next, I want to build all the similar files under src/* in the same fasion.
> > I though I could introduce a variable like "LIBRARY_SRC = foo bar ;", then
> > glob all *.c files in those directories and hand them over to the "Objects"
> > rule.
> >
> > When cd'ing into src, the follwing works:
> >
> >        SubDirHdrs $(TOP) include ;
> >        SubDirHdrs $(TOP) include  myproject ;
> >        LIBRARY_SRC = foo bar ;
> >        Objects [ Glob $(LIBRARY_SRC) : *.c ] ;
> >
> > When running it from the toplevel directory, the glob just doesn't pick up
(Continue reading)

Jeremy Cowgar | 11 Aug 2009 02:40
Gravatar

Executing commands in the same dir as Jamfile

Hello Jamming,

  I have a top level Jamfile that has

  ...
  SubInclude TOP docs ;
  ...

  Now,  in  the docs dir, I of course have another Jamfile. I define a
  custom  rule to build the docs. The problem is, the command to build
  the  docs needs to execute from the docs directory, but when I am at
  the top level and run jam makedocs it executes from the top level.

  How  can  I  execute  this command from the docs directory (i.e. the
  same directory the Jamfile containing the target)?

  Thanks!

--

-- 
Best regards,
 Jeremy                          mailto:jeremy <at> cowgar.com

_______________________________________________
jamming mailing list  -  jamming <at> maillist.perforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

Craig Allsop | 11 Aug 2009 04:33
Picon

Re: Executing commands in the same dir as Jamfile

The short answer:

cd $(<:P)
tool.exe -out $(<:BS) -in $(>:BS)

If your output / inputs are all over the place this won't work thus
you need the long answer.

Craig.

On Tue, Aug 11, 2009 at 10:40 AM, Jeremy Cowgar<jeremy <at> cowgar.com> wrote:
> Hello Jamming,
>
>  I have a top level Jamfile that has
>
>  ...
>  SubInclude TOP docs ;
>  ...
>
>  Now,  in  the docs dir, I of course have another Jamfile. I define a
>  custom  rule to build the docs. The problem is, the command to build
>  the  docs needs to execute from the docs directory, but when I am at
>  the top level and run jam makedocs it executes from the top level.
>
>  How  can  I  execute  this command from the docs directory (i.e. the
>  same directory the Jamfile containing the target)?
>
>  Thanks!
>
> --
(Continue reading)

Jeremy Cowgar | 11 Aug 2009 05:15
Gravatar

Re: Executing commands in the same dir as Jamfile

Hello Craig,

  I think maybe I need the long answer :-/

  Here is my rule/action and example use:

#
# Generate documentation using eudoc
#
# Example:
#   EuDoc manual : manual.af : euphoria.txt : tmpl.html ;
#

rule EuDoc
{
    if ! $(EUDOC_SOURCE)
    {
        Depends $(<) : get_eudoc ;

        EUDOC_SOURCE = [ FDirName $(TOP) source eudoc eudoc.ex ] ;
        CREOLEHTML_SOURCE = [ FDirName $(TOP) source eudoc creole creolehtml.ex ] ;
    }

    ASSEMBLY_FILE on $(<) = $(2) ;
    CREOLE_FILE on $(<) = $(3) ;
    TEMPLATE on $(<) = $(4) ;
}

actions EuDoc
{
(Continue reading)

Jeremy Cowgar | 11 Aug 2009 05:21
Gravatar

Re: Executing commands in the same dir as Jamfile

Hello Jeremy,

  Oh! Those :BS's were not in there originally. That was me playing. I
  forgot to remove them before posting to the mailing list.

Jeremy
mailto:jeremy <at> cowgar.com

============
Monday, August 10, 2009, 11:15:37 PM, you wrote:

> Hello Craig,

>   I think maybe I need the long answer :-/

>   Here is my rule/action and example use:

> #
> # Generate documentation using eudoc
> #
> # Example:
> #   EuDoc manual : manual.af : euphoria.txt : tmpl.html ;
> #

> rule EuDoc
> {
>     if ! $(EUDOC_SOURCE)
>     {
>         Depends $(<) : get_eudoc ;

(Continue reading)

Diane Holt | 11 Aug 2009 05:56
Picon

Re: Executing commands in the same dir as Jamfile

You can do it in the actions block. But the better question is why do you need to run it specifically from there?  Can your tool not cope with full-path filenames being handed to it?

Diane

On Mon, Aug 10, 2009 at 5:40 PM, Jeremy Cowgar <jeremy <at> cowgar.com> wrote:
Hello Jamming,

 I have a top level Jamfile that has

 ...
 SubInclude TOP docs ;
 ...

 Now,  in  the docs dir, I of course have another Jamfile. I define a
 custom  rule to build the docs. The problem is, the command to build
 the  docs needs to execute from the docs directory, but when I am at
 the top level and run jam makedocs it executes from the top level.

 How  can  I  execute  this command from the docs directory (i.e. the
 same directory the Jamfile containing the target)?

 Thanks!

--
Best regards,
 Jeremy                          mailto:jeremy <at> cowgar.com

_______________________________________________
jamming mailing list  -  jamming <at> maillist.perforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

_______________________________________________
jamming mailing list  -  jamming <at> maillist.perforce.com
http://maillist.perforce.com/mailman/listinfo/jamming
Craig Allsop | 11 Aug 2009 06:06
Picon

Re: Executing commands in the same dir as Jamfile

Well the medium answer is, stage your inputs into temp folder, e.g.
use Bulk dir : sources
where dir is your LOCATE_TARGET and build it all into the same folder.
Then copy out your output where you want it.

Craig.

On Tue, Aug 11, 2009 at 1:21 PM, Jeremy Cowgar<jeremy <at> cowgar.com> wrote:
> Hello Jeremy,
>
>  Oh! Those :BS's were not in there originally. That was me playing. I
>  forgot to remove them before posting to the mailing list.
>
> Jeremy
> mailto:jeremy <at> cowgar.com
>
> ============
> Monday, August 10, 2009, 11:15:37 PM, you wrote:
>
>> Hello Craig,
>
>>   I think maybe I need the long answer :-/
>
>>   Here is my rule/action and example use:
>
>> #
>> # Generate documentation using eudoc
>> #
>> # Example:
>> #   EuDoc manual : manual.af : euphoria.txt : tmpl.html ;
>> #
>
>> rule EuDoc
>> {
>>     if ! $(EUDOC_SOURCE)
>>     {
>>         Depends $(<) : get_eudoc ;
>
>>         EUDOC_SOURCE = [ FDirName $(TOP) source eudoc eudoc.ex ] ;
>>         CREOLEHTML_SOURCE = [ FDirName $(TOP) source eudoc creole creolehtml.ex ] ;
>>     }
>
>>     ASSEMBLY_FILE on $(<) = $(2) ;
>>     CREOLE_FILE on $(<) = $(3) ;
>>     TEMPLATE on $(<) = $(4) ;
>> }
>
>> actions EuDoc
>> {
>>     $(EUI_EXE) $(EUDOC_SOURCE:BS) -v -a $(ASSEMBLY_FILE:BS) -o $(CREOLE_FILE:BS)
>>     $(EUI_EXE) $(CREOLEHTML_SOURCE) -A=ON -t=$(TEMPLATE:BS) -ohtml $(CREOLE_FILE:BS)
>> }
>
>
>> In  the  example  case, EuDoc manual ... manual is the target to call,
>> manual.af  is  an  assembly  file  in  the  same  dir  as the Jamfile.
>> euphoria.txt  is an interim file that eudoc writes, then creole 2 html
>> reads  and  produces  HTML docs from. tmpl.html is a template for each
>> page. Here's a sample dir layout:
>
>> C:\euphoria\source\eudoc\eudoc.ex
>> C:\euphoria\source\eudoc\creole\creolehtml.ex
>> C:\euphoria\Jamfile  <--- root Jamfile
>> C:\euphoria\docs\Jamfile  <--- Jamfile containing EuDoc manual : ... ;
>> C:\euphoria\docs\manual.af
>> C:\euphoria\docs\tmpl.html
>
>
>> Then it is run from the root Jamfile, which includes:
>
>> SubInclude TOP doc ;
>
> C:\euphoria>> jam manual
>
>
>> Jeremy
>> mailto:jeremy <at> cowgar.com
>
>> ============
>> Monday, August 10, 2009, 10:33:37 PM, you wrote:
>
>>> The short answer:
>
>>> cd $(<:P)
>>> tool.exe -out $(<:BS) -in $(>:BS)
>
>>> If your output / inputs are all over the place this won't work thus
>>> you need the long answer.
>
>>> Craig.
>
>>> On Tue, Aug 11, 2009 at 10:40 AM, Jeremy Cowgar<jeremy <at> cowgar.com> wrote:
>>>> Hello Jamming,
>>>>
>>>>  I have a top level Jamfile that has
>>>>
>>>>  ...
>>>>  SubInclude TOP docs ;
>>>>  ...
>>>>
>>>>  Now,  in  the docs dir, I of course have another Jamfile. I define a
>>>>  custom  rule to build the docs. The problem is, the command to build
>>>>  the  docs needs to execute from the docs directory, but when I am at
>>>>  the top level and run jam makedocs it executes from the top level.
>>>>
>>>>  How  can  I  execute  this command from the docs directory (i.e. the
>>>>  same directory the Jamfile containing the target)?
>>>>
>>>>  Thanks!
>>>>
>>>> --
>>>> Best regards,
>>>>  Jeremy                          mailto:jeremy <at> cowgar.com
>>>>
>>>> _______________________________________________
>>>> jamming mailing list  -  jamming <at> maillist.perforce.com
>>>> http://maillist.perforce.com/mailman/listinfo/jamming
>>>>
>
>> _______________________________________________
>> jamming mailing list  -  jamming <at> maillist.perforce.com
>> http://maillist.perforce.com/mailman/listinfo/jamming
>
>

_______________________________________________
jamming mailing list  -  jamming <at> maillist.perforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

Jeremy Cowgar | 11 Aug 2009 14:09
Gravatar

Re: Executing commands in the same dir as Jamfile

Hello Diane,

  I'm not sure how it would. manual.af contains relative paths (to itself) on where to find files. For instance,

  intro.txt
  database.txt
  ref1.txt
  ../include/std/sequence.e
  ../include/std/regex.e

  Now, say that I make the app do path translations relative to where the manual.af whas specified on the
command line.

  Now my Jam file must look like this:

  C:\euphoria> type Jamfile
  ...
  SubInclude $(TOP) docs ;
  ...
  C:\euphoria\docs> type Jamfile
  ...
  EuDoc manual : docs\manual.af : docs\html : ... ;
  ...

  That seems silly as I'm already in the docs directory. Now, what happens if I an working on docs, so I am already
  in the C:\euphoria\docs directory and I type jam from there.

Jeremy
mailto:jeremy <at> cowgar.com

============
Monday, August 10, 2009, 11:56:21 PM, you wrote:

You can do it in the actions block. But the better question is why do you need to run it specifically from
there?  Can your tool not cope with full-path filenames being handed to it?

Diane

On Mon, Aug 10, 2009 at 5:40 PM, Jeremy Cowgar <jeremy <at> cowgar.com> wrote:
Hello Jamming,

 I have a top level Jamfile that has

 ...
 SubInclude TOP docs ;
 ...

 Now,  in  the docs dir, I of course have another Jamfile. I define a
 custom  rule to build the docs. The problem is, the command to build
 the  docs needs to execute from the docs directory, but when I am at
 the top level and run jam makedocs it executes from the top level.

 How  can  I  execute  this command from the docs directory (i.e. the
 same directory the Jamfile containing the target)?

 Thanks!

--
Best regards,
 Jeremy                          mailto:jeremy <at> cowgar.com

_______________________________________________
jamming mailing list  -  jamming <at> maillist.perforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

Hello Diane,

  I'm not sure how it would. manual.af contains relative paths (to itself) on where to find files. For instance,

  intro.txt
  database.txt
  ref1.txt
  ../include/std/sequence.e
  ../include/std/regex.e

  Now, say that I make the app do path translations relative to where the manual.af whas specified on the command line.

  Now my Jam file must look like this:

  C:\euphoria> type Jamfile
  ...
  SubInclude $(TOP) docs ;
  ...
  C:\euphoria\docs> type Jamfile
  ...
  EuDoc manual : docs\manual.af : docs\html : ... ;
  ...
  
  That seems silly as I'm already in the docs directory. Now, what happens if I an working on docs, so I am already
  in the C:\euphoria\docs directory and I type jam from there.

Jeremy
mailto:jeremy <at> cowgar.com

============
Monday, August 10, 2009, 11:56:21 PM, you wrote:


You can do it in the actions block. But the better question is why do you need to run it specifically from there?  Can your tool not cope with full-path filenames being handed to it?

Diane

On Mon, Aug 10, 2009 at 5:40 PM, Jeremy Cowgar <jeremy <at> cowgar.com> wrote:
Hello Jamming,

 I have a top level Jamfile that has

 ...
 SubInclude TOP docs ;
 ...

 Now,  in  the docs dir, I of course have another Jamfile. I define a
 custom  rule to build the docs. The problem is, the command to build
 the  docs needs to execute from the docs directory, but when I am at
 the top level and run jam makedocs it executes from the top level.

 How  can  I  execute  this command from the docs directory (i.e. the
 same directory the Jamfile containing the target)?

 Thanks!

--
Best regards,
 Jeremy                          mailto:jeremy <at> cowgar.com

_______________________________________________
jamming mailing list  -  jamming <at> maillist.perforce.com
http://maillist.perforce.com/mailman/listinfo/jamming
_______________________________________________
jamming mailing list  -  jamming <at> maillist.perforce.com
http://maillist.perforce.com/mailman/listinfo/jamming

Gmane