示例#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 );
}
示例#2
0
static void addFileToList( HWND hwnd, char *fname )
{
    HWND        ctl;
    int         item;
    int         match;
    WFileName   fullname;
    bool        isLong = false;

    size_t len = strlen( fname ) - 1;
    if( fname[0] == '"' && fname[len] == '"' ) {
        fname++;
        fname[len - 1] = '\0';
        isLong = true;
    } else {
        WFileName filename( fname );
        isLong = filename.needQuotes();
    }

    match = findMatchingFile( hwnd, fname );
    ctl = GetDlgItem( hwnd, FOD_FILELIST );
    if( match == LB_ERR ) {
        if( IsDlgButtonChecked( hwnd, FOD_STORE_ABSOLUTE ) ) {
            getFullFname( hwnd, fname, &fullname );
        } else {
            getRelFname( hwnd, fname, &fullname );
        }
//        fullname.toLower();
        if( isLong ) {
            fullname.addQuotes();
        }
        item = (int)SendMessage( ctl, LB_ADDSTRING, 0, (LPARAM)(LPSTR)fullname.gets() );
    } else {
        item = match;
    }
    SendMessage( ctl, LB_SETCURSEL, item, 0 );
    checkRemoveButton( hwnd );
}
示例#3
0
void MComponent::writeRule( ContFile& mak )
{
    if( !_target->ismakeable() ) return;

    WFileName tgt;
    _target->absName( tgt );

    for( int i=0; i<_workFiles.count(); i++ ) {
        MWorkFile* w = (MWorkFile*)_workFiles[i];
        MItem* m = w->item();
        if( !m->isMask() && m->ismakeable() ) {
            WFileName r;
            m->absResult( r );
            if( r.needQuotes() ) {
                r.addQuotes();
            }
            if( w->needQuotes() ) {
                w->addQuotes();
            }
            mak.printf( "%s : %s", (const char*)r, (const char*)*w );
            r.removeQuotes();
            w->removeQuotes();
            if( _autodepend ) mak.puts( " .AUTODEPEND" );
            mak.puts( "\n" );
            WString c;
            w->makeCommand( c, NULL );
            writeTargetCD( mak );
            mak.puts( c );
            mak.puts( "\n" );
            w->puts( r );       //setup for later use by target-maker
        }
    }
    if( tgt.needQuotes() ) {
        tgt.addQuotes();
    }
    mak.printf( "%s :", (const char*)tgt );
    tgt.removeQuotes();
    int jcount = _workFiles.count();
    for( int j=0; j<jcount; j++ ) {
        MWorkFile* w = (MWorkFile*)_workFiles[j];
        if( !w->isMask() ) {
            if( w->needQuotes() ) {
                w->addQuotes();
            }
            mak.printf( " %s", (const char*)*w );
            w->removeQuotes();
            w->relativeTo( _filename );
        }
    }
    if( _autodepend ) mak.puts( " .AUTODEPEND" );
    mak.puts( "\n" );
    bool browseable = writeCBR();
    if( _target->ismakeable() ) {
        WFileName fn; _target->absName( fn );
        MWorkFile w( fn, _mode, _target, this );
        WString c;
        if( browseable && _config->browseMerge().size() > 0 ) {
            MCommand cmd;
            cmd.concatf( " %s @$*.cbr", (const char*)_config->browseMerge() );
            expand( c, cmd );
        }
        expand( c, _before );
        w.makeCommand( c, &_workFiles );
        expand( c, _after );
        writeTargetCD( mak );
        mak.puts( c );
        mak.puts( "\n" );
    }
}