Boost logo

Boost-Build :

From: Sven Van Echelpoel (sven.van.echelpoel_at_[hidden])
Date: 2008-08-19 03:14:21


Hi,

I'm creating a generator for ANTLR using Boost.Build v2. By following
one of the samples I got everything to work, i.e. Boost.Build picks ups
any .g (grammar) file in the sources and generates the appropriate .cpp
and .h files. All I need right now is a way for adding the path to the
output directory to the requirements of target that has this .g file as
a source. How can I add an <include> feature from within the generator
rule? Most of what I learned about Boost.Build I got from pouring over
the code, but this one seems to elude me. Any help would be much
appreciated.

This is the generator rule I have so far:

rule antlr-compile-grammar
{
  local ANTLR_HOME = [ modules.peek : ANTLR_HOME ] ;
  local JARS = [ path.glob $(ANTLR_HOME)/lib : *.jar ] ;
  
  if [ os.name ] = NT
  {
      ANTLRCLASSPATH = [ string.join $(JARS) : ";" ] ;
      MV = ren ;
  }
  else
  {
      ANTLRCLASSPATH = [ string.join $(JARS) : ":" ] ;
      MV = mv ;
  }
}
actions antlr-compile-grammar
{
  "java" -classpath $(ANTLRCLASSPATH) org.antlr.Tool -fo $(<:D) $(>)
  "$(MV)" $(<:D)/$(<:B).c $(<)
}

Thanks,

Sven


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk