void main(int argc, list argv, list envp)
{
    echo(USE_ECHO);

    setGcompiler();

    getCommand(argv);               // determine command and option

    setClasses();                   // assign g_classes and g_nClasses
                                    // note: also used by clean()
    #ifdef MAIN
        g_mainBase = get_base(MAIN);    // also used by clean()
    #endif

    // run the requested command:

    if (g_command == _clean)        // completely clean tmp and 
        clean();                    // locally defined precompiled headers

    if (g_command == _cleanTmp)     // keep the .gch files if existing.
        cleanTmp();

    if (g_command == _cleanGch)
        cleanPrecomp();
        
    #ifdef SPCH
        #ifdef PRECOMP
            spchPrecomp();            
        #endif
        #ifdef CLS
            cls();
        #endif
        precompileSPCH();
    #endif        

    #ifdef PRECOMP
        #ifdef SPCH
            spchPrecomp();            
        #endif
        md(g_gchDir);
    #endif

    if (g_command == _install)
        install();                  // install a compiled product

    #ifdef CLS
        cls();
    #endif
                                    // compile all sources except MAIN
    build_libraries();              // if PRECOMP then precompiles headers 

    if (g_command == _program)
        program();

    #ifdef USE_ALL
        cleanUseAll();
    #endif

    #ifdef PRECOMP
        storeGch();
    #endif
}
