[Cook] Recipe for Gentle Compiler

Henderson, Michael D michael.d.henderson at lmco.com
Wed Sep 22 02:15:01 EST 2004


I'm trying to create a recipe for compiling gentle files (please see the illustration at http://gentle.compilertools.net/start-fs.html to get an overview of the process). I'm running into a problem when the source file is in a subdirectory. I want the gentle files to be created there, but they're being created in the directory that I run cook from.

I started off with a copy of the rules for my C++ source. The %0% works there.

/*=======================================================
 * rule to force a C++ source file to compile in the current directory
 */
%0%.o: %0%.cpp: [collect c_incl -api [inc_all] %0%.cpp]
{
  [c++] [c++_flags] -c %0%.cpp -o [target];
}

But it's not creating the files in the right place on the gentle rules. Am I doing something wrong with the %0%? Do I need to cd into the source directory since gentle doesn't allow me to specify output file names? Maybe I should just move them?

Should I be using %0% to specify the path for the lex and yacc commands?

/*=======================================================
 * rule to compile a gentle file in the correct directory
 */
%0%.c gen.lit gen.tkn gen.y gen.h: %0%.g:
{
  [cmd_gentle] %0%.g;
}

/*=======================================================
 * rule to reflex a file in the correct directory
 */
%0%.l: %0%.g gen.lit gen.tkn:
{
  [cmd_reflex] %0%.g;
}

/*=======================================================
 * run lex against reflex output
 */
lex.yy.c: gen.l
{
  [cmd_lex] gen.l;
}

/*=======================================================
 * run yacc against gentle output
 */
y.tab.c: gen.y
{
  [cmd_yacc] gen.y;
}


Thanks,
Mike




More information about the Cook-users mailing list