Author Topic: Dependencies and Custom Build Rules  (Read 3259 times)

mness1978

  • Guest
Dependencies and Custom Build Rules
« on: July 25, 2009, 06:39:29 am »
Hello, I'm new to Code::Blocks and seem to be having trouble with custom build rules.

I have a project that uses a parser generator called "peg" to generate a file called parser_core.cpp file.  Peg works much like bison in that it generates code based on a grammar file (parser.peg) input.  The parser_core.cpp file is then included into another file called parser.cpp.  My goal is to get the parser.cpp file to only be recompiled when the parser_core.cpp file has been changed, and that to only happen when the parser.peg file has been modified.

I have setup a custom build rule for the parser.peg file.  It calls the peg tool and outputs the parser_core.cpp file.  It works fine, except that it is called every time I build the project, even when the parser.peg file has not been modified.  How do I specify that there is a dependency between parser.peg and parser_core.cpp?  And how do I ensure that the custom rule is not executed unless the dependency is out of date?  I also need to specify this dependency between parser_core.cpp and parser.cpp.

Any help would be appreciated.

Thanks,
Mike