#define STAMP     "manual-stamp"
#define HTMLDEST    "../../tmp/manual"

void manual()
{
    list files;
    string file;
    string cwd;
    int idx;

    cwd = chdir(".");

    md("tmp/manual");

    special();

    chdir("documentation");

    if (!exists("usage/usage"))
    {
        chdir("usage");
        run("g++ -o usage usage.cc");
        if ("usage" newer "../manual/invoking/usage")
            run("./usage > ../manual/invoking/usage");
        chdir("..");
    }

    chdir("manual");

    files = makelist("*.yo") + makelist("*/*.yo");
    for (idx = sizeof(files); idx--; )
    {
        file = element(idx, files);
        if (file younger STAMP)
        {
            run("yodl2html -l3 bisonc++.yo");
            run("touch " STAMP);
            run("mv *.html " HTMLDEST);
            run("cp -r grammar/poly " HTMLDEST"/poly");
            break;
        }
    }

    exit(0);
}


