2002-02-01 10:30 UTC-0300 Horacio Roldán <harbour_ar@yahoo.com.ar>

* utils/hbmake/hbmake.prg
     utils/hbmake/hbmutils.prg
     * Better support for big project(Read and Generations)
   From Luiz Rafael Culik <culik@sl.conex.net>
This commit is contained in:
Horacio Dario Roldan Kasimatis
2002-02-01 13:28:19 +00:00
parent 08ac999724
commit 71fff49e08
2 changed files with 75 additions and 28 deletions

View File

@@ -65,17 +65,17 @@
#include "hbclip.ch"
#endif
#xtranslate timetosec(<x>) => ((val(substr(<x>,1,2))*3600)+(val(substr(<x>,4,2))*60)+(val(substr(<x>,7,2))))
DECLARE TestforPrg(cFile as String)
/*DECLARE TestforPrg(cFile as String)
DECLARE findHarbourcfg(@cCfg AS STRING) AS LOGICAL
declare listasArray2( cString as String , cSep as String ) as Array
DECLARE GetGccDir() as String
DECLARE GetGccDir() as String*/
#ifdef __HARBOUR__
#define datediff(<x>,<y>) (<x>-<y>)
#else
#translate datediff(<x>,<y>) => (<x>-<y>)
#endif
Static lPrint AS LOGICAL := .f.
Static nHandle AS NUMERIC
Static lPrint := .f.
Static nHandle
Static aDefines := {}
Static aBuildOrder := {}
Static aCommands := {}
@@ -260,6 +260,13 @@ While !leof
Endif
cTemp := Trim( Substr( ReadLN( @lEof ), 1 ) )
if at("//",ctemp)>0
while at("//",ctemp)>0
ctemp:=strtran(ctemp," //","")
cTemp += Trim( Substr( ReadLN( @lEof ), 1 ) )
enddo
ctemp:=strtran(ctemp," //","")
endif
aTemp := listasArray2( Alltrim( cTemp ), "=" )
If lmacrosec
@@ -938,7 +945,7 @@ local lExternalLib:=.f.
Local cOldLib:=""
Local cHtmlLib:=""
local lLinux:=at('linux',lower(os()))>0
local nWriteFiles:=0
nLinkHandle := Fcreate( cFile )
WriteMakeFileHeader()
@@ -1248,15 +1255,17 @@ else
Fwrite( nLinkHandle, +" $(OB) "+ CRLF )
else
aeval(aobjs,{|x,i| if((i<> Len( aobjs ) .and. x<>cTopfile), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
aeval(aobjs,{|x,i| nWriteFiles++,if((i<> Len( aobjs ) .and. x<>cTopfile), Fwrite( nLinkHandle, ' '+ alltrim( x ) +if(nWriteFiles %10==0," //"+CRLF,"")), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
endif
nWriteFiles:=0
Fwrite( nLinkHandle, "PRGFILES =" )
if len(aPrgs)<1
Fwrite( nLinkHandle, +" $(PS)"+ CRLF )
else
aeval(aPrgs,{|x,i| if(i<> Len( aPrgs ) , Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(PS) "+ CRLF ))})
aeval(aPrgs,{|x,i| nWriteFiles++,if(i<> Len( aPrgs ) , Fwrite( nLinkHandle, ' '+ alltrim( x )+if(nWriteFiles % 10==0," //"+CRLF,"") ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(PS) "+ CRLF ))})
endif
nWriteFiles:=0
Fwrite( nLinkHandle, "OBJCFILES =" )
if len(aObjsc)<1
@@ -1264,9 +1273,10 @@ Fwrite( nLinkHandle, +" $(OB) "+ CRLF )
else
//Fwrite( nLinkHandle, "OBJFILES =" + if(isupper(cTopfile),Strtran( cTopfile, ".PRG", ".OBJ" ),Strtran( cTopfile, ".prg", ".obj" )))
aeval(aObjsc,{|x,i| if(i<> Len( aobjsc ), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
endif
aeval(aObjsc,{|x,i|nWriteFiles++, if(i<> Len( aobjsc ), Fwrite( nLinkHandle, ' '+ alltrim( x )+if(nWriteFiles % 10==0," //"+CRLF,"") ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
endif
nWriteFiles:=0
Fwrite( nLinkHandle, "CFILES =" )
if len(aCs)<1
Fwrite( nLinkHandle, +" $(CF)"+ CRLF )
@@ -1274,7 +1284,7 @@ endif
else
//Fwrite( nLinkHandle, "CFILES =" + if(isupper(cTopfile),Strtran( cTopfile, ".PRG", ".C" ),Strtran( cTopfile, ".prg", ".c" )))
aeval(aCs,{|x,i| if(i<> Len( aCs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
aeval(aCs,{|x,i|nWriteFiles++, if(i<> Len( aCs ), Fwrite( nLinkHandle, ' '+ alltrim( x )+if(nWriteFiles % 10==0," //"+CRLF,"") ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
endif
endif
@@ -1683,6 +1693,7 @@ Local cTest:=""
local cLast:=''
Local cUserdef:=space(40)
Local cUserInclude:=space(40)
local nWriteFiles:=0
nLinkHandle := Fcreate( cFile )
WriteMakeFileHeader()
@@ -1892,59 +1903,68 @@ else
Fwrite( nLinkHandle, "PROJECT = " + alltrim(lower(cfwhpath))+".lib "+CRLF )
endif
if !lextended
Fwrite( nLinkHandle, "OBJFILES =" )
nWriteFiles:=0
fwrite( nLinkHandle, "OBJFILES =" )
if len(aObjs)<1
Fwrite( nLinkHandle, +" $(OB) "+ CRLF )
else
aeval(aObjs,{|x,i| if(i<> Len( aobjs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
nWriteFiles:=0
aeval(aObjs,{|x,i| nWriteFiles++,if(i<> Len( aobjs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) +if(nWriteFiles %10==0," //"+CRLF,"")), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
//aeval(aobjs,{|x,i| nWriteFiles++,if((i<> Len( aobjs ) .and. x<>cTopfile), Fwrite( nLinkHandle, ' '+ alltrim( x ) +if(nWriteFiles %10==0," //"+CRLF,"")), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
endif
nWriteFiles:=0
Fwrite( nLinkHandle, "CFILES =" )
if len(aCs)<1
Fwrite( nLinkHandle, +" $(CF)"+ CRLF )
//
else
aeval(aCs,{|x,i| if(i<> Len( aCs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(CF) "+ CRLF ))})
aeval(aCs,{|x,i| nWriteFiles++,if(i<> Len( aCs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) +if(nWriteFiles %10==0," //"+CRLF,"")), Fwrite( nLinkHandle," " + alltrim( x ) +" $(CF) "+ CRLF ))})
endif
Fwrite( nLinkHandle, "PRGFILE =" )
nWriteFiles:=0
if len(aPrgs)<1
Fwrite( nLinkHandle, +" $(PS)"+ CRLF )
else
aeval(aPrgs,{|x,i| if(i<> Len( aPrgs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(PS) "+ CRLF ))})
aeval(aPrgs,{|x,i|nWriteFiles++, if(i<> Len( aPrgs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) +if(nWriteFiles %10==0," //"+CRLF,"")), Fwrite( nLinkHandle," " + alltrim( x ) +" $(PS) "+ CRLF ))})
endif
else /****extended moded ****/
Fwrite( nLinkHandle, "OBJFILES =" )
nWriteFiles:=0
if len(aObjs)<1
Fwrite( nLinkHandle, +" $(OB) "+ CRLF )
else
aeval(aObjs,{|x,i| if(i<> Len( aobjs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
aeval(aObjs,{|x,i|nWriteFiles++, if(i<> Len( aobjs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) +if(nWriteFiles %10==0," //"+CRLF,"")), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
endif
Fwrite( nLinkHandle, "PRGFILES =" )
Fwrite( nLinkHandle, "PRGFILES =" )
nWriteFiles:=0
if len(aPrgs)<1
Fwrite( nLinkHandle, +" $(PS)"+ CRLF )
else
aeval(aPrgs,{|x,i| if(i<> Len( aPrgs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(PS) "+ CRLF ))})
aeval(aPrgs,{|x,i|nWriteFiles++, if(i<> Len( aPrgs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) +if(nWriteFiles %10==0," //"+CRLF,"")), Fwrite( nLinkHandle," " + alltrim( x ) +" $(PS) "+ CRLF ))})
endif
nWriteFiles:=0
if Len(aObjsc)>0
Fwrite( nLinkHandle, "OBJCFILES =" )
if len(aObjsc)<1
Fwrite( nLinkHandle, +" $(OB) "+ CRLF )
else
aeval(aObjsc,{|x,i| if(i<> Len( aobjsc ), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
aeval(aObjsc,{|x,i|nWriteFiles++, if(i<> Len( aobjsc ), Fwrite( nLinkHandle, ' '+ alltrim( x ) +if(nWriteFiles %10==0," //"+CRLF,"")), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
endif
endif
nWriteFiles:=0
if len(acs)>0
Fwrite( nLinkHandle, "CFILES =" )
if len(aCs)<1
Fwrite( nLinkHandle, +" $(CF)"+ CRLF )
else
aeval(aCs,{|x,i| if(i<> Len( aCs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) ), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
aeval(aCs,{|x,i|nWriteFiles++, if(i<> Len( aCs ), Fwrite( nLinkHandle, ' '+ alltrim( x ) +if(nWriteFiles %10==0," //"+CRLF,"")), Fwrite( nLinkHandle," " + alltrim( x ) +" $(OB) "+ CRLF ))})
endif
endif
endif

View File

@@ -31,8 +31,9 @@ Function GetSourceFiles( lSubdir )
Local cdrive
Local nPos
Local xItem
local ccc,ddd
Default lSubdir To .t.
While ++ nCounter <= Len( aStru )
If !Empty( adirs := GetDirs( astru[ nCounter ] ) ) // There are elements!
@@ -45,10 +46,12 @@ Function GetSourceFiles( lSubdir )
nArrayLen := Len( aStru )
For nCounter := 1 To nArrayLen
If Len( aData := Directory( aStru[ nCounter ] + "*.*" ) ) != 0
If Len( aData := DIR_MULTI(aStru[ nCounter ]+"*.prg |"+aStru[ nCounter ]+"*.c") ) != 0
nDataLen := Len( aData )
For y := 1 To nDataLen
If At( '.PRG', Upper( adata[ y, 1 ] ) ) > 0 .or. At( '.C', Upper( adata[ y, 1 ] ) ) > 0
If lSubdir
@@ -57,7 +60,7 @@ Function GetSourceFiles( lSubdir )
Dtoc( aData[ y, 3 ] ) + ' ' + ;
aData[ y, 4 ] )
Elseif !lsubdir .and. At( If( lLinux, "/", "\" ), Strtran( astru[ nCounter ], cDir, '' ) ) == 0
Aadd( aRet, Pad( aData[ y, 1 ], 13 ) + ;
Aadd( aRet, Pad( aData[ y, 1 ], 18 ) + ;
Str( aData[ y, 2 ], 8 ) + ' ' + ;
Dtoc( aData[ y, 3 ] ) + ' ' + ;
aData[ y, 4 ] )
@@ -66,7 +69,7 @@ Function GetSourceFiles( lSubdir )
Next
Endif
Next
For nCounter := 1 To Len( aret )
xItem := Substr( aret[ nCounter ], Rat( If( llinux, "/", '\' ), aret[ nCounter ] ) + 1 )
@@ -117,6 +120,7 @@ Static Function GetDirs( cPattern )
Local aDir := {}
Local lLinux := At( 'linux', lower(Os()) ) > 0
Aeval( Directory( cPattern + "*.", "D" ), ;
{ | xItem | If( xItem[ 5 ] = "D" .and. ;
( xItem[ 1 ] != "." .and. xItem[ 1 ] != ".." ), ;
@@ -363,3 +367,26 @@ Function Getlibs( lgcc ,cDir)
Return aLibsDesc
*+ EOF: HBMUTILS.PRG
FUNCTION DIR_MULTI( cFileMaskList, cAttr )
LOCAL aList := ListasArray2( cFileMaskList, "|" )
AEval( aList, {|tmp, tmp1| aList[ tmp1 ] := DIRECTORY( tmp, cAttr ) })
RETURN ArrayAJoin(alist)
FUNCTION ArrayAJoin( array )
LOCAL tmp
LOCAL nLenArray := Len( array )
LOCAL nLen
LOCAL nPos := Len( array[ 1 ] ) + 1
nLen := 0
FOR tmp := 1 TO nLenArray
nLen += Len( array[ tmp ] )
NEXT
ASize( array[ 1 ], nLen )
FOR tmp := 2 TO nLenArray
ACopy( array[ tmp ], array[ 1 ], , , nPos )
nPos += Len( array[ tmp ] )
NEXT
RETURN array[ 1 ]