[jamming] BJam's command/shell execution
Diane Holt
holt.diane at gmail.com
Fri Mar 23 11:38:56 PST 2007
Unless bjam has changed the way a var is referenced, try:
Echo REV is $(REV) ;
(Note the parens ... I added the "REV is" so you can see the line, even if
REV doesn't have a value.)
Diane
On 3/23/07, Josh Pollak <jpollak at kivasystems.com> wrote:
>
> On Fri, 2007-03-23 at 08:57 -0700, Diane Holt wrote:
> > I haven't used bjam myself, but have you tried:
> >
> > REV = [ Shell "svnversion" ] ;
>
> That doesn't seem to work:
>
> # Begin Jamfile
> REV = [ Shell "svnversion" ] ;
>
> echo $REV ;
> # End Jamfile
>
> -------------------------------------
>
> jpollak at moya:~/src/myproj$ jam
> $REV
> ...found 8 targets...
> ...updating 1 target...
> Shell svnversion
> /bin/sh: Syntax error: redirection unexpected
>
> awk '
> NR == 1 { print "#!/bin/sh" }
> NR == 1 && /^[#:]/ { next }
> /^##/ { next }
> { print }
> ' < > svnversion
>
> ...failed Shell svnversion...
> ...failed updating 1 target...
>
> Oh well, I'm sure I'm doing something wrong.
>
> -Josh
>
> > Diane
> >
> > On 3/23/07, Joshua ChaitinPollak <jpollak at kivasystems.com> wrote:
> > I saw that, but I can't figure out how to make it work...
> >
> >
> > I thought the syntax would be something like:
> >
> >
> > Shell "svnversion" : $REV ;
> >
> >
> > But that doesn't work.
> >
> >
> > Also, and this may be because of the way I'm using bjam, but
> > it seems to be conflicting with Jam's Shell command (Which
> > seems to check the file is a shell script, and then chmod's
> > it?).
> >
> >
> > -Josh
> >
> > On Mar 23, 2007, at 11:46 AM, Diane Holt wrote:
> >
> > > Boost Jam has this (it's what I patterned the Command
> > > built-in after):
> > >
> > >
> > > The SHELL Rule
> > > rule SHELL ( command )
> > >
> > > SHELL executes command, and then returns the standard output
> > > of command. SHELL only works on platforms with a popen()
> > > function in the C library. On platforms without a working
> > > popen() function, SHELL is implemented as a no-op. SHELL
> > > works on Unix, MacOS X, and most Windows compilers. SHELL is
> > > a no-op on Metrowerks compilers under Windows.
> > >
> > >
> > >
> > > On 3/22/07, Joshua ChaitinPollak <jpollak at kivasystems.com>
> > > wrote:
> > > Hi,
> > >
> > > I'm using BJam, and I can't figure out how to get
> > > the shell script
> > > execution working. I know there was a recent thread
> > > about a COMMAND
> > > patch for Jam, and I'm looking forward to that, but
> > > for now I'm using
> > > BJam and I don't have the time to apply patches and
> > > compile, etc.
> > >
> > > I've ported most of my project to Jam, but I have
> > > one Makefile I
> > > can't figure out how to ditch. I have this Makefile
> > > code:
> > >
> > > REVISION := $(shell svnversion)
> > > OLD_REVISION := $(shell cat revision.cpp
> > > 2> /dev/null)
> > >
> > > revision.cpp:
> > > ifeq (,$(findstring \"{REVISION}\",
> > > ${OLD_REVISION}))
> > > @echo "void config::getRevision(std::string& rev)
> > > { rev = \"$
> > > {REVISION}\"; } >> revision.cpp
> > > endif
> > >
> > > This (should) effectively (re)builds revision.cpp if
> > > the revision has
> > > changed. My program depends in revision.cpp, so if
> > > revision has
> > > changed, the file gets rebuild and the program gets
> > > rebuilt.
> > >
> > > How would I do this in a Jam way? I guess I could
> > > call a shell script
> > > to build the revision.cpp file all the time, but I'd
> > > rather not
> > > unless its out of date.
> > >
> > > -Josh
> > >
> > > --
> > > Joshua ChaitinPollak
> > > Software Engineer
> > > Kiva Systems
> > >
> > > _______________________________________________
> > > jamming mailing list - jamming at perforce.com
> > > http://maillist.perforce.com/mailman/listinfo/jamming
> > >
> >
> >
> > --
> > Joshua ChaitinPollak
> > Software Engineer
> > Kiva Systems
> >
> >
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://maillist.perforce.com/pipermail/jamming/attachments/20070323/eb69dd76/attachment.html
More information about the jamming
mailing list