#define HTMLDEST    "../../tmp/manual"

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

    compiler = setOpt(CXX, "CXX");

    cwd = chdir(".");

    md("tmp/manual/examples");
    md("tmp/manual/essence");

    chdir("documentation");

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

    chdir("manual");

    run("yodl2html -l3 bisonc++.yo");
    run("mv *.html " HTMLDEST);
    run("cp -r grammar/poly " HTMLDEST);
    run("cp -r grammar/essence " HTMLDEST);
    run("cp -r examples/rpn/* " HTMLDEST "/examples");

    exit(0);
}


