From 263721be6cc1fe995f5387eca28eada5d0c67c15 Mon Sep 17 00:00:00 2001 From: cas Date: Wed, 3 Nov 1999 18:05:01 +0000 Subject: [PATCH] No comments --- src/WOKBuilder/WOKBuilder_Compiler.cdl | 5 ++ src/WOKBuilder/WOKBuilder_Compiler.cxx | 83 +++++++++++++++++++ .../WOKBuilder_CompilerIterator.cdl | 2 + .../WOKBuilder_CompilerIterator.cxx | 3 + src/WOKBuilder/WOKBuilder_Linker.cxx | 32 ++++++- 5 files changed, 123 insertions(+), 2 deletions(-) diff --git a/src/WOKBuilder/WOKBuilder_Compiler.cdl b/src/WOKBuilder/WOKBuilder_Compiler.cdl index 17a56a9..a111562 100755 --- a/src/WOKBuilder/WOKBuilder_Compiler.cdl +++ b/src/WOKBuilder/WOKBuilder_Compiler.cdl @@ -48,4 +48,9 @@ fields myincdirs : HSequenceOfPath from WOKUtils; mydbdirs : HSequenceOfPath from WOKUtils; myoptions : HAsciiString from TCollection; + myCmdLine : HAsciiString from TCollection; + +friends + + class CompilerIterator from WOKBuilder end Compiler; diff --git a/src/WOKBuilder/WOKBuilder_Compiler.cxx b/src/WOKBuilder/WOKBuilder_Compiler.cxx index 2d41b8b..9cacf73 100755 --- a/src/WOKBuilder/WOKBuilder_Compiler.cxx +++ b/src/WOKBuilder/WOKBuilder_Compiler.cxx @@ -21,6 +21,10 @@ #include +#include +#include +#include + //======================================================================= //function : WOKBuilder_Compiler //purpose : @@ -154,6 +158,10 @@ void WOKBuilder_Compiler::SetCompilable(const Handle(WOKBuilder_Compilable)& afi //======================================================================= WOKBuilder_BuildStatus WOKBuilder_Compiler::Execute() { + + static Handle( TCollection_HAsciiString ) NL = new TCollection_HAsciiString ( " \\\n " ); + static Handle( TCollection_HAsciiString ) LF = new TCollection_HAsciiString ( "\n" ); + int start; #ifdef WNT @@ -190,6 +198,8 @@ WOKBuilder_BuildStatus WOKBuilder_Compiler::Execute() Shell()->ClearOutput(); Shell()->Execute(astr); + myCmdLine = new TCollection_HAsciiString ( astr ); + Handle(TColStd_HSequenceOfHAsciiString) resseq = Shell()->Errors(); if(Shell()->Status()) @@ -218,6 +228,79 @@ WOKBuilder_BuildStatus WOKBuilder_Compiler::Execute() Shell()->ClearOutput(); SetProduction(EvalProduction()); + + astr -> Clear (); + + for ( start = 1; start <= Produces () -> Length (); ++start ) { + + Handle( WOKBuilder_Entity ) ent = Produces () -> Value ( start ); + + if ( ent -> IsKind ( + STANDARD_TYPE( WOKBuilder_ObjectFile ) + ) + ) { + + astr -> AssignCat ( ent -> Path () -> FileName () ); + astr -> AssignCat ( ": " ); + + } else if ( ent -> IsKind ( + STANDARD_TYPE( WOKBuilder_MFile ) + ) + ) { + + WOKUtils_AdmFile mFile ( ent -> Path () ); + + Handle( TColStd_HSequenceOfHAsciiString ) deps = mFile.Read (); + + for ( int i = 1; i <= deps -> Length (); ++i ) { + + astr -> AssignCat ( NL ); + astr -> AssignCat ( deps -> Value ( i ) ); + + } // end for + + astr -> AssignCat ( LF ); + + } // end if + + } // end for + + if ( !astr -> IsEmpty () ) { + + OSD_Path dPath ( OutputDir () -> Name () -> ToCString () ); + + dPath.SetName ( Compilable () -> Path () -> BaseName () -> ToCString () ); + dPath.SetExtension ( ".d" ); + + OSD_File dFile ( dPath ); + + dFile.Build ( + OSD_WriteOnly, + OSD_Protection ( OSD_RWXD, OSD_RWXD, OSD_R, OSD_R ) + ); + + if ( !dFile.Failed () ) { + + dFile.Write ( astr -> String (), astr -> Length () ); + + if ( dFile.Failed () ) { + + TCollection_AsciiString name; + + dPath.SystemName ( name ); + + ErrorMsg << "WOKBuilder_Compiler::Execute" + << "could not create '" << new TCollection_HAsciiString ( name ) + << "'" << endm; + + } // end if + + dFile.Close (); + + } // end if + + } // end if + return WOKBuilder_Success; } diff --git a/src/WOKBuilder/WOKBuilder_CompilerIterator.cdl b/src/WOKBuilder/WOKBuilder_CompilerIterator.cdl index fbcc18b..388ea6c 100755 --- a/src/WOKBuilder/WOKBuilder_CompilerIterator.cdl +++ b/src/WOKBuilder/WOKBuilder_CompilerIterator.cdl @@ -50,9 +50,11 @@ is Execute(me:out; acompilable : Compilable from WOKBuilder) returns BuildStatus from WOKBuilder; + CmdLine ( me ) returns HAsciiString from TCollection; fields myincdirs : HSequenceOfPath from WOKUtils; mydbdirs : HSequenceOfPath from WOKUtils; + myCmdLine: HAsciiString from TCollection; end CompilerIterator; diff --git a/src/WOKBuilder/WOKBuilder_CompilerIterator.cxx b/src/WOKBuilder/WOKBuilder_CompilerIterator.cxx index fb53df3..fb784a6 100755 --- a/src/WOKBuilder/WOKBuilder_CompilerIterator.cxx +++ b/src/WOKBuilder/WOKBuilder_CompilerIterator.cxx @@ -133,6 +133,9 @@ WOKBuilder_BuildStatus WOKBuilder_CompilerIterator::Execute(const Handle(WOKBuil if(status == WOKBuilder_Success) { myproduction = acompiler->Produces(); + + if ( !acompiler -> myCmdLine.IsNull () ) myCmdLine = new TCollection_HAsciiString ( acompiler -> myCmdLine ); + } return status; } diff --git a/src/WOKBuilder/WOKBuilder_Linker.cxx b/src/WOKBuilder/WOKBuilder_Linker.cxx index 6bd7e7d..e6fc794 100755 --- a/src/WOKBuilder/WOKBuilder_Linker.cxx +++ b/src/WOKBuilder/WOKBuilder_Linker.cxx @@ -282,7 +282,7 @@ Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalLibSearchDirectives() //======================================================================= Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalDatabaseDirectives() { - Handle(TCollection_HAsciiString) res = new TCollection_HAsciiString; + Handle(TCollection_HAsciiString) res = new TCollection_HAsciiString ( "\\\n" ); if(!mydbdirs.IsNull()) { @@ -349,7 +349,7 @@ Handle(TCollection_HAsciiString) WOKBuilder_Linker::EvalLibraryList() Standard_Integer i; Handle(TCollection_HAsciiString) line; - line = new TCollection_HAsciiString; + line = new TCollection_HAsciiString ( "\\\n" ); for(i=1; i<=mylibs->Length(); i++) { @@ -458,7 +458,29 @@ WOKBuilder_BuildStatus WOKBuilder_Linker::Execute() Shell()->Send(EvalHeader()); Shell()->Send(EvalObjectList()); Shell()->Send(EvalLibraryList()); +#ifndef LIN Shell()->Execute(EvalFooter()); +#else + static Handle( TCollection_HAsciiString ) skipStr = + new TCollection_HAsciiString ( "/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to " ); + Shell () -> Send ( EvalFooter () ); + + Handle( TCollection_HAsciiString ) paramH = EvalToolTemplate ( "CheckUndefHeader" ); + Handle( TCollection_HAsciiString ) paramF = EvalToolTemplate ( "CheckUndefFooter" ); + + if ( !paramH.IsNull () && !paramF.IsNull () && + !paramH -> IsEmpty () && !paramF -> IsEmpty () + ) { + + Shell () -> Send ( paramH ); + Shell () -> Send ( EvalLibSearchDirectives () ); + Shell () -> Send ( EvalDatabaseDirectives () ); + Shell () -> Send ( EvalObjectList () ); + Shell () -> Send ( EvalLibraryList () ); + Shell () -> Execute ( paramF ); + + } else Shell () -> Execute ( new TCollection_HAsciiString ( "\n" ) ); +#endif // LIN if(Shell()->Status()) { @@ -470,6 +492,9 @@ WOKBuilder_BuildStatus WOKBuilder_Linker::Execute() ErrorMsg.DontPrintHeader(); for(Standard_Integer i=1; i<= errmsgs->Length(); i++) { +#ifdef LIN + if ( errmsgs -> Value ( i ) -> Search ( skipStr ) == 1 ) continue; +#endif // LIN ErrorMsg << "WOKBuilder_Linker::Execute" << errmsgs->Value(i) << endm; } if(ph) ErrorMsg.DoPrintHeader(); @@ -482,6 +507,9 @@ WOKBuilder_BuildStatus WOKBuilder_Linker::Execute() errmsgs = Shell()->Errors(); for(Standard_Integer i=1; i<= errmsgs->Length(); i++) { +#ifdef LIN + if ( errmsgs -> Value ( i ) -> Search ( skipStr ) == 1 ) continue; +#endif // LIN InfoMsg << "WOKBuilder_Linker::Execute" << errmsgs->Value(i) << endm; } if(ph) InfoMsg.DoPrintHeader(); -- 2.39.5