From a2eb6c9690240f550b9985d16ec6f79a97a6f10f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 19 Feb 2009 12:46:19 +0000 Subject: [PATCH] 2009-02-18 13:14 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk/hbmk2.prg + Added new TODOs. + Now using GTCGI as the GT. + Added -info option to enable informational output. (currently this is the default for testing period) + Added -arch= command line option. Same as HB_ARCHITECTURE. Added -comp= command line option. Same as HB_COMPILER. envvars are kept for compatibility. + Added -hblnk option to give plave for hblnk script behaviour emulation. * Changed -cc, -cmp options to -hbcc, -hbcmp respecitvely. + Changed -hbcc, -hbcmp, -hblnk switches to turn off information output and turn on quiet mode by default. + Added autodetection of architecture when unique to architecture compiler is choosen manually. IOW, when -comp=msvc|mingw|pocc|dmc|xcc is passed the architecture will be set to win automatically. When -comp=djgpp is used, dos will be selected. ! Fixed ordering of compiler autodetection because f.e. owatcom bin dir holds a 'cl.exe', which made hbmk2 falsely detect msvc. + Added trick which I'm not sure I like, and may cause problems and seemingly unpredictable behaviour, but could also help in some environments where multiple compilers are setup in parallel (this isn't a recommended scenario for various other reasons, so maybe we shouldn't support it further). So from now on the compiler autodetection will first look for the compiler used to build hbmk2.exe, and check for the rest afterwards. This feature is turned off for msvc builds of hbmk2.exe because it breaks owatcom autodetection. + Added possibility to pass a plain dir by using -odir[\|/] switch. The final name will be determined by first input file name, if this one also has a dir, -o option will be ignored. Added logic to handle separator differences, this wasn't tested to a great deal. + Added -Wl,--start-group support for linux/gcc|gpp, win/mingw, dos/djgpp. ! Fixed owatcom support to setup library paths. ! Fixed linux/owatcom to use link script. * Some adjustments to win/owatcom C compiler settings. I guess the ones in .cf should also need a cleanup. * Few minor indentation problems fixed. ! C compiler and linker scripts now got an extension in the generated temp filename to make some of them happy (owatcom in this case). .cpl is used for compiler scripts, .lnk for linker ones. + Compiler autodetection now also looks in hbmk2 executable dir before looking into the PATH. ! Link script content was wrong due to typo. ! Fixed problem with library paths being wrong (doubly decorated) in the link command. This may also fix some problems with double extensions and final .c file cleanup. ! Fixed to add hbdebug lib when building in shared mode. ! Fixed typo in automatically adding './' on *nix systems. ; Please test, I definitely couldn't retest all scenaros after all these changes. * bin/postinst.bat * Adapted change in mode modifier switches, also added new -hblnk one. * utils/hbmk/examples/winapi.hbp + Added mapi32. + utils/hbmk/examples/contrib.hbp + Added .hbp file for popular and portable only contribs. * config/win/owatcom.cf - Removed unnecessary system libs. * contrib/hbvpdf/hbvpdft.prg * hbwhat32 -> hbwhat in comment. * contrib/hbwin/wapi_commctrl.c * contrib/hbwin/wapi_winuser.c ! Fixed harbour-project page link in header. * contrib/hbwin/hbwapi.h * Formatting (indenting the whole file content inside self-guard isn't necessary.) --- harbour/ChangeLog | 77 ++++- harbour/bin/postinst.bat | 18 +- harbour/config/win/owatcom.cf | 2 +- harbour/contrib/hbvpdf/hbvpdft.prg | 144 ++++----- harbour/contrib/hbwin/hbwapi.h | 50 +-- harbour/contrib/hbwin/wapi_commctrl.c | 3 +- harbour/contrib/hbwin/wapi_winuser.c | 7 +- harbour/utils/hbmk/examples/contrib.hbp | 10 + harbour/utils/hbmk/examples/winapi.hbp | 2 +- harbour/utils/hbmk/hbmk2.prg | 405 +++++++++++++++++------- 10 files changed, 487 insertions(+), 231 deletions(-) create mode 100644 harbour/utils/hbmk/examples/contrib.hbp diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1401b78d5e..03d9c10754 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,81 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-18 13:14 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk/hbmk2.prg + + Added new TODOs. + + Now using GTCGI as the GT. + + Added -info option to enable informational output. + (currently this is the default for testing period) + + Added -arch= command line option. Same as HB_ARCHITECTURE. + Added -comp= command line option. Same as HB_COMPILER. + envvars are kept for compatibility. + + Added -hblnk option to give plave for hblnk script behaviour + emulation. + * Changed -cc, -cmp options to -hbcc, -hbcmp respecitvely. + + Changed -hbcc, -hbcmp, -hblnk switches to turn off information + output and turn on quiet mode by default. + + Added autodetection of architecture when unique to + architecture compiler is choosen manually. IOW, when + -comp=msvc|mingw|pocc|dmc|xcc is passed the architecture will + be set to win automatically. When -comp=djgpp is used, + dos will be selected. + ! Fixed ordering of compiler autodetection because f.e. owatcom + bin dir holds a 'cl.exe', which made hbmk2 falsely detect msvc. + + Added trick which I'm not sure I like, and may cause problems + and seemingly unpredictable behaviour, but could also help + in some environments where multiple compilers are setup in + parallel (this isn't a recommended scenario for various other + reasons, so maybe we shouldn't support it further). So from + now on the compiler autodetection will first look for the + compiler used to build hbmk2.exe, and check for the rest + afterwards. This feature is turned off for msvc builds of + hbmk2.exe because it breaks owatcom autodetection. + + Added possibility to pass a plain dir by using -odir[\|/] + switch. The final name will be determined by first input + file name, if this one also has a dir, -o option will be + ignored. Added logic to handle separator differences, this + wasn't tested to a great deal. + + Added -Wl,--start-group support for linux/gcc|gpp, win/mingw, + dos/djgpp. + ! Fixed owatcom support to setup library paths. + ! Fixed linux/owatcom to use link script. + * Some adjustments to win/owatcom C compiler settings. I guess + the ones in .cf should also need a cleanup. + * Few minor indentation problems fixed. + ! C compiler and linker scripts now got an extension in + the generated temp filename to make some of them happy + (owatcom in this case). .cpl is used for compiler scripts, + .lnk for linker ones. + + Compiler autodetection now also looks in hbmk2 executable + dir before looking into the PATH. + ! Link script content was wrong due to typo. + ! Fixed problem with library paths being wrong (doubly + decorated) in the link command. This may also fix some + problems with double extensions and final .c file cleanup. + ! Fixed to add hbdebug lib when building in shared mode. + ! Fixed typo in automatically adding './' on *nix systems. + ; Please test, I definitely couldn't retest all scenaros + after all these changes. + + * bin/postinst.bat + * Adapted change in mode modifier switches, also + added new -hblnk one. + * utils/hbmk/examples/winapi.hbp + + Added mapi32. + + utils/hbmk/examples/contrib.hbp + + Added .hbp file for popular and portable only contribs. + * config/win/owatcom.cf + - Removed unnecessary system libs. + * contrib/hbvpdf/hbvpdft.prg + * hbwhat32 -> hbwhat in comment. + * contrib/hbwin/wapi_commctrl.c + * contrib/hbwin/wapi_winuser.c + ! Fixed harbour-project page link in header. + * contrib/hbwin/hbwapi.h + * Formatting (indenting the whole file content inside + self-guard isn't necessary.) + 2009-02-19 12:49 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/thread.c ! fixed the typo in order of sending signals in _hb_thread_cond_signal() @@ -16,7 +91,7 @@ 2009-02-18 17:05 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/wvgscrlb.prg - * Disabled structure support for time being as + * Disabled structure support for time being as build process is unable to locate cstruct.c, etc. headers. Viktor? diff --git a/harbour/bin/postinst.bat b/harbour/bin/postinst.bat index 84f61c9703..bf58864327 100644 --- a/harbour/bin/postinst.bat +++ b/harbour/bin/postinst.bat @@ -17,9 +17,9 @@ goto inst_%HB_ARCHITECTURE% :inst_win rem Windows post install part -echo @"%%~dp0hbmk2.exe" -cc %%*> %HB_BIN_INSTALL%\hbcc.bat -echo @"%%~dp0hbmk2.exe" -cmp %%*> %HB_BIN_INSTALL%\hbcmp.bat -echo @"%%~dp0hbmk2.exe" %%*> %HB_BIN_INSTALL%\hblnk.bat +echo @"%%~dp0hbmk2.exe" -hbcc %%*> %HB_BIN_INSTALL%\hbcc.bat +echo @"%%~dp0hbmk2.exe" -hbcmp %%*> %HB_BIN_INSTALL%\hbcmp.bat +echo @"%%~dp0hbmk2.exe" -hblnk %%*> %HB_BIN_INSTALL%\hblnk.bat goto end @@ -27,9 +27,9 @@ goto end :inst_dos rem DOS post install part -echo @hbmk2.exe -cc %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hbcc.bat -echo @hbmk2.exe -cmp %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hbcmp.bat -echo @hbmk2.exe %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hblnk.bat +echo @hbmk2.exe -hbcc %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hbcc.bat +echo @hbmk2.exe -hbcmp %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hbcmp.bat +echo @hbmk2.exe -hblnk %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hblnk.bat goto end @@ -37,9 +37,9 @@ goto end :inst_os2 rem OS/2 post install part -echo @hbmk2.exe -cc %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hbcc.cmd -echo @hbmk2.exe -cmp %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hbcmp.cmd -echo @hbmk2.exe %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hblnk.cmd +echo @hbmk2.exe -hbcc %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hbcc.cmd +echo @hbmk2.exe -hbcmp %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hbcmp.cmd +echo @hbmk2.exe -hblnk %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9> %HB_BIN_INSTALL%\hblnk.cmd goto end diff --git a/harbour/config/win/owatcom.cf b/harbour/config/win/owatcom.cf index 823bd0ca4a..d656c4ff0b 100644 --- a/harbour/config/win/owatcom.cf +++ b/harbour/config/win/owatcom.cf @@ -54,7 +54,7 @@ $(foreach lib, $(LINKLIBS), $(link_lib)) $(foreach lib, $(RDDLIBS), $(link_lib)) $(foreach lib, $(GTLIBS), $(link_lib)) echo @%watcom%/binnt/wlink.lnk >> __link__.tmp -echo LIB kernel32.lib, user32.lib, wsock32.lib, winspool.lib, oleaut32.lib, uuid.lib, comctl32.lib, mapi32.lib >> __link__.tmp +echo LIB kernel32.lib, user32.lib, wsock32.lib >> __link__.tmp -$(LD) @__link__.tmp endef diff --git a/harbour/contrib/hbvpdf/hbvpdft.prg b/harbour/contrib/hbvpdf/hbvpdft.prg index 89476fcfc2..490007257a 100644 --- a/harbour/contrib/hbvpdf/hbvpdft.prg +++ b/harbour/contrib/hbvpdf/hbvpdft.prg @@ -4,11 +4,11 @@ //-------------------------\\ // -// Program Cl_Pdf.prg +// Program Cl_Pdf.prg // // Original : Victor K. . http://www.ihaveparts.com // -// Class Code : Pritpal Bedi . http://www.vouchcac.com +// Class Code : Pritpal Bedi . http://www.vouchcac.com // //-------------------------\\ @@ -41,13 +41,13 @@ CREATE CLASS tPdf -#ifndef __HARBOUR__ +#ifndef __HARBOUR__ EXPORT: #endif VAR aReport -#ifndef __HARBOUR__ +#ifndef __HARBOUR__ EXPORT: #endif @@ -187,7 +187,7 @@ next ::aReport[ DOCLEN ] := 0 cTemp := "%PDF-1.3" + CRLF ::aReport[ DOCLEN ] += len( cTemp ) - + fwrite( ::aReport[ HANDLE ], cTemp ) RETURN self @@ -273,7 +273,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Normal() #else -METHOD Normal() +METHOD Normal() #endif local cName := ::GetFontInfo( "NAME" ) @@ -295,7 +295,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Italic() #else -METHOD Italic() +METHOD Italic() #endif local cName := ::GetFontInfo( "NAME" ) @@ -304,7 +304,7 @@ local cName := ::GetFontInfo( "NAME" ) ELSEIF cName = "Helvetica" ::aReport[ FONTNAME ] := 7 ELSE - ::aReport[ FONTNAME ] := 11 + ::aReport[ FONTNAME ] := 11 ENDIF aadd( ::aReport[ PAGEFONTS ], ::aReport[ FONTNAME ] ) IF ascan( ::aReport[ FONTS ], { |arr| arr[1] == ::aReport[ FONTNAME ] } ) == 0 @@ -317,7 +317,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Bold() #else -METHOD Bold() +METHOD Bold() #endif local cName := ::GetFontInfo( "NAME" ) @@ -341,7 +341,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:BoldItalic() #else -METHOD BoldItalic() +METHOD BoldItalic() #endif local cName := ::GetFontInfo( "NAME" ) @@ -365,7 +365,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:BookAdd( cTitle, nLevel, nPage, nLine ) #else -METHOD BookAdd( cTitle, nLevel, nPage, nLine ) +METHOD BookAdd( cTitle, nLevel, nPage, nLine ) #endif aadd( ::aReport[ BOOKMARK ], { nLevel, alltrim( cTitle ), 0, 0, 0, 0, 0, 0, nPage, IIF( nLevel == 1, ::aReport[ PAGEY ], ::aReport[ PAGEY ] - nLine * 72 / ::aReport[ LPI ] ) }) @@ -377,7 +377,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:BookClose( ) #else -METHOD BookClose( ) +METHOD BookClose( ) #endif ::aReport[ BOOKMARK ] := nil @@ -389,7 +389,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:BookOpen( ) #else -METHOD BookOpen( ) +METHOD BookOpen( ) #endif ::aReport[ BOOKMARK ] := {} @@ -401,7 +401,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Box( x1, y1, x2, y2, nBorder, nShade, cUnits, cColor, cId ) #else -METHOD Box( x1, y1, x2, y2, nBorder, nShade, cUnits, cColor, cId ) +METHOD Box( x1, y1, x2, y2, nBorder, nShade, cUnits, cColor, cId ) #endif local cBoxColor @@ -496,7 +496,7 @@ return nil #ifdef __XPP__ METHOD tPdf:Center( cString, nRow, nCol, cUnits, lExact, cId ) #else -METHOD Center( cString, nRow, nCol, cUnits, lExact, cId ) +METHOD Center( cString, nRow, nCol, cUnits, lExact, cId ) #endif local nLen, nAt @@ -528,7 +528,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Close() #else -METHOD Close() +METHOD Close() #endif local nI, cTemp, nCurLevel, nObj1, nLast, nCount, nFirst, nRecno, nBooklen @@ -674,7 +674,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Image( cFile, nRow, nCol, cUnits, nHeight, nWidth, cId ) #else -METHOD Image( cFile, nRow, nCol, cUnits, nHeight, nWidth, cId ) +METHOD Image( cFile, nRow, nCol, cUnits, nHeight, nWidth, cId ) #endif DEFAULT nRow TO ::aReport[ REPORTLINE ] @@ -718,7 +718,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Length( cString ) #else -METHOD Length( cString ) +METHOD Length( cString ) #endif local nWidth := 0.00, nI, nLen, nArr, nAdd := ( ::aReport[ FONTNAME ] - 1 ) % 4 @@ -745,7 +745,7 @@ RETURN nWidth #ifdef __XPP__ METHOD tPdf:NewLine( n ) #else -METHOD NewLine( n ) +METHOD NewLine( n ) #endif DEFAULT n TO 1 @@ -763,7 +763,7 @@ RETURN ::aReport[ REPORTLINE ] #ifdef __XPP__ METHOD tPdf:NewPage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize ) #else -METHOD NewPage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize ) +METHOD NewPage( _cPageSize, _cPageOrient, _nLpi, _cFontName, _nFontType, _nFontSize ) #endif @@ -792,7 +792,7 @@ DEFAULT _nFontSize TO ::aReport[ FONTSIZE ] ::DrawHeader() - ::aReport[ REPORTLINE ] := 0 + ::aReport[ REPORTLINE ] := 0 ::aReport[ FONTNAMEPREV ] := 0 ::aReport[ FONTSIZEPREV ] := 0 @@ -803,7 +803,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:PageSize( _cPageSize ) #else -METHOD PageSize( _cPageSize ) +METHOD PageSize( _cPageSize ) #endif local nSize, aSize := { { "LETTER", 8.50, 11.00 }, ; @@ -847,7 +847,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:PageOrient( _cPageOrient ) #else -METHOD PageOrient( _cPageOrient ) +METHOD PageOrient( _cPageOrient ) #endif DEFAULT _cPageOrient TO "P" @@ -861,7 +861,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:PageNumber( n ) #else -METHOD PageNumber( n ) +METHOD PageNumber( n ) #endif DEFAULT n TO 0 @@ -875,7 +875,7 @@ RETURN ::aReport[ REPORTPAGE ] #ifdef __XPP__ METHOD tPdf:Reverse( cString ) #else -METHOD Reverse( cString ) +METHOD Reverse( cString ) #endif RETURN cString + chr(255) @@ -885,7 +885,7 @@ RETURN cString + chr(255) #ifdef __XPP__ METHOD tPdf:RJust( cString, nRow, nCol, cUnits, lExact, cId ) #else -METHOD RJust( cString, nRow, nCol, cUnits, lExact, cId ) +METHOD RJust( cString, nRow, nCol, cUnits, lExact, cId ) #endif local nLen, nAdj := 1.0, nAt @@ -918,7 +918,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:SetFont( _cFont, _nType, _nSize, cId ) #else -METHOD SetFont( _cFont, _nType, _nSize, cId ) +METHOD SetFont( _cFont, _nType, _nSize, cId ) #endif DEFAULT _cFont TO "Times" @@ -952,7 +952,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:SetLPI(_nLpi) #else -METHOD SetLPI(_nLpi) +METHOD SetLPI(_nLpi) #endif local cLpi := alltrim(str(_nLpi)) @@ -969,7 +969,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:StringB( cString ) #else -METHOD StringB( cString ) +METHOD StringB( cString ) #endif cString := strtran( cString, "(", "\(" ) @@ -982,7 +982,7 @@ RETURN cString #ifdef __XPP__ METHOD tPdf:TextCount( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits ) #else -METHOD TextCount( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits ) +METHOD TextCount( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits ) #endif RETURN ::Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, .f. ) @@ -992,7 +992,7 @@ RETURN ::Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, .f. ) #ifdef __XPP__ METHOD tPdf:Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, cColor, lPrint ) #else -METHOD Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, cColor, lPrint ) +METHOD Text( cString, nTop, nLeft, nLength, nTab, nJustify, cUnits, cColor, lPrint ) #endif local cDelim := chr(0)+chr(9)+chr(10)+chr(13)+chr(26)+chr(32)+chr(138)+chr(141) @@ -1001,7 +1001,7 @@ local lParagraph, nSpace, nNew, nTokenLen, nCRLF, nTokens, nLen DEFAULT nTab TO -1 DEFAULT cUnits TO "R" -DEFAULT nJustify TO 4 +DEFAULT nJustify TO 4 DEFAULT lPrint TO .t. DEFAULT cColor TO "" @@ -1111,7 +1111,7 @@ RETURN nLines #ifdef __XPP__ METHOD tPdf:UnderLine( cString ) #else -METHOD UnderLine( cString ) +METHOD UnderLine( cString ) #endif RETURN cString + chr(254) @@ -1121,10 +1121,10 @@ RETURN cString + chr(254) #ifdef __XPP__ METHOD tPdf:OpenHeader( cFile ) #else -METHOD OpenHeader( cFile ) +METHOD OpenHeader( cFile ) #endif -local nAt, cCmd +local nAt, cCmd DEFAULT cFile TO "" @@ -1134,7 +1134,7 @@ DEFAULT cFile TO "" at( " ", cFile ) > 0 .or. ; ( at( " ", cFile ) == 0 .and. len( cFile ) > 8 ) .or. ; ( ( nAt := at( ".", cFile )) > 0 .and. len( substr( cFile, nAt + 1 )) > 3 ) - + cCmd := "copy " + cFile + " temp.tmp > nul" RunExternal( cCmd ) @@ -1154,7 +1154,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:EditOnHeader() #else -METHOD EditOnHeader() +METHOD EditOnHeader() #endif ::aReport[ HEADEREDIT ] := .t. @@ -1167,7 +1167,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:EditOffHeader() #else -METHOD EditOffHeader() +METHOD EditOffHeader() #endif ::aReport[ HEADEREDIT ] := .f. @@ -1180,7 +1180,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:CloseHeader() #else -METHOD CloseHeader() +METHOD CloseHeader() #endif ::aReport[ HEADER ] := {} @@ -1192,7 +1192,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:DeleteHeader( cId ) #else -METHOD DeleteHeader( cId ) +METHOD DeleteHeader( cId ) #endif local nRet := -1, nId @@ -1211,7 +1211,7 @@ RETURN nRet #ifdef __XPP__ METHOD tPdf:EnableHeader( cId ) #else -METHOD EnableHeader( cId ) +METHOD EnableHeader( cId ) #endif local nId @@ -1228,7 +1228,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:DisableHeader( cId ) #else -METHOD DisableHeader( cId ) +METHOD DisableHeader( cId ) #endif local nId @@ -1245,7 +1245,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:SaveHeader( cFile ) #else -METHOD SaveHeader( cFile ) +METHOD SaveHeader( cFile ) #endif local cCmd @@ -1262,7 +1262,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Header( cFunction, cId, arr ) #else -METHOD Header( cFunction, cId, arr ) +METHOD Header( cFunction, cId, arr ) #endif local nId, nI, nLen, nIdLen @@ -1304,7 +1304,7 @@ RETURN cId #ifdef __XPP__ METHOD tPdf:DrawHeader() #else -METHOD DrawHeader() +METHOD DrawHeader() #endif local nI, _nFont, _nSize, nLen := len( ::aReport[ HEADER ] ) @@ -1362,7 +1362,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Margins( nTop, nLeft, nBottom ) #else -METHOD Margins( nTop, nLeft, nBottom ) +METHOD Margins( nTop, nLeft, nBottom ) #endif local nI, nLen := len( ::aReport[ HEADER ] ), nTemp, aTemp, nHeight @@ -1540,7 +1540,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:CreateHeader( _file, _size, _orient, _lpi, _width ) #else -METHOD CreateHeader( _file, _size, _orient, _lpi, _width ) +METHOD CreateHeader( _file, _size, _orient, _lpi, _width ) #endif local ; @@ -1640,7 +1640,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:ImageInfo( cFile ) #else -METHOD ImageInfo( cFile ) +METHOD ImageInfo( cFile ) #endif local cTemp := upper(substr( cFile, rat(".", cFile) + 1 )), aTemp := {} @@ -1657,7 +1657,7 @@ RETURN aTemp #ifdef __XPP__ METHOD tPdf:TIFFInfo( cFile ) #else -METHOD TIFFInfo( cFile ) +METHOD TIFFInfo( cFile ) #endif local c40 := chr(0)+chr(0)+chr(0)+chr(0) @@ -1832,7 +1832,7 @@ return aTemp #ifdef __XPP__ METHOD tPdf:JPEGInfo( cFile ) #else -METHOD JPEGInfo( cFile ) +METHOD JPEGInfo( cFile ) #endif local c255, nAt, nHandle @@ -1870,7 +1870,7 @@ return aTemp #ifdef __XPP__ METHOD tPdf:BookCount( nRecno, nCurLevel ) #else -METHOD BookCount( nRecno, nCurLevel ) +METHOD BookCount( nRecno, nCurLevel ) #endif local nTempLevel, nCount := 0, nLen := len( ::aReport[ BOOKMARK ] ) @@ -1893,7 +1893,7 @@ return -1 * nCount #ifdef __XPP__ METHOD tPdf:BookFirst( nRecno, nCurLevel, nObj ) #else -METHOD BookFirst( nRecno, nCurLevel, nObj ) +METHOD BookFirst( nRecno, nCurLevel, nObj ) #endif local nFirst := 0, nLen := len( ::aReport[ BOOKMARK ] ) @@ -1910,7 +1910,7 @@ return IIF( nFirst == 0, nFirst, nObj + nFirst ) #ifdef __XPP__ METHOD tPdf:BookLast( nRecno, nCurLevel, nObj ) #else -METHOD BookLast( nRecno, nCurLevel, nObj ) +METHOD BookLast( nRecno, nCurLevel, nObj ) #endif local nLast := 0, nLen := len( ::aReport[ BOOKMARK ] ) @@ -1932,7 +1932,7 @@ return IIF( nLast == 0, nLast, nObj + nLast ) #ifdef __XPP__ METHOD tPdf:BookNext( nRecno, nCurLevel, nObj ) #else -METHOD BookNext( nRecno, nCurLevel, nObj ) +METHOD BookNext( nRecno, nCurLevel, nObj ) #endif local nTempLevel, nNext := 0, nLen := len( ::aReport[ BOOKMARK ] ) @@ -1956,7 +1956,7 @@ return IIF( nNext == 0, nNext, nObj + nNext ) #ifdef __XPP__ METHOD tPdf:BookParent( nRecno, nCurLevel, nObj ) #else -METHOD BookParent( nRecno, nCurLevel, nObj ) +METHOD BookParent( nRecno, nCurLevel, nObj ) #endif local nTempLevel @@ -1977,7 +1977,7 @@ return IIF( nParent == 0, nObj - 1, nObj + nParent ) #ifdef __XPP__ METHOD tPdf:BookPrev( nRecno, nCurLevel, nObj ) #else -METHOD BookPrev( nRecno, nCurLevel, nObj ) +METHOD BookPrev( nRecno, nCurLevel, nObj ) #endif local nTempLevel @@ -2002,7 +2002,7 @@ return IIF( nPrev == 0, nPrev, nObj + nPrev ) #ifdef __XPP__ METHOD tPdf:CheckLine( nRow ) #else -METHOD CheckLine( nRow ) +METHOD CheckLine( nRow ) #endif IF nRow + ::aReport[ PDFTOP] > ::aReport[ PDFBOTTOM ] @@ -2017,7 +2017,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:GetFontInfo( cParam ) #else -METHOD GetFontInfo( cParam ) +METHOD GetFontInfo( cParam ) #endif local cRet @@ -2040,7 +2040,7 @@ return cRet #ifdef __XPP__ METHOD tPdf:M2R( mm ) #else -METHOD M2R( mm ) +METHOD M2R( mm ) #endif return int( ::aReport[ LPI ] * mm / 25.4 ) @@ -2050,7 +2050,7 @@ return int( ::aReport[ LPI ] * mm / 25.4 ) #ifdef __XPP__ METHOD tPdf:M2X( n ) #else -METHOD M2X( n ) +METHOD M2X( n ) #endif return n * 72 / 25.4 @@ -2058,9 +2058,9 @@ return n * 72 / 25.4 //-------------------------\\ #ifdef __XPP__ -METHOD tPdf:M2Y( n ) +METHOD tPdf:M2Y( n ) #else -METHOD M2Y( n ) +METHOD M2Y( n ) #endif return ::aReport[ PAGEY ] - n * 72 / 25.4 @@ -2070,7 +2070,7 @@ return ::aReport[ PAGEY ] - n * 72 / 25.4 #ifdef __XPP__ METHOD tPdf:R2D( nRow ) #else -METHOD R2D( nRow ) +METHOD R2D( nRow ) #endif return ::aReport[ PAGEY ] - nRow * 72 / ::aReport[ LPI ] @@ -2080,7 +2080,7 @@ return ::aReport[ PAGEY ] - nRow * 72 / ::aReport[ LPI ] #ifdef __XPP__ METHOD tPdf:R2M( nRow ) #else -METHOD R2M( nRow ) +METHOD R2M( nRow ) #endif return 25.4 * nRow / ::aReport[ LPI ] @@ -2090,7 +2090,7 @@ return 25.4 * nRow / ::aReport[ LPI ] #ifdef __XPP__ METHOD tPdf:X2M( n ) #else -METHOD X2M( n ) +METHOD X2M( n ) #endif return n * 25.4 / 72 @@ -2100,7 +2100,7 @@ return n * 25.4 / 72 #ifdef __XPP__ METHOD tPdf:TextPrint( nI, nLeft, lParagraph, nJustify, nSpace, nNew, nLength, nLineLen, nLines, nStart, cString, cDelim, cColor, lPrint ) #else -METHOD TextPrint( nI, nLeft, lParagraph, nJustify, nSpace, nNew, nLength, nLineLen, nLines, nStart, cString, cDelim, cColor, lPrint ) +METHOD TextPrint( nI, nLeft, lParagraph, nJustify, nSpace, nNew, nLength, nLineLen, nLines, nStart, cString, cDelim, cColor, lPrint ) #endif local nFinish, nL, nB, nJ, cToken, nRow @@ -2151,7 +2151,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:TextNextPara( cString, cDelim, nI ) #else -METHOD TextNextPara( cString, cDelim, nI ) +METHOD TextNextPara( cString, cDelim, nI ) #endif local nAt, cAt, nCRLF, nNew, nRat, nRet := 0 @@ -2171,7 +2171,7 @@ return nRet #ifdef __XPP__ METHOD tPdf:ClosePage() #else -METHOD ClosePage() +METHOD ClosePage() #endif local cTemp, cBuffer, nBuffer, nRead, nI, k, nImage, nFont, nImageHandle @@ -2360,7 +2360,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:FilePrint( cFile ) #else -METHOD FilePrint( cFile ) +METHOD FilePrint( cFile ) #endif local cPathAcro := "C:\progra~1\Adobe\Acroba~1.0\Reader" local cRun := cPathAcro + "\AcroRd32.exe /t " + cFile + " " + ; @@ -2379,7 +2379,7 @@ RETURN self #ifdef __XPP__ METHOD tPdf:Execute( cFile ) #else -METHOD Execute( cFile ) +METHOD Execute( cFile ) #endif // Replace cPathAcro with the path at your system local cPathAcro := "C:\progra~1\Adobe\Acroba~1.0\Reader" @@ -2628,8 +2628,8 @@ local lRet := .t. #ifdef __HARBOUR__ if cVerb != nil -// TOFIX: This requires hbwhat32, which in turns requires xhb. -// This has to solved differently. +// TOFIX: This requires hbwhat, which in turns requires xhb. +// This has to be solved differently. // ShellExecute( GetDeskTopWindow(), cVerb, cFile, , , 1 ) HB_SYMBOL_UNUSED( cFile ) else diff --git a/harbour/contrib/hbwin/hbwapi.h b/harbour/contrib/hbwin/hbwapi.h index cdc2c7c5eb..4e3fed4f66 100644 --- a/harbour/contrib/hbwin/hbwapi.h +++ b/harbour/contrib/hbwin/hbwapi.h @@ -51,35 +51,35 @@ */ #ifndef __HBWAPI_H - #define __HBWAPI_H +#define __HBWAPI_H - #define wapi_par_WNDPROC( n ) ( ( WNDPROC ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_WPARAM( n ) ( ( WPARAM ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_LPARAM( n ) ( ( LPARAM ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HWND( n ) ( ( HWND ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HDC( n ) ( ( HDC ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HANDLE( n ) ( ( HANDLE ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HGDIOBJ( n ) ( ( HGDIOBJ ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HBRUSH( n ) ( ( HBRUSH ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HBITMAP( n ) ( ( HBITMAP ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HICON( n ) ( ( HICON ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HIMAGELIST( n ) ( ( HIMAGELIST ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HFONT( n ) ( ( HFONT ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_HINSTANCE( n ) ( ( HINSTANCE ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_COLORREF( n ) ( ( COLORREF ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_WNDPROC( n ) ( ( WNDPROC ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_WPARAM( n ) ( ( WPARAM ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_LPARAM( n ) ( ( LPARAM ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HWND( n ) ( ( HWND ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HDC( n ) ( ( HDC ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HANDLE( n ) ( ( HANDLE ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HGDIOBJ( n ) ( ( HGDIOBJ ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HBRUSH( n ) ( ( HBRUSH ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HBITMAP( n ) ( ( HBITMAP ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HICON( n ) ( ( HICON ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HIMAGELIST( n ) ( ( HIMAGELIST ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HFONT( n ) ( ( HFONT ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_HINSTANCE( n ) ( ( HINSTANCE ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) +#define wapi_par_COLORREF( n ) ( ( COLORREF ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_STRUCT( n ) ( hb_parc( n ) ) +#define wapi_par_STRUCT( n ) ( hb_parc( n ) ) - #define wapi_par_BOOL( n ) ( hb_parl( n ) ) - #define wapi_par_INT( n ) ( hb_parni( n ) ) - #define wapi_par_UINT( n ) ( ( UINT ) hb_parni( n ) ) - #define wapi_par_LONG( n ) ( ( LONG ) hb_parnl( n ) ) +#define wapi_par_BOOL( n ) ( hb_parl( n ) ) +#define wapi_par_INT( n ) ( hb_parni( n ) ) +#define wapi_par_UINT( n ) ( ( UINT ) hb_parni( n ) ) +#define wapi_par_LONG( n ) ( ( LONG ) hb_parnl( n ) ) - #define wapi_ret_NI( i ) ( hb_retni( i ) ) - #define wapi_ret_L( b ) ( hb_retl( b ) ) +#define wapi_ret_NI( i ) ( hb_retni( i ) ) +#define wapi_ret_L( b ) ( hb_retl( b ) ) - #define wapi_ret_HANDLE( h ) ( hb_retptr( h ) ) - #define wapi_ret_HRESULT( hr ) ( hb_retptr( hr ) ) - #define wapi_ret_COLORREF( cr ) ( hb_retnint( ( HB_PTRDIFF ) cr ) ) +#define wapi_ret_HANDLE( h ) ( hb_retptr( h ) ) +#define wapi_ret_HRESULT( hr ) ( hb_retptr( hr ) ) +#define wapi_ret_COLORREF( cr ) ( hb_retnint( ( HB_PTRDIFF ) cr ) ) #endif /* __HBWAPI_H */ diff --git a/harbour/contrib/hbwin/wapi_commctrl.c b/harbour/contrib/hbwin/wapi_commctrl.c index 9c44728a87..d59b92caec 100644 --- a/harbour/contrib/hbwin/wapi_commctrl.c +++ b/harbour/contrib/hbwin/wapi_commctrl.c @@ -3,9 +3,8 @@ */ /* - * * Pritpal Bedi 14Feb2009 - * www - http://www.harbour.org + * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/harbour/contrib/hbwin/wapi_winuser.c b/harbour/contrib/hbwin/wapi_winuser.c index de9a0a575a..d674607e95 100644 --- a/harbour/contrib/hbwin/wapi_winuser.c +++ b/harbour/contrib/hbwin/wapi_winuser.c @@ -3,9 +3,8 @@ */ /* - * * Pritpal Bedi 17Feb2009 - * www - http://www.harbour.org + * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -224,7 +223,3 @@ HB_FUNC( WAPI_SHOWSCROLLBAR ) wapi_par_BOOL( 3 ) ) ); } /*----------------------------------------------------------------------*/ - - - - diff --git a/harbour/utils/hbmk/examples/contrib.hbp b/harbour/utils/hbmk/examples/contrib.hbp new file mode 100644 index 0000000000..c9db651222 --- /dev/null +++ b/harbour/utils/hbmk/examples/contrib.hbp @@ -0,0 +1,10 @@ +# +# $Id$ +# + +# Don't add here any contribs which have external dependencies +# or aren't equally available for all supported Harbour platforms. +# Thank you. [vszakats] + +# Some popular and portable Harbour contribs +libs=hbct hbmzip hbtip hbcrypt diff --git a/harbour/utils/hbmk/examples/winapi.hbp b/harbour/utils/hbmk/examples/winapi.hbp index cdd287ca23..8b6420dc20 100644 --- a/harbour/utils/hbmk/examples/winapi.hbp +++ b/harbour/utils/hbmk/examples/winapi.hbp @@ -5,5 +5,5 @@ # Used by Harbour core {win}libs=kernel32 user32 wsock32 advapi32 gdi32 # Others -{win}libs=winspool comctl32 comdlg32 shell32 ole32 oleaut32 uuid odbc32 mpr winmm +{win}libs=winspool comctl32 comdlg32 shell32 ole32 oleaut32 uuid odbc32 mpr winmm mapi32 {win&!bcc32}libs=odbccp32 diff --git a/harbour/utils/hbmk/hbmk2.prg b/harbour/utils/hbmk/hbmk2.prg index cb84c0d80c..9b9284d097 100644 --- a/harbour/utils/hbmk/hbmk2.prg +++ b/harbour/utils/hbmk/hbmk2.prg @@ -67,14 +67,30 @@ /* TODO: Support for more compilers/platforms. */ /* TODO: Cleanup on variable names. */ +/* + 2. compiler autodetection for two kinds of dir layout. */ +/* * 6. bldflags -> bldflagsC and bldflagsPRG */ +/* * 7. output file name auto detection should respect the compilation + mode, f.e. hbmk -cmp a.prg it should generate a.{o,obj} not 'a' + or 'a.exe'. QUESTION: What to do for multiple .prgs? */ +/* * 8. Stripping "lib" ".so/.dll/.a" ? */ +/* * 9. We should have support for passing object archives (.a) in + link file list and then pass it to GCC without -l parameter. + Using 'mylib.a' and '-lmylib' as GCC parameters has different + meaning so mylib.a should not be converted to -lmylib but simply + passed to GCC as is. */ +/* ! 12. hbcplr to add as a lib both when shared and static. */ + +ANNOUNCE HB_GTSYS +REQUEST HB_GT_CGI_DEFAULT + REQUEST hbm_ARCH REQUEST hbm_COMP +THREAD STATIC t_lQuiet := .F. +THREAD STATIC t_lInfo := .T. /* Enabled while hbmk gets matured, should later set to .F. */ THREAD STATIC t_cCOMP THREAD STATIC t_cARCH -THREAD STATIC t_lQuiet - FUNCTION Main( ... ) LOCAL aLIB_BASE1 := {; @@ -140,6 +156,7 @@ FUNCTION Main( ... ) LOCAL s_aOPTPRG LOCAL s_aOPTC LOCAL s_aOPTL + LOCAL s_cPROGDIR LOCAL s_cPROGNAME LOCAL s_cMAPNAME LOCAL s_aOBJ @@ -180,6 +197,7 @@ FUNCTION Main( ... ) LOCAL fhnd LOCAL lNOHBP LOCAL lSysLoc + LOCAL cSelfCOMP LOCAL lStopAfterHarbour := .F. LOCAL lStopAfterCComp := .F. @@ -187,6 +205,8 @@ FUNCTION Main( ... ) LOCAL aParams LOCAL cParam + LOCAL cDir, cName, cExt + LOCAL cDL_Version := hb_ntos( hb_Version( HB_VERSION_MAJOR ) ) + hb_ntos( hb_Version( HB_VERSION_MINOR ) ) IF PCount() == 0 @@ -196,56 +216,93 @@ FUNCTION Main( ... ) RETURN 9 ENDIF - t_lQuiet := .F. FOR EACH cParam IN hb_AParams() - IF Lower( cParam ) == "-q" - t_lQuiet := .T. - EXIT - ENDIF + DO CASE + CASE Lower( cParam ) == "-q" ; t_lQuiet := .T. ; t_lInfo := .F. + CASE Lower( Left( cParam, 6 ) ) == "-comp=" ; t_cCOMP := SubStr( cParam, 7 ) + CASE Lower( Left( cParam, 6 ) ) == "-arch=" ; t_cARCH := SubStr( cParam, 7 ) + CASE Lower( cParam ) == "-hbcc" ; t_lQuiet := .T. ; t_lInfo := .F. ; lStopAfterHarbour := .T. + CASE Lower( cParam ) == "-hbcmp" ; t_lQuiet := .T. ; t_lInfo := .F. ; lStopAfterHarbour := .F. ; lStopAfterCComp := .T. + CASE Lower( cParam ) == "-hblnk" ; t_lQuiet := .T. ; t_lInfo := .F. + CASE Lower( cParam ) == "-info" ; t_lInfo := .T. + ENDCASE NEXT + SWITCH Lower( FN_NameGet( hb_argv( 0 ) ) ) + CASE "hbcc" + t_lQuiet := .T. ; t_lInfo := .F. ; lStopAfterHarbour := .T. + IF t_lInfo + OutStd( "hbmk: Enabled -hbcc option." + hb_osNewLine() ) + ENDIF + EXIT + CASE "hbcmp" + t_lQuiet := .T. ; t_lInfo := .F. ; lStopAfterHarbour := .F. ; lStopAfterCComp := .T. + IF t_lInfo + OutStd( "hbmk: Enabled -hbcmp option." + hb_osNewLine() ) + ENDIF + EXIT + CASE "hblnk" + t_lQuiet := .T. ; t_lInfo := .F. + IF t_lInfo + OutStd( "hbmk: Enabled -hblnk option." + hb_osNewLine() ) + ENDIF + EXIT + ENDSWITCH + IF ! t_lQuiet ShowHeader() ENDIF - SWITCH Lower( FN_NameGet( hb_argv( 0 ) ) ) - CASE "hbcc" - lStopAfterHarbour := .T. - IF ! t_lQuiet - OutStd( "hbmk: Enabled -cc option." + hb_osNewLine() ) - ENDIF - EXIT - CASE "hbcmp" - lStopAfterCComp := .T. - IF ! t_lQuiet - OutStd( "hbmk: Enabled -cmp option." + hb_osNewLine() ) - ENDIF - EXIT - ENDSWITCH + /* Load architecture / compiler settings (compatibility) */ + + IF Empty( t_cARCH ) + t_cARCH := Lower( GetEnv( "HB_ARCHITECTURE" ) ) + ENDIF + IF Empty( t_cCOMP ) + t_cCOMP := Lower( GetEnv( "HB_COMPILER" ) ) + ENDIF /* Autodetect architecture */ - t_cARCH := Lower( GetEnv( "HB_ARCHITECTURE" ) ) IF Empty( t_cARCH ) + + /* NOTE: Keep this in sync manually. All compilers should be listed here, + which are supported on one architecture only. In the future this + should be automatically extracted from a comp/arch matrix. */ + SWITCH t_cCOMP + CASE "mingw" + CASE "mingwce" + CASE "msvc" + CASE "bcc32" + CASE "xcc" + CASE "pocc" + CASE "dmc" + t_cARCH := "win" + EXIT + CASE "djgpp" + t_cARCH := "dos" + EXIT + OTHERWISE #if defined( __PLATFORM__BSD ) - t_cARCH := "bsd" + t_cARCH := "bsd" #elif defined( __PLATFORM__DARWIN ) - t_cARCH := "darwin" + t_cARCH := "darwin" #elif defined( __PLATFORM__DOS ) - t_cARCH := "dos" + t_cARCH := "dos" #elif defined( __PLATFORM__HPUX ) - t_cARCH := "hpux" + t_cARCH := "hpux" #elif defined( __PLATFORM__LINUX ) - t_cARCH := "linux" + t_cARCH := "linux" #elif defined( __PLATFORM__OS2 ) - t_cARCH := "os2" + t_cARCH := "os2" #elif defined( __PLATFORM__SUNOS ) - t_cARCH := "sunos" + t_cARCH := "sunos" #elif defined( __PLATFORM__WINDOWS ) - t_cARCH := "win" + t_cARCH := "win" #endif + ENDSWITCH IF ! Empty( t_cARCH ) - IF ! t_lQuiet + IF t_lInfo OutStd( "hbmk: Autodetected HB_ARCHITECTURE: " + t_cARCH + hb_osNewLine() ) ENDIF ENDIF @@ -264,22 +321,24 @@ FUNCTION Main( ... ) s_aLIBHBGT := { "gttrm", "gtxwc" } CASE t_cARCH == "dos" aCOMPDET := { { "gcc.exe" , "djgpp" },; - { "wpp386.exe", "owatcom" } } + { "wpp386.exe", "owatcom" } } /* TODO: Add full support for wcc386.exe */ aCOMPSUP := { "djgpp", "gcc", "owatcom", "rsx32" } cBin_CompPRG := "harbour.exe" s_aLIBHBGT := { "gtdos" } CASE t_cARCH == "os2" aCOMPDET := { { "gcc.exe" , "gcc" },; - { "wpp386.exe", "owatcom" },; + { "wpp386.exe", "owatcom" },; /* TODO: Add full support for wcc386.exe */ { "icc.exe" , "icc" } } aCOMPSUP := { "gcc", "owatcom", "icc" } cBin_CompPRG := "harbour.exe" s_aLIBHBGT := { "gtos2" } CASE t_cARCH == "win" - aCOMPDET := { { "gcc.exe" , "mingw" },; + /* Ordering is significant. + owatcom also keeps a cl.exe in it's binary dir. */ + aCOMPDET := { { "gcc.exe" , "mingw" },; /* TODO: Add full support for g++.exe */ + { "wpp386.exe", "owatcom" },; /* TODO: Add full support for wcc386.exe */ { "cl.exe" , "msvc" },; { "bcc32.exe" , "bcc32" },; - { "wpp386.exe", "owatcom" },; { "pocc.exe" , "pocc" },; { "dmc.exe" , "dmc" },; { "icc.exe" , "icc" },; @@ -296,22 +355,38 @@ FUNCTION Main( ... ) /* Autodetect compiler */ - t_cCOMP := Lower( GetEnv( "HB_COMPILER" ) ) IF Empty( t_cCOMP ) IF Len( aCOMPSUP ) == 1 t_cCOMP := aCOMPSUP[ 1 ] ELSEIF t_cARCH == "linux" t_cCOMP := "gcc" ELSEIF ! Empty( aCOMPDET ) - FOR tmp := 1 TO Len( aCOMPDET ) - IF FindInPath( aCOMPDET[ tmp ][ 1 ] ) - t_cCOMP := aCOMPDET[ tmp ][ 2 ] - EXIT - ENDIF - NEXT + /* Which compiler was used to compile ourselves? */ + cSelfCOMP := SelfCOMP() + /* Skip it for msvc, as it creates problems for other compilers. */ + IF !( cSelfCOMP $ "msvc" ) + /* Look for this compiler first */ + FOR tmp := 1 TO Len( aCOMPDET ) + IF aCOMPDET[ tmp ][ 2 ] == cSelfCOMP .AND. FindInPath( aCOMPDET[ tmp ][ 1 ] ) + t_cCOMP := aCOMPDET[ tmp ][ 2 ] + EXIT + ENDIF + NEXT + ELSE + cSelfCOMP := "" + ENDIF + IF Empty( t_cCOMP ) + /* Check the rest of compilers */ + FOR tmp := 1 TO Len( aCOMPDET ) + IF !( aCOMPDET[ tmp ][ 2 ] == cSelfCOMP ) .AND. FindInPath( aCOMPDET[ tmp ][ 1 ] ) + t_cCOMP := aCOMPDET[ tmp ][ 2 ] + EXIT + ENDIF + NEXT + ENDIF ENDIF IF ! Empty( t_cCOMP ) - IF ! t_lQuiet + IF t_lInfo OutStd( "hbmk: Autodetected HB_COMPILER: " + t_cCOMP + hb_osNewLine() ) ENDIF ELSE @@ -342,11 +417,11 @@ FUNCTION Main( ... ) lSysLoc := .F. - s_cHB_BIN_INSTALL := DirAdaptPathSep( GetEnv( "HB_BIN_INSTALL" ) ) - s_cHB_LIB_INSTALL := DirAdaptPathSep( GetEnv( "HB_LIB_INSTALL" ) ) - s_cHB_INC_INSTALL := DirAdaptPathSep( GetEnv( "HB_INC_INSTALL" ) ) + s_cHB_BIN_INSTALL := PathSepToTarget( GetEnv( "HB_BIN_INSTALL" ) ) + s_cHB_LIB_INSTALL := PathSepToTarget( GetEnv( "HB_LIB_INSTALL" ) ) + s_cHB_INC_INSTALL := PathSepToTarget( GetEnv( "HB_INC_INSTALL" ) ) - s_cHB_INSTALL_PREFIX := DirAdaptPathSep( GetEnv( "HB_INSTALL_PREFIX" ) ) + s_cHB_INSTALL_PREFIX := PathSepToTarget( GetEnv( "HB_INSTALL_PREFIX" ) ) IF Empty( s_cHB_INSTALL_PREFIX ) DO CASE @@ -405,7 +480,7 @@ FUNCTION Main( ... ) AAddNotEmpty( s_aLIBPATH, s_cHB_LIB_INSTALL ) - IF ! t_lQuiet + IF t_lInfo OutStd( "hbmk: Using Harbour: " + s_cHB_BIN_INSTALL + " " + s_cHB_INC_INSTALL + " " + s_cHB_LIB_INSTALL + hb_osNewLine() ) ENDIF @@ -440,6 +515,7 @@ FUNCTION Main( ... ) s_aRESCMP := {} s_aLIBUSER := {} s_aOBJUSER := {} + s_cPROGDIR := NIL s_cPROGNAME := NIL /* Collect all command line parameters */ @@ -486,7 +562,16 @@ FUNCTION Main( ... ) FOR EACH cParam IN aParams DO CASE - CASE Lower( cParam ) == "-q" /* Simply ignore */ + CASE Lower( cParam ) == "-q" .OR. ; + Lower( Left( cParam, 6 ) ) == "-comp=" .OR. ; + Lower( Left( cParam, 6 ) ) == "-arch=" .OR. ; + Lower( cParam ) == "-hbcc" .OR. ; + Lower( cParam ) == "-hbcmp" .OR. ; + Lower( cParam ) == "-hblnk" .OR. ; + Lower( cParam ) == "-info" + + /* Simply ignore. The were already processed in the first pass. */ + CASE Lower( cParam ) == "-gui" ; s_lGUI := .T. CASE Lower( cParam ) == "-mwindows" ; s_lGUI := .T. /* Compatibility */ CASE Lower( cParam ) == "-std" ; s_lGUI := .F. @@ -515,16 +600,25 @@ FUNCTION Main( ... ) CASE Lower( cParam ) == "-trace" ; s_lTRACE := .T. CASE Lower( cParam ) == "-trace-" ; s_lTRACE := .F. CASE Lower( cParam ) == "-notrace" ; s_lTRACE := .F. - CASE Lower( cParam ) == "-cc" ; lStopAfterHarbour := .T. - CASE Lower( cParam ) == "-cmp" ; lStopAfterHarbour := .F. ; lStopAfterCComp := .T. CASE Lower( Left( cParam, 3 ) ) == "-gt" ; DEFAULT s_cGT TO SubStr( cParam, 2 ) - CASE Left( cParam, 2 ) == "-o" ; s_cPROGNAME := DirAdaptPathSep( SubStr( cParam, 3 ) ) + CASE Left( cParam, 2 ) == "-o" + + tmp := PathSepToSelf( SubStr( cParam, 3 ) ) + hb_FNameSplit( tmp, @cDir, @cName, @cExt ) + IF ! Empty( cDir ) .AND. Empty( cName ) .AND. Empty( cExt ) + /* Only a dir was passed, let's store that and pick a default name later. */ + s_cPROGDIR := cDir + ELSE + s_cPROGDIR := NIL + s_cPROGNAME := tmp + ENDIF + CASE Left( cParam, 2 ) == "-l" .AND. ; Len( cParam ) > 2 .AND. ; - !( Left( cParam, 3 ) == "-l-" ) ; AAddNotEmpty( s_aLIBUSER, DirAdaptPathSep( ArchCompFilter( SubStr( cParam, 3 ) ) ) ) + !( Left( cParam, 3 ) == "-l-" ) ; AAddNotEmpty( s_aLIBUSER, PathSepToTarget( ArchCompFilter( SubStr( cParam, 3 ) ) ) ) CASE Left( cParam, 2 ) == "-L" .AND. ; - Len( cParam ) > 2 ; AAddNotEmpty( s_aLIBPATH, DirAdaptPathSep( ArchCompFilter( SubStr( cParam, 3 ) ) ) ) - CASE Left( cParam, 1 ) == "-" ; AAdd( s_aOPTPRG , DirAdaptPathSep( cParam ) ) + Len( cParam ) > 2 ; AAddNotEmpty( s_aLIBPATH, PathSepToTarget( ArchCompFilter( SubStr( cParam, 3 ) ) ) ) + CASE Left( cParam, 1 ) == "-" ; AAdd( s_aOPTPRG , PathSepToTarget( cParam ) ) CASE Lower( FN_ExtGet( cParam ) ) == ".hbp" HBP_ProcessOne( cParam,; @@ -544,13 +638,13 @@ FUNCTION Main( ... ) @s_lRUN,; @s_cGT ) - CASE Lower( FN_ExtGet( cParam ) ) == ".prg" ; AAdd( s_aPRG , DirAdaptPathSep( cParam ) ) ; DEFAULT s_cPROGNAME TO DirAdaptPathSep( cParam ) - CASE Lower( FN_ExtGet( cParam ) ) == ".rc" ; AAdd( s_aRESSRC , DirAdaptPathSep( cParam ) ) - CASE Lower( FN_ExtGet( cParam ) ) == ".res" ; AAdd( s_aRESCMP , DirAdaptPathSep( cParam ) ) - CASE Lower( FN_ExtGet( cParam ) ) $ ".o|.obj" ; AAdd( s_aOBJUSER, DirAdaptPathSep( cParam ) ) ; DEFAULT s_cPROGNAME TO DirAdaptPathSep( cParam ) - CASE Lower( FN_ExtGet( cParam ) ) $ ".c|.cpp" ; AAdd( s_aC , DirAdaptPathSep( cParam ) ) ; DEFAULT s_cPROGNAME TO DirAdaptPathSep( cParam ) - CASE Lower( FN_ExtGet( cParam ) ) $ ".a|.lib" ; AAddNotEmpty( s_aLIBUSER, DirAdaptPathSep( ArchCompFilter( cParam ) ) ) - OTHERWISE ; AAdd( s_aPRG , DirAdaptPathSep( cParam ) ) ; DEFAULT s_cPROGNAME TO DirAdaptPathSep( cParam ) + CASE Lower( FN_ExtGet( cParam ) ) == ".prg" ; AAdd( s_aPRG , PathSepToTarget( cParam ) ) ; DEFAULT s_cPROGNAME TO PathSepToSelf( cParam ) + CASE Lower( FN_ExtGet( cParam ) ) == ".rc" ; AAdd( s_aRESSRC , PathSepToTarget( cParam ) ) + CASE Lower( FN_ExtGet( cParam ) ) == ".res" ; AAdd( s_aRESCMP , PathSepToTarget( cParam ) ) + CASE Lower( FN_ExtGet( cParam ) ) $ ".o|.obj" ; AAdd( s_aOBJUSER, PathSepToTarget( cParam ) ) ; DEFAULT s_cPROGNAME TO PathSepToSelf( cParam ) + CASE Lower( FN_ExtGet( cParam ) ) $ ".c|.cpp" ; AAdd( s_aC , PathSepToTarget( cParam ) ) ; DEFAULT s_cPROGNAME TO PathSepToSelf( cParam ) + CASE Lower( FN_ExtGet( cParam ) ) $ ".a|.lib" ; AAddNotEmpty( s_aLIBUSER, PathSepToTarget( ArchCompFilter( cParam ) ) ) + OTHERWISE ; AAdd( s_aPRG , PathSepToTarget( cParam ) ) ; DEFAULT s_cPROGNAME TO PathSepToSelf( cParam ) ENDCASE NEXT @@ -574,10 +668,17 @@ FUNCTION Main( ... ) ENDIF /* Merge user libs from command line and envvar. Command line has priority. */ - s_aLIBUSER := ArrayAJoin( { s_aLIBUSER, ListToArray( DirAdaptPathSep( GetEnv( "HB_USER_LIBS" ) ) ) } ) + s_aLIBUSER := ArrayAJoin( { s_aLIBUSER, ListToArray( PathSepToTarget( GetEnv( "HB_USER_LIBS" ) ) ) } ) - /* Strip extension from output name. */ - s_cMAPNAME := FN_ExtSet( s_cPROGNAME, ".map" ) + /* Combine output dir with output name. */ + IF ! Empty( s_cPROGDIR ) + hb_FNameSplit( s_cPROGNAME, @cDir, @cName, @cExt ) + s_cPROGNAME := hb_FNameMerge( iif( Empty( cDir ), s_cPROGDIR, cDir ), cName, cExt ) + ENDIF + + /* Determine map name from output name. */ + s_cMAPNAME := PathSepToTarget( FN_ExtSet( s_cPROGNAME, ".map" ) ) + /* Set output name extension. */ IF t_cARCH $ "os2|win|dos" s_cPROGNAME := FN_ExtSet( s_cPROGNAME, ".exe" ) ELSE @@ -667,20 +768,26 @@ FUNCTION Main( ... ) CASE ( t_cARCH == "bsd" .AND. t_cCOMP == "gcc" ) .OR. ; ( t_cARCH == "darwin" .AND. t_cCOMP == "gcc" ) .OR. ; ( t_cARCH == "hpux" .AND. t_cCOMP == "gcc" ) .OR. ; - ( t_cARCH == "linux" .AND. t_cCOMP $ "gcc|gpp" ) .OR. ; - ( t_cARCH == "sunos" .AND. t_cCOMP == "gcc" ) + ( t_cARCH == "sunos" .AND. t_cCOMP == "gcc" ) .OR. ; + ( t_cARCH == "linux" .AND. t_cCOMP == "gcc" ) .OR. ; + ( t_cARCH == "linux" .AND. t_cCOMP == "gpp" ) cLibPrefix := "-l" cLibExt := NIL cObjExt := ".o" cBin_CompC := iif( t_cCOMP == "gpp", "g++", "gcc" ) - cOpt_CompC := "{C} {O} -O3 -o{E} {OPTC} -I{I} {A} {L}" + cOpt_CompC := "{C} {O} -O3 -o{E} {OPTC} -I{I} {A}" cLibPathPrefix := "-L" cLibPathSep := " " - IF s_lMAP - cOpt_CompC += " -Wl,-Map " + s_cMAPNAME + IF t_cARCH == "linux" + cOpt_CompC += " -Wl,--start-group {L} -Wl,--end-group" + ELSE + cOpt_CompC += " {L}" + aLIB_BASE2 := ArrayAJoin( { aLIB_BASE2, { "hbcommon", "hbrtl" }, s_aLIBVM } ) + ENDIF + IF s_lMAP + cOpt_CompC += " -Wl,-Map " + s_cMAPNAME ENDIF - aLIB_BASE2 := ArrayAJoin( { aLIB_BASE2, { "hbcommon", "hbrtl" }, s_aLIBVM } ) IF t_cARCH == "darwin" AAdd( s_aOPTC, "-no-cpp-precomp -Wno-long-double" ) ENDIF @@ -709,19 +816,23 @@ FUNCTION Main( ... ) cLibPathPrefix := "-L" cLibPathSep := " " IF s_lMAP - cOpt_CompC += " -Wl,-Map " + s_cMAPNAME + cOpt_CompC += " -Wl,-Map " + s_cMAPNAME ENDIF IF s_lSHARED - cOpt_CompC += " -L{B}" + cOpt_CompC += " -L{B}" ENDIF IF t_cCOMP == "gcc" - cOpt_CompC += " -mno-cygwin" + cOpt_CompC += " -mno-cygwin" ENDIF IF t_cCOMP == "rsxnt" - cOpt_CompC += " -Zwin32" + cOpt_CompC += " -Zwin32" + ENDIF + IF t_cCOMP == "mingw" + cOpt_CompC += " -Wl,--start-group {L} -Wl,--end-group" + ELSE + cOpt_CompC += " {L}" + aLIB_BASE2 := ArrayAJoin( { aLIB_BASE2, { "hbcommon", "hbrtl" }, s_aLIBVM } ) ENDIF - cOpt_CompC += " {L}" - aLIB_BASE2 := ArrayAJoin( { aLIB_BASE2, { "hbcommon", "hbrtl" }, s_aLIBVM } ) IF s_lSTRIP AAdd( s_aOPTC, "-s" ) ENDIF @@ -736,14 +847,19 @@ FUNCTION Main( ... ) cLibExt := NIL cObjExt := ".o" cBin_CompC := "gcc" - cOpt_CompC := "{C} {O} -O3 -o{E} {OPTC} -I{I} {A} {L}{SCRIPT}" + cOpt_CompC := "{C} {O} -O3 -o{E} {OPTC} -I{I} {A}{SCRIPT}" cLibPathPrefix := "-L" cLibPathSep := " " IF t_cCOMP == "rsx32" - cOpt_CompC += " -Zrsx32" + cOpt_CompC += " -Zrsx32" + ENDIF + IF t_cCOMP == "djgpp" + cOpt_CompC += " -Wl,--start-group {L} -Wl,--end-group" + ELSE + cOpt_CompC += " {L}" + aLIB_BASE2 := ArrayAJoin( { aLIB_BASE2, { "hbcommon", "hbrtl" }, s_aLIBVM } ) ENDIF s_aLIBSYS := ArrayJoin( s_aLIBSYS, { "m" } ) - aLIB_BASE2 := ArrayAJoin( { aLIB_BASE2, { "hbcommon", "hbrtl" }, s_aLIBVM } ) IF s_lSTRIP AAdd( s_aOPTC, "-s" ) ENDIF @@ -757,10 +873,12 @@ FUNCTION Main( ... ) cLibExt := ".lib" cObjPrefix := "FILE " cObjExt := ".obj" + cLibPathPrefix := "LIBPATH " + cLibPathSep := " " cBin_CompC := "wpp386" cOpt_CompC := "-j -w3 -5s -5r -fp5 -oxehtz -zq -zt0 -bt=DOS {OPTC} {C}" cBin_Link := "wlink" - cOpt_Link := "OP osn=DOS OP stack=65536 OP CASEEXACT OP stub=cwstub.exe {OPTL} NAME {E} {O} {L}{SCRIPT}" + cOpt_Link := "OP osn=DOS OP stack=65536 OP CASEEXACT OP stub=cwstub.exe {OPTL} NAME {E} {O} {A} {L}{SCRIPT}" IF s_lDEBUG cOpt_Link := "DEBUG " + cOpt_Link ENDIF @@ -770,10 +888,12 @@ FUNCTION Main( ... ) cLibExt := ".lib" cObjPrefix := "FILE " cObjExt := ".obj" + cLibPathPrefix := "LIBPATH " + cLibPathSep := " " cBin_CompC := "wpp386" - cOpt_CompC := "-j -w3 -5s -5r -fp5 -oxehtz -zq -zt0 -mf -bt=NT {OPTC} {C}" + cOpt_CompC := "-w3 -5s -5r -fp5 -onaehtzr -zq -zt0 -bt=NT -oi+ -s {OPTC} {C}" cBin_Link := "wlink" - cOpt_Link := "OP osn=NT OP stack=65536 OP CASEEXACT {OPTL} NAME {E} {O} {L}{SCRIPT}" + cOpt_Link := "OP osn=NT OP stack=65536 OP CASEEXACT {OPTL} NAME {E} {O} {A} {L}{SCRIPT}" IF s_lDEBUG cOpt_Link := "DEBUG " + cOpt_Link ENDIF @@ -813,10 +933,12 @@ FUNCTION Main( ... ) cLibExt := ".lib" cObjPrefix := "FILE " cObjExt := ".obj" + cLibPathPrefix := "LIBPATH " + cLibPathSep := " " cBin_CompC := "wpp386" cOpt_CompC := "-j -w3 -5s -5r -fp5 -oxehtz -zq -zt0 -mf -bt=OS2 {OPTC} {C}" cBin_Link := "wlink" - cOpt_Link := "OP stack=65536 OP CASEEXACT {OPTL} NAME {E} {O} {L}{SCRIPT}" + cOpt_Link := "OP stack=65536 OP CASEEXACT {OPTL} NAME {E} {O} {A} {L}{SCRIPT}" IF s_lDEBUG cOpt_Link := "DEBUG " + cOpt_Link ENDIF @@ -842,10 +964,12 @@ FUNCTION Main( ... ) cLibExt := ".lib" cObjPrefix := "FILE " cObjExt := ".obj" + cLibPathPrefix := "LIBPATH " + cLibPathSep := " " cBin_CompC := "wpp386" cOpt_CompC := "-j -w3 -5s -5r -fp5 -oxehtz -zq -zt0 -mf -bt=LINUX {OPTC} {C}" cBin_Link := "wlink" - cOpt_Link := "ALL SYS LINUX OP CASEEXACT {OPTL} NAME {E} {O} {L}" + cOpt_Link := "ALL SYS LINUX OP CASEEXACT {OPTL} NAME {E} {O} {A} {L}{SCRIPT}" IF s_lDEBUG cOpt_Link := "DEBUG " + cOpt_Link ENDIF @@ -855,7 +979,7 @@ FUNCTION Main( ... ) IF s_lDEBUG AAdd( s_aOPTC, "-y -v" ) ELSE - AAdd( s_aCLEAN, FN_ExtSet( s_cPROGNAME, ".tds" ) ) + AAdd( s_aCLEAN, PathSepToTarget( FN_ExtSet( s_cPROGNAME, ".tds" ) ) ) ENDIF IF s_lGUI AAdd( s_aOPTC, "-tW" ) @@ -868,10 +992,10 @@ FUNCTION Main( ... ) cLibPathPrefix := "" cLibPathSep := ";" IF s_lSHARED - cOpt_CompC += " -L{B}" + cOpt_CompC += " -L{B}" ENDIF IF s_lMAP - cOpt_CompC += " -M" + cOpt_CompC += " -M" ENDIF /* TOFIX: The two build systems should generate the same .dll name, otherwise we can only be compatible with one of them. non-GNU is the common choice here. */ @@ -895,13 +1019,13 @@ FUNCTION Main( ... ) cLibPathPrefix := "/libpath:" cLibPathSep := " " IF s_lMAP - AAdd( s_aOPTC, "-Fm" ) + AAdd( s_aOPTC, "-Fm" ) ENDIF IF lStopAfterCComp AAdd( s_aOPTC, "-c" ) ENDIF IF s_lSHARED - AAdd( s_aOPTL, "/libpath:{B}" ) + AAdd( s_aOPTL, "/libpath:{B}" ) ENDIF s_aLIBSYS := ArrayJoin( s_aLIBSYS, { "user32", "wsock32", "advapi32", "gdi32" } ) /* TOFIX: The two build systems should generate the same .dll name, otherwise @@ -920,20 +1044,20 @@ FUNCTION Main( ... ) cBin_CompC := "pocc" cOpt_CompC := "/Ze /Go /Ot /Tx86-coff {OPTC} /I{I} {C}" IF s_lMT - AAdd( s_aOPTC, "/MT" ) + AAdd( s_aOPTC, "/MT" ) ENDIF cBin_Link := "polink" cOpt_Link := "{O} {A} {OPTL} {L}" cLibPathPrefix := "/libpath:" cLibPathSep := " " IF s_lSHARED - AAdd( s_aOPTL, "/libpath:{B}" ) + AAdd( s_aOPTL, "/libpath:{B}" ) ENDIF IF s_lMAP - AAdd( s_aOPTL, "/map" ) + AAdd( s_aOPTL, "/map" ) ENDIF IF s_lDEBUG - AAdd( s_aOPTL, "/debug" ) + AAdd( s_aOPTL, "/debug" ) ENDIF s_aLIBSYS := ArrayJoin( s_aLIBSYS, { "user32", "wsock32", "advapi32", "gdi32" } ) @@ -948,7 +1072,8 @@ FUNCTION Main( ... ) ENDCASE IF s_lSHARED .AND. ! Empty( s_aLIBSHARED ) - s_aLIBHB := s_aLIBSHARED + s_aLIBHB := ArrayAJoin( { s_aLIBSHARED,; + aLIB_BASE_DEBUG } ) ELSE s_aLIBHB := ArrayAJoin( { aLIB_BASE1,; aLIB_BASE_DEBUG,; @@ -980,7 +1105,7 @@ FUNCTION Main( ... ) GetEnv( "HB_USER_CFLAGS" ) + " " + ArrayToList( s_aOPTC ) ) cOpt_CompC := StrTran( cOpt_CompC, "{OPTL}", iif( s_lBLDFLG, hb_Version( HB_VERSION_FLAG_LINKER ) + " ", "" ) +; GetEnv( "HB_USER_LDFLAGS" ) + " " + ArrayToList( s_aOPTL ) ) - cOpt_CompC := StrTran( cOpt_CompC, "{E}" , s_cPROGNAME ) + cOpt_CompC := StrTran( cOpt_CompC, "{E}" , PathSepToTarget( s_cPROGNAME ) ) cOpt_CompC := StrTran( cOpt_CompC, "{B}" , s_cHB_BIN_INSTALL ) cOpt_CompC := StrTran( cOpt_CompC, "{I}" , s_cHB_INC_INSTALL ) cOpt_CompC := StrTran( cOpt_CompC, "{A}" , ArrayToList( ListCook( s_aLIBPATH, cLibPathPrefix ), cLibPathSep ) ) @@ -989,7 +1114,7 @@ FUNCTION Main( ... ) /* Handle moving the whole command line to a script, if requested. */ IF "{SCRIPT}" $ cOpt_CompC - fhnd := hb_FTempCreateEx( @cScriptFile ) + fhnd := hb_FTempCreateEx( @cScriptFile, NIL, NIL, ".cpl" ) IF fhnd != F_ERROR FWrite( fhnd, StrTran( cOpt_CompC, "{SCRIPT}", "" ) ) FClose( fhnd ) @@ -1030,7 +1155,7 @@ FUNCTION Main( ... ) cOpt_Link := StrTran( cOpt_Link, "{L}" , ArrayToList( s_aLIB ) ) cOpt_Link := StrTran( cOpt_Link, "{OPTL}", iif( s_lBLDFLG, hb_Version( HB_VERSION_FLAG_LINKER ) + " ", "" ) +; GetEnv( "HB_USER_LDFLAGS" ) + " " + ArrayToList( s_aOPTL ) ) - cOpt_Link := StrTran( cOpt_Link, "{E}" , s_cPROGNAME ) + cOpt_Link := StrTran( cOpt_Link, "{E}" , PathSepToTarget( s_cPROGNAME ) ) cOpt_Link := StrTran( cOpt_Link, "{B}" , s_cHB_BIN_INSTALL ) cOpt_Link := StrTran( cOpt_Link, "{A}" , ArrayToList( ListCook( s_aLIBPATH, cLibPathPrefix ), cLibPathSep ) ) @@ -1038,9 +1163,9 @@ FUNCTION Main( ... ) /* Handle moving the whole command line to a script, if requested. */ IF "{SCRIPT}" $ cOpt_Link - fhnd := hb_FTempCreateEx( @cScriptFile ) + fhnd := hb_FTempCreateEx( @cScriptFile, NIL, NIL, ".lnk" ) IF fhnd != F_ERROR - FWrite( fhnd, StrTran( cOpt_CompC, "{SCRIPT}", "" ) ) + FWrite( fhnd, StrTran( cOpt_Link, "{SCRIPT}", "" ) ) FClose( fhnd ) cOpt_Link := "@" + cScriptFile ELSE @@ -1083,33 +1208,66 @@ FUNCTION Main( ... ) PauseForKey() ELSEIF s_lRUN #if !( defined( __PLATFORM__WINDOWS ) .OR. defined( __PLATFORM__DOS ) .OR. defined( __PLATFORM__OS2 ) ) - IF ! Empty( FN_DirGet( s_cPROGNAME ) ) + IF Empty( FN_DirGet( s_cPROGNAME ) ) s_cPROGNAME := "." + hb_osPathSeparator() + s_cPROGNAME ENDIF #endif IF s_lTRACE - OutStd( "hbmk: Running executable: '" + s_cPROGNAME + "'" + hb_osNewLine() ) + OutStd( "hbmk: Running executable: '" + PathSepToTarget( s_cPROGNAME ) + "'" + hb_osNewLine() ) ENDIF - nErrorLevel := hb_run( s_cPROGNAME ) + nErrorLevel := hb_run( PathSepToTarget( s_cPROGNAME ) ) ENDIF ENDIF ENDIF RETURN nErrorLevel +STATIC FUNCTION SelfCOMP() + LOCAL cCompiler := hb_Compiler() + + IF "Microsoft Visual C" $ cCompiler ; RETURN "msvc" + ELSEIF "Borland" $ cCompiler ; RETURN "bcc32" + ELSEIF "CodeGear" $ cCompiler ; RETURN "bcc32" + ELSEIF "DJGPP" $ cCompiler ; RETURN "djgpp" + ELSEIF "MinGW" $ cCompiler ; RETURN "mingw" + ELSEIF "GNU C++" $ cCompiler ; RETURN "gcc" + ELSEIF "GNU C" $ cCompiler ; RETURN "gcc" + ELSEIF "Watcom C++" $ cCompiler ; RETURN "owatcom" + ELSEIF "Watcom C" $ cCompiler ; RETURN "owatcom" + ELSEIF "Pelles ISO C" $ cCompiler ; RETURN "pocc" + ELSEIF "Digital Mars" $ cCompiler ; RETURN "dmc" + ELSEIF "(XCC)" $ cCompiler ; RETURN "xcc" + ENDIF + + RETURN "" + +/* TODO: Add default .exe extension for win|os2|dos */ STATIC FUNCTION FindInPath( cFileName ) LOCAL cPATH LOCAL cDir + LOCAL cName + LOCAL cExt + /* Check in current dir. */ IF hb_FileExists( cFileName ) RETURN .T. ENDIF + hb_FNameSplit( cFileName,, @cName, @cExt ) + + /* Check in the dir of this executable. */ + IF ! Empty( hb_DirBase() ) + IF hb_FileExists( hb_FNameMerge( hb_DirBase(), cName, cExt ) ) + RETURN .T. + ENDIF + ENDIF + + /* Check in the PATH. */ cPATH := GetEnv( "PATH" ) IF ! Empty( cPATH ) FOR EACH cDir IN hb_ATokens( cPATH, hb_osPathListSeparator(), .T. ) IF ! Empty( cDir ) - IF hb_FileExists( DirAddPathSep( StrStripQuote( cDir ) ) + cFileName ) + IF hb_FileExists( hb_FNameMerge( DirAddPathSep( StrStripQuote( cDir ) ), cName, cExt ) ) RETURN .T. ENDIF ENDIF @@ -1156,7 +1314,8 @@ STATIC FUNCTION AAddNotEmpty( aArray, xItem ) RETURN aArray /* Append optional prefix and optional extension to all members */ -STATIC FUNCTION ListCook( array, cPrefix, cExt ) +STATIC FUNCTION ListCook( arraySrc, cPrefix, cExt ) + LOCAL array := AClone( arraySrc ) LOCAL tmp DEFAULT cPrefix TO "" @@ -1197,7 +1356,14 @@ STATIC FUNCTION ListToArray( cList ) RETURN array -STATIC FUNCTION DirAdaptPathSep( cFileName ) +STATIC FUNCTION PathSepToSelf( cFileName ) +#if defined( __PLATFORM__WINDOWS ) .OR. defined( __PLATFORM__DOS ) .OR. defined( __PLATFORM__OS2 ) + RETURN StrTran( cFileName, "/", "\" ) +#else + RETURN StrTran( cFileName, "\", "/" ) +#endif + +STATIC FUNCTION PathSepToTarget( cFileName ) IF t_cARCH $ "win|dos|os2" .AND. !( t_cCOMP == "mingw" ) RETURN StrTran( cFileName, "/", "\" ) @@ -1241,6 +1407,13 @@ STATIC FUNCTION FN_ExtSet( cFileName, cExt ) RETURN hb_FNameMerge( cDir, cName, cExt ) +STATIC FUNCTION FN_ExtSetDef( cFileName, cExtNew ) + LOCAL cDir, cName, cExt + + hb_FNameSplit( cFileName, @cDir, @cName, @cExt ) + + RETURN hb_FNameMerge( cDir, cName, iif( Empty( cExt ) .AND. ! Empty( cExtNew ), cExtNew, cExt ) ) + STATIC PROCEDURE HBP_ProcessAll( /* @ */ aLIBS,; /* @ */ aLIBPATH,; /* @ */ aOPTPRG,; @@ -1260,7 +1433,7 @@ STATIC PROCEDURE HBP_ProcessAll( /* @ */ aLIBS,; LOCAL aFile FOR EACH aFile IN aFiles - IF ! t_lQuiet + IF t_lInfo OutStd( "hbmk: Processing: " + aFile[ F_NAME ] + hb_osNewLine() ) ENDIF HBP_ProcessOne( aFile[ F_NAME ],; @@ -1319,7 +1492,7 @@ STATIC PROCEDURE HBP_ProcessOne( cFileName,; DO CASE CASE Lower( Left( cLine, Len( "libs=" ) ) ) == "libs=" ; cLine := SubStr( cLine, Len( "libs=" ) + 1 ) FOR EACH cItem IN hb_ATokens( cLine,, .T. ) - cItem := DirAdaptPathSep( StrStripQuote( cItem ) ) + cItem := PathSepToTarget( StrStripQuote( cItem ) ) IF AScan( aLIBS, {| tmp | tmp == cItem } ) == 0 AAddNotEmpty( aLIBS, cItem ) ENDIF @@ -1327,7 +1500,7 @@ STATIC PROCEDURE HBP_ProcessOne( cFileName,; CASE Lower( Left( cLine, Len( "libpaths=" ) ) ) == "libpaths=" ; cLine := SubStr( cLine, Len( "libpaths=" ) + 1 ) FOR EACH cItem IN hb_ATokens( cLine,, .T. ) - cItem := DirAdaptPathSep( StrStripQuote( cItem ) ) + cItem := PathSepToTarget( StrStripQuote( cItem ) ) IF AScan( aLIBPATH, {| tmp | tmp == cItem } ) == 0 AAddNotEmpty( aLIBPATH, cItem ) ENDIF @@ -1335,7 +1508,7 @@ STATIC PROCEDURE HBP_ProcessOne( cFileName,; CASE Lower( Left( cLine, Len( "prgflags=" ) ) ) == "prgflags=" ; cLine := SubStr( cLine, Len( "prgflags=" ) + 1 ) FOR EACH cItem IN hb_ATokens( cLine,, .T. ) - cItem := DirAdaptPathSep( StrStripQuote( cItem ) ) + cItem := PathSepToTarget( StrStripQuote( cItem ) ) IF AScan( aOPTPRG, {| tmp | tmp == cItem } ) == 0 AAddNotEmpty( aOPTPRG, cItem ) ENDIF @@ -1523,7 +1696,7 @@ FUNCTION hbm_COMP() STATIC PROCEDURE PauseForKey() - IF hb_gtInfo( HB_GTI_ISGRAPHIC ) + IF ! t_lQUIET .AND. hb_gtInfo( HB_GTI_ISGRAPHIC ) OutStd( "Press any key to continue..." ) Inkey( 0 ) ENDIF @@ -1564,11 +1737,15 @@ STATIC PROCEDURE ShowHelp() " -[no]trace show commands executed" ,; " -[no]run run/don't run the created executable" ,; " -nohbp do not process .hbp files in current directory" ,; - " -cc stop after creating the .c Harbour output files" ,; + " -hbcc stop after creating the .c Harbour output files" ,; " create link/copy/rename hbmk to hbcc for the same effect" ,; - " -cmp stop after creating the object files" ,; + " -hbcmp stop after creating the object files" ,; " create link/copy/rename hbmk to hbcc for the same effect" ,; - " -q quiet mode" ,; + " -hblnk act as linker. Currently this is the same as -q" ,; + " -arch= assume specific architecure. Same as HB_ARCHITECTURE envvar" ,; + " -comp= use specific compiler. Same as HB_COMPILER envvar" ,; + " -info turn on informational messages (current default)" ,; + " -q suppress logo and informational messages" ,; "" ,; "Notes:" ,; " - Don't forget to create a MAIN() entry function in your application." ,;