Example #1
0
bool MProject::makeMakeFile( bool long_lines )
{
    bool ok = true;
    if( needsMake() || !_makefile.attribs() ) {
        _filename.setCWD();
        ContFile        pmak;
        if( long_lines )
            pmak.long_lines();
        if( !pmak.open( _makefile, OStyleWrite ) ) {
            ok = false;
        } else {
            expand( pmak, _before, ".before" );
            expand( pmak, _after, ".after" );
            pmak.puts( "project :" );
            int icount = _components.count();
            int i;
            for( i=0; i<icount; i++ ) {
                MComponent* comp = (MComponent*)_components[i];
                if( comp->rule()->ismakeable() ) {
                    WFileName fn;
                    comp->target()->absName( fn );
                    if( fn.needQuotes() ) {
                        fn.addQuotes();
                    }
                    pmak.puts( " " );
                    pmak.puts( fn );
                    fn.removeQuotes();
                }
            }
            pmak.puts( " .SYMBOLIC\n" );
            pmak.puts( "\n" );

            for( i=0; i<icount; i++ ) {
                MComponent* comp = (MComponent*)_components[i];
                if( comp->rule()->ismakeable() ) {
                    comp->addMakeFile( pmak );
                }
            }
            pmak.close();
            ok = pmak.ok();
        }
    }
    if( ok ) {
        int icount = _components.count();
        for( int i=0; i<icount; i++ ) {
            MComponent* comp = (MComponent*)_components[i];
            if( comp->rule()->ismakeable() ) {
                ok = ok & comp->makeMakeFile( long_lines );
            }
        }
    }
    if( ok ) setNeedsMake( false );
    return( ok );
}