From f831ab436692760cdc69e6cc8b307cd275d1b9d5 Mon Sep 17 00:00:00 2001 From: Luiz Rafael Culik Date: Fri, 6 Jul 2001 01:42:40 +0000 Subject: [PATCH] See changelog 2001-07-05 22:40 GMT -3 --- harbour/ChangeLog | 6 ++ harbour/utils/hbmake/hbmake.prg | 113 +++++++++++++++++++++++++++----- 2 files changed, 101 insertions(+), 18 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index cf0b159e05..bb884433bd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +2001-07-05 22:40 GMT -3 Luiz Rafael Culik + *utils/hbmake/hbmake.prg + *Fixed an Bug related to creation of makefile when filename and extension + is all upper cased + +Support for ! command and !iffile + 2001-07-05 01:29 UTC-0800 Brian Hays * source/rtl/memoline.c diff --git a/harbour/utils/hbmake/hbmake.prg b/harbour/utils/hbmake/hbmake.prg index 1919d841b8..085b0b4a97 100644 --- a/harbour/utils/hbmake/hbmake.prg +++ b/harbour/utils/hbmake/hbmake.prg @@ -65,7 +65,11 @@ #define CRLF hb_osnewline() #endif #xtranslate timetosec() => ((val(substr(,1,2))*3600)+(val(substr(,4,2))*60)+(val(substr(,7,2)))) +#ifdef __HARBOUR__ #define datediff(,) (-) +#else +#translate datediff(,) => (-) +#endif Static lPrint := .f. Static nHandle Static aDefines := {} @@ -360,7 +364,7 @@ While !leof aTemp := listasArray2( Alltrim( cTemp ), "=" ) If lmacrosec - If Alltrim( Left( ctemp, 7 ) ) <> '!ifndef' .and. Alltrim( Left( ctemp, 6 ) ) <> "!endif" + If Alltrim( Left( ctemp, 7 ) ) <> '!ifndef' .and. Alltrim( Left( ctemp, 6 ) ) <> "!endif" .and. Alltrim( Left( ctemp, 7 ) ) <> '!iffile' If Len( atemp ) > 1 If At( "$", atemp[ 2 ] ) > 0 @@ -414,7 +418,11 @@ While !leof Else // cTemp1:=TRIM( SUBSTR( ReadLN( @lEof ),1 ) ) + if at('!ifndef',cTemp)>0 checkDefine( cTemp ) + elseif at('!iffile',cTemp)>0 + checkiffile(cTemp) + endif // endif Endif Endif @@ -1163,7 +1171,10 @@ aCs := aclone(aout) For x := 1 To Len( aCs ) cItem:= aCs[ x ] - aCs[ x ]:=strtran( cItem, ".prg", ".c" ) + hb_FNAMESPLIT(ciTem,@cPath ,@cTest, @cExt , @cDrive) + cExt:=substr(cExt,2) + + aCs[ x ]:=cTest+"."+exte( cExt,1) Next aObjs := aClone(aout) For x := 1 To Len( aObjs ) @@ -1171,11 +1182,11 @@ For x := 1 To Len( aObjs ) hb_FNAMESPLIT(ciTem,@cPath ,@cTest, @cExt , @cDrive) cExt:=substr(cExt,2) If !lGcc - aObjs[ x ]:=cTest+"."+strtran( cExt, "prg", "obj" ) + aObjs[ x ]:=cTest+"."+exte( cExt,2) Else - aObjs[ x ]:=cTest+"."+strtran( cExt, "prg", "o" ) + aObjs[ x ]:=cTest+"."+exte( cExt,3) Endif -Next + Next @@ -1207,7 +1218,8 @@ endif hb_FNAMESPLIT(cTopfile,@cPath ,@cTest, @cExt , @cDrive) cExt:=substr(cExt,2) //Fwrite( nLinkHandle, "OBJFILES = " + if(isupper(cTopfile),Strtran( cTopfile, ".PRG", ".OBJ" ),Strtran( cTopfile, ".prg", ".obj" )) ) - Fwrite( nLinkHandle, "OBJFILES = " + if(isupper(cExt),cTest+"."+Strtran( cExt, "PRG", "OBJ" ),cTest+"."+Strtran( cExt, "prg", "obj" )) ) +// Fwrite( nLinkHandle, "OBJFILES = " + if(isupper(cExt),cTest+"."+Strtran( cExt, "PRG", "OBJ" ),cTest+"."+Strtran( cExt, "prg", "obj" )) ) + Fwrite( nLinkHandle, "OBJFILES = " + cTest+'.'+exte(cExt,2) ) if len(aObjs)<1 Fwrite( nLinkHandle, +" $(OB) "+ CRLF ) @@ -1547,6 +1559,11 @@ Local getlist := {} Local cTopFile := "" Local cscreen := Savescreen( 0, 0, Maxrow(), Maxcol() ) local citem:="" +Local cExt:="" +Local cDrive:="" +local cPath:="" +Local cTest:="" + nLinkHandle := Fcreate( cFile ) Fwrite( nLinkHandle, "#BCC" + CRLF ) Fwrite( nLinkHandle, "VERSION=BCB.01" + CRLF ) @@ -1655,7 +1672,7 @@ pickarry( 10, 15, 19, 64, aIn, aOut ) nLenaOut := Len( aOut ) For x := 1 To nLenaOut - aOut[ x ] := lower(Trim( Left( aOut[ x ], 12 ) )) + aOut[ x ] := Trim( Left( aOut[ x ], 12 ) ) Next aOut := Asort( aOut ) @@ -1677,16 +1694,30 @@ aCs := aclone(aout) For x := 1 To Len( aCs ) cItem:= aCs[ x ] - aCs[ x ]:=strtran( cItem, ".prg", ".c" ) + hb_FNAMESPLIT(ciTem,@cPath ,@cTest, @cExt , @cDrive) + cExt:=substr(cExt,2) + + aCs[ x ]:=cTest+"."+exte( cExt,1) + Next aObjs := aClone(aout) For x := 1 To Len( aObjs ) cItem:=aObjs[ x ] + /* If !lGcc aObjs[ x ]:=strtran( cItem, ".prg", ".obj" ) Else aObjs[ x ]:=strtran( cItem, ".prg", ".o" ) Endif + */ + hb_FNAMESPLIT(ciTem,@cPath ,@cTest, @cExt , @cDrive) + cExt:=substr(cExt,2) + If !lGcc + aObjs[ x ]:=cTest+"."+exte( cExt,2) + Else + aObjs[ x ]:=cTest+"."+exte( cExt,3) + Endif + Next for nPos:=1 to Len(aCs) @@ -1704,8 +1735,8 @@ nLenaSrcc:=Len(aSrcc) Asize( aInC, nLenaSrcC ) For x := 1 To nLenaSrcC aInC[ x ] := Pad( aSrcC[ x, 1 ], 13 ) + ; - Str( aSrcC[ x, 2 ], 8 ) + ' ' + ; - Dtoc( aSrcC[ x, 3 ] ) + ' ' + ; + Str( aSrcC[ x, 2 ], 8 ) + ' ' + ; + Dtoc( aSrcC[ x, 3 ] ) + ' ' + ; aSrcc[ x, 4 ] Next @@ -1716,20 +1747,34 @@ pickarry( 10, 15, 19, 64, aInC, aOutC ) nLenaOutC := Len( aOutC ) For x := 1 To nLenaOutC - aOutC[x ] := lower(Trim( Left( aOutC[ x ], 12 ) )) + aOutC[x ] := Trim( Left( aOutC[ x ], 12 ) ) Next For x := 1 To Len( aOutC ) cItem:= aOutC[ x ] - aadd(aCs,cItem) + hb_FNAMESPLIT(ciTem,@cPath ,@cTest, @cExt , @cDrive) + cExt:=substr(cExt,2) + + aadd(acs,cTest+"."+exte( cExt,1)) + +// aadd(aCs,cItem)*/ Next //aObjs := aClone(aout) For x := 1 To Len( aoutC ) cItem:=aOutc[ x ] - If !lGcc +/* If !lGcc aadd(aObjs, strtran(cItem,".c",".obj")) Else aadd(aObjs, strtran(cItem,".c",".o")) Endif + */ + hb_FNAMESPLIT(ciTem,@cPath ,@cTest, @cExt , @cDrive) + cExt:=substr(cExt,2) + If !lGcc + aObjs[ x ]:=cTest+"."+exte( cExt,2) + Else + aObjs[ x ]:=cTest+"."+exte( cExt,3) + Endif + Next @@ -1745,23 +1790,23 @@ else endif -Fwrite( nLinkHandle, "OBJFILES = " ) +Fwrite( nLinkHandle, "OBJFILES = " ) if len(aObjs)<1 Fwrite( nLinkHandle, +" $(OB) "+ CRLF ) else -//Fwrite( nLinkHandle, "OBJFILES = " + if(isupper(cTopfile),Strtran( cTopfile, ".PRG", ".OBJ" ),Strtran( cTopfile, ".prg", ".obj" ))) +//Fwrite( nLinkHandle, "OBJFILES =" + if(isupper(cTopfile),Strtran( cTopfile, ".PRG", ".OBJ" ),Strtran( cTopfile, ".prg", ".obj" ))) For x := 1 To Len( aobjs ) If x <> Len( aobjs ) - Fwrite( nLinkHandle, " " + alltrim(aobjs[ x ]) ) + Fwrite( nLinkHandle, alltrim(aobjs[ x ]) ) Else - Fwrite( nLinkHandle, " " + alltrim(aobjs[ x ]) +" $(OB) "+ CRLF ) + Fwrite( nLinkHandle," " + alltrim(aobjs[ x ]) +" $(OB) "+ CRLF ) Endif Next endif -Fwrite( nLinkHandle, "CFILES = " ) +Fwrite( nLinkHandle, "CFILES =" ) if len(aCs)<1 Fwrite( nLinkHandle, +" $(CF)"+ CRLF ) // @@ -2038,3 +2083,35 @@ if NEGATIVE endif return val( SOMESTRING ) +function HB_OSNEWLINE() +RETURn CHR(13)+CHR(10) +function checkiffile(cFile) +Local cNextLine:='' +Local cCommand:='' +Local cTemp +cTemp:=substr(cFile,at(" ",cFile)+1) +if file(cTemp) + cNextLine := Trim( Substr( ReadLN( @lEof ), 1 ) ) + if at("! ",cNextLine)>0 + cCommand:=substr(cNextLine,at(' ',cNextLine)+1) + run (ccommand) + endif + return .t. +endif +return .f. +function exte(cExt,nType) +Local aext:={'prg', 'prG', 'pRg', 'Prg', 'PRg', 'PrG', 'PRG'} +Local nPos +Local cTemp :="" +nPos:=ascan(aext,{|a| a==cExt}) +if nPos>0 + if nTYpe==1 + cTemp:=strtran(cExt,aExt[nPos],'c') + elseif ntype==2 + cTemp:=strtran(cExt,aExt[nPos],'obj') + elseif ntype==3 + cTemp:=strtran(cExt,aExt[nPos],'o') + + endif +endif +return ctemp