void precompile(string class)
{
    string classIH = class + IH;
    if (!exists(classIH))
    {
        #ifndef NO_PRECOMP_WARNING
            printf("[Warning] CAN'T PRECOMPILE ", class, "/", classIH, 
                    " (unavailable)\n");
        #endif
        return;
    }
    string classGch = classIH + ".gch";
    string storedGch = g_cwd + g_gchDir + '/' + classGch;

        // if the gch file doesn't exist but the gch file in gchDir does
        // then mv the gchDir file to the current directory
    if (!exists(classGch) && exists(storedGch))
    {
        echo(OFF);
        system("mv " + storedGch + " .");
        echo(USE_ECHO);
    }

        // if the current gch file is older than the IH file then renew
        // the gch file
    if (classGch older classIH)
        system(g_compiler + " " PRECOMP " " + classIH);
}

void precompileHeaders()
{
    list classes = makelist(O_SUBDIR, "*");

    for (int idx = listlen(g_classes); idx--; )
    {
        string class = g_classes[idx];

        chdir(class);
        precompile(class);        
        chdir(g_cwd);
    }
}
