
void install(string dest)
{
    string target;
    list pathsplit;
    string base;
    base = "tmp/install/";

    md(base);

    target = base + BINARY;
    pathsplit = path_file(target);

    printf("  installing the executable `", target, "'\n");
    logFile("tmp/bin", "binary", pathsplit[0], pathsplit[1]);

    chdir(g_cwd);
    if (dest == "")
        dest = "/";
    else
        md(dest);

    dest = cutEoln(backtick("realpath " + dest)[0]);

    if (g_logPath != "")
        backtick("icmake/log " + dest + " " + g_logPath);

    run("tar cf - -Ctmp/install . | tar xf - -C" + dest);

    printf("\n  Installation completed\n");

    exit(0);
}
