From 092f500633226741e26ca962af0242824f0d39a0 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 23 Aug 2009 14:02:53 +0000 Subject: [PATCH] 2009-08-23 15:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added support for combined target names. This means that from now in all supported platform/compiler inputs can be formed like / in one string. So f.e. '-plat=wce/mingw' is the same as '-plat=wce -comp=mingw'. This feature only kicks in if the string contains '/' and in this case the first item always indicates the platform, the second always the compiler, regardless of which switch name is used (-plat or -comp). So -comp=wce/mingw is the same as -plat=wce/mingw. Experimental yet. ! Wrong bugfix reverted in prev commit. (for watcom/win) * utils/hbmk2/hbmk2.prg * config/global.mk + Added autodetection for i386-mingw32ce, which is WinCE running on x86 CPU. This tool was released just recently from cegcc team. * config/global.mk + Tweaked a little mingwarm autodetection on *nixes. It will now look for all three mingw compilers on provided HB_CCPATH. If not provided or not found on that location, it will continue to look for them in default locations. + config/wce/mingw.mk + Added x86 wce/mingw config file. It's a simple redirection to mingwarm.mk. I'll try to make some steps to make it generic, can't really see the end of the tunnel yet though. --- harbour/ChangeLog | 29 +++++++++ harbour/config/global.mk | 110 +++++++++++++++++++++++----------- harbour/config/wce/mingw.mk | 5 ++ harbour/utils/hbmk2/hbmk2.prg | 68 ++++++++++++++------- 4 files changed, 156 insertions(+), 56 deletions(-) create mode 100644 harbour/config/wce/mingw.mk diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 35edbe6003..5c56a76026 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,35 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-23 15:56 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * utils/hbmk2/hbmk2.prg + + Added support for combined target names. This means + that from now in all supported platform/compiler inputs can + be formed like / in one string. + So f.e. '-plat=wce/mingw' is the same as '-plat=wce -comp=mingw'. + This feature only kicks in if the string contains '/' and in + this case the first item always indicates the platform, the + second always the compiler, regardless of which switch name is + used (-plat or -comp). So -comp=wce/mingw is the same as -plat=wce/mingw. + Experimental yet. + ! Wrong bugfix reverted in prev commit. (for watcom/win) + + * utils/hbmk2/hbmk2.prg + * config/global.mk + + Added autodetection for i386-mingw32ce, which is WinCE running on x86 CPU. + This tool was released just recently from cegcc team. + + * config/global.mk + + Tweaked a little mingwarm autodetection on *nixes. + It will now look for all three mingw compilers on provided HB_CCPATH. + If not provided or not found on that location, it will continue to look + for them in default locations. + + + config/wce/mingw.mk + + Added x86 wce/mingw config file. It's a simple redirection to + mingwarm.mk. I'll try to make some steps to make it generic, + can't really see the end of the tunnel yet though. + 2009-08-23 14:44 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg * Changed internal names to use PLAT instead of ARCH when diff --git a/harbour/config/global.mk b/harbour/config/global.mk index 2d33da6984..f9be8b1537 100644 --- a/harbour/config/global.mk +++ b/harbour/config/global.mk @@ -573,24 +573,56 @@ ifeq ($(HB_COMPILER),) endif else ifeq ($(HB_ARCHITECTURE),wce) - ifeq ($(HB_CCPATH),) - HB_CCPATH := /opt/mingw32ce/bin/ - endif - ifneq ($(call find_in_path_par,arm-wince-mingw32ce-gcc,$(HB_CCPATH)),) - HB_CCPREFIX := arm-wince-mingw32ce- - HB_CCPATH := $(HB_CCPATH)/ - else + # Look for known mingw32ce compilers on HB_CCPATH if it's set + ifneq ($(HB_CCPATH),) ifneq ($(call find_in_path_par,arm-mingw32ce-gcc,$(HB_CCPATH)),) + HB_COMPILER := mingwarm HB_CCPREFIX := arm-mingw32ce- HB_CCPATH := $(HB_CCPATH)/ else - HB_CCPATH := - HB_CCPREFIX := + ifneq ($(call find_in_path_par,arm-wince-mingw32ce-gcc,$(HB_CCPATH)),) + HB_COMPILER := mingwarm + HB_CCPREFIX := arm-wince-mingw32ce- + HB_CCPATH := $(HB_CCPATH)/ + else + ifneq ($(call find_in_path_par,i386-mingw32ce-gcc,$(HB_CCPATH)),) + HB_COMPILER := mingw + HB_CCPREFIX := i386-mingw32ce- + HB_CCPATH := $(HB_CCPATH)/ + else + HB_CCPATH := + HB_CCPREFIX := + endif + endif endif endif + + # If HB_CCPATH not set, or couldn't be found on the provided PATH, + # try to detect them in default locations + ifeq ($(HB_CCPATH),) + HB_CCPATH := /opt/mingw32ce/bin/ + ifneq ($(call find_in_path_par,arm-mingw32ce-gcc,$(HB_CCPATH)),) + HB_COMPILER := mingwarm + HB_CCPREFIX := arm-mingw32ce- + else + ifneq ($(call find_in_path_par,arm-wince-mingw32ce-gcc,$(HB_CCPATH)),) + HB_COMPILER := mingwarm + HB_CCPREFIX := arm-wince-mingw32ce- + else + HB_CCPATH := /opt/x86mingw32ce/bin/ + ifneq ($(call find_in_path_par,i386-mingw32ce-gcc,$(HB_CCPATH)),) + HB_COMPILER := mingw + HB_CCPREFIX := i386-mingw32ce- + else + HB_CCPATH := + HB_CCPREFIX := + endif + endif + endif + endif + ifneq ($(HB_CCPATH)$(HB_CCPREFIX),) - HB_COMPILER := mingwarm HB_ARCHITECTURE := wce export HB_TOOLS_PREF := hbce export HB_XBUILD := wce @@ -616,45 +648,51 @@ ifeq ($(HB_COMPILER),) HB_ARCHITECTURE := wce HB_CCPREFIX := arm-mingw32ce- else - ifneq ($(call find_in_path,cygstart),) - HB_COMPILER := cygwin + ifneq ($(call find_in_path,i386-mingw32ce-gcc),) + HB_COMPILER := mingw + HB_ARCHITECTURE := wce + HB_CCPREFIX := i386-mingw32ce- else - ifneq ($(call find_in_path,gcc),) - HB_COMPILER := mingw + ifneq ($(call find_in_path,cygstart),) + HB_COMPILER := cygwin else - ifneq ($(call find_in_path,wpp386),) - HB_COMPILER := watcom + ifneq ($(call find_in_path,gcc),) + HB_COMPILER := mingw else - ifneq ($(call find_in_path,clarm),) - HB_COMPILER := msvcarm - HB_ARCHITECTURE := wce - export HB_VISUALC_VER_PRE80 := yes + ifneq ($(call find_in_path,wpp386),) + HB_COMPILER := watcom else - ifneq ($(call find_in_path,armasm),) + ifneq ($(call find_in_path,clarm),) HB_COMPILER := msvcarm HB_ARCHITECTURE := wce + export HB_VISUALC_VER_PRE80 := yes else - ifneq ($(call find_in_path,ml64),) - HB_COMPILER := msvc64 + ifneq ($(call find_in_path,armasm),) + HB_COMPILER := msvcarm + HB_ARCHITECTURE := wce else - ifneq ($(call find_in_path,icl),) - HB_COMPILER := icc + ifneq ($(call find_in_path,ml64),) + HB_COMPILER := msvc64 else - ifneq ($(call find_in_path,cl),) - HB_COMPILER := msvc + ifneq ($(call find_in_path,icl),) + HB_COMPILER := icc else - ifneq ($(call find_in_path,bcc32),) - HB_COMPILER := bcc + ifneq ($(call find_in_path,cl),) + HB_COMPILER := msvc else - ifneq ($(call find_in_path,pocc),) - HB_COMPILER := pocc + ifneq ($(call find_in_path,bcc32),) + HB_COMPILER := bcc else - ifneq ($(call find_in_path,xcc),) - HB_COMPILER := xcc + ifneq ($(call find_in_path,pocc),) + HB_COMPILER := pocc else - ifneq ($(call find_in_path,x86_64-w64-mingw32-gcc),) - HB_COMPILER := mingw64 - HB_CCPREFIX := x86_64-w64-mingw32- + ifneq ($(call find_in_path,xcc),) + HB_COMPILER := xcc + else + ifneq ($(call find_in_path,x86_64-w64-mingw32-gcc),) + HB_COMPILER := mingw64 + HB_CCPREFIX := x86_64-w64-mingw32- + endif endif endif endif diff --git a/harbour/config/wce/mingw.mk b/harbour/config/wce/mingw.mk new file mode 100644 index 0000000000..81f5fec9d5 --- /dev/null +++ b/harbour/config/wce/mingw.mk @@ -0,0 +1,5 @@ +# +# $Id$ +# + +include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/mingw.mk diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 6a509301d6..34fcec838f 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -127,6 +127,9 @@ REQUEST hbmk_KEYW #define I_( x ) hb_i18n_gettext( x ) +#define _TARG_PLAT 1 +#define _TARG_COMP 2 + #define _PAR_cParam 1 #define _PAR_cFileName 2 #define _PAR_nLine 3 @@ -691,9 +694,9 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) option processing loop. */ DO CASE CASE cParamL == "-quiet" ; hbmk[ _HBMK_lQuiet ] := .T. ; hbmk[ _HBMK_lInfo ] := .F. - CASE Left( cParamL, 6 ) == "-comp=" ; hbmk[ _HBMK_cCOMP ] := SubStr( cParam, 7 ) - CASE Left( cParamL, 6 ) == "-plat=" ; hbmk[ _HBMK_cPLAT ] := SubStr( cParam, 7 ) - CASE Left( cParamL, 6 ) == "-arch=" ; hbmk[ _HBMK_cPLAT ] := SubStr( cParam, 7 ) /* Compatibility */ + CASE Left( cParamL, 6 ) == "-comp=" ; ParseCOMPPLAT( hbmk, SubStr( cParam, 7 ), _TARG_COMP ) + CASE Left( cParamL, 6 ) == "-plat=" ; ParseCOMPPLAT( hbmk, SubStr( cParam, 7 ), _TARG_PLAT ) + CASE Left( cParamL, 6 ) == "-arch=" ; ParseCOMPPLAT( hbmk, SubStr( cParam, 7 ), _TARG_PLAT ) /* Compatibility */ CASE Left( cParamL, 6 ) == "-build=" ; hbmk[ _HBMK_cBUILD ] := SubStr( cParam, 8 ) CASE Left( cParamL, 6 ) == "-lang=" ; hbmk[ _HBMK_cUILNG ] := SubStr( cParam, 7 ) ; SetUILang( hbmk ) CASE cParamL == "-hbrun" ; lSkipBuild := .T. ; hbmk[ _HBMK_lRUN ] := .T. @@ -780,18 +783,13 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) /* Load platform / compiler settings (compatibility) */ IF Empty( hbmk[ _HBMK_cPLAT ] ) - hbmk[ _HBMK_cPLAT ] := Lower( GetEnv( "HB_PLATFORM" ) ) + ParseCOMPPLAT( hbmk, Lower( GetEnv( "HB_PLATFORM" ) ), _TARG_PLAT ) IF Empty( hbmk[ _HBMK_cPLAT ] ) - hbmk[ _HBMK_cPLAT ] := Lower( GetEnv( "HB_ARCHITECTURE" ) ) /* Compatibility */ + ParseCOMPPLAT( hbmk, Lower( GetEnv( "HB_ARCHITECTURE" ) ), _TARG_PLAT ) /* Compatibility */ ENDIF ENDIF IF Empty( hbmk[ _HBMK_cCOMP ] ) - hbmk[ _HBMK_cCOMP ] := Lower( GetEnv( "HB_COMPILER" ) ) -#if 0 - IF Empty( hbmk[ _HBMK_cCOMP ] ) - hbmk[ _HBMK_cCOMP ] := Lower( GetEnv( "HB_COMP" ) ) - ENDIF -#endif + ParseCOMPPLAT( hbmk, Lower( GetEnv( "HB_COMPILER" ) ), _TARG_COMP ) ENDIF nCCompVer := Val( GetEnv( "HB_COMPILER_VER" ) ) /* Format: <09><00>[.<00>] = [.] */ @@ -931,8 +929,9 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) { {|| FindInPath( "clarm" ) }, "msvcarm" },; { {|| FindInPath( "armasm" ) }, "msvcarm" },; { {|| FindInPath( "pocc" ) }, "poccarm" },; - { {|| FindInPath( "arm-mingw32ce-gcc" ) }, "mingwarm", "arm-mingw32ce-" } ,; - { {|| FindInPath( "arm-wince-mingw32ce-gcc" ) }, "mingwarm", "arm-wince-mingw32ce-" } } + { {|| FindInPath( "arm-mingw32ce-gcc" ) }, "mingwarm", "arm-mingw32ce-" } ,; + { {|| FindInPath( "arm-wince-mingw32ce-gcc" ) }, "mingwarm", "arm-wince-mingw32ce-" } ,; + { {|| FindInPath( "i386-mingw32ce-gcc" ) }, "mingw" , "i386-mingw32ce-" } } aCOMPSUP := { "mingwarm", "msvcarm", "poccarm" } l_aLIBHBGT := { "gtwvt", "gtgui" } hbmk[ _HBMK_cGTDEFAULT ] := "gtwvt" @@ -1023,6 +1022,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "mingw64" + hb_osPathSeparator() + "bin" ), iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "win" , "mingw64" , "x86_64-w64-mingw32-" , NIL } ) AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "mingwarm" + hb_osPathSeparator() + "bin" ), iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "wce" , "mingwarm", "arm-mingw32ce-" , NIL } ) AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "mingwarm" + hb_osPathSeparator() + "bin" ), iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "wce" , "mingwarm", "arm-wince-mingw32ce-", NIL } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "mingwarm" + hb_osPathSeparator() + "bin" ), iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "wce" , "mingw" , "i386-mingw32ce-" , NIL } ) AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "djgpp" + hb_osPathSeparator() + "bin" ), iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "dos" , "djgpp" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "watcom" + hb_osPathSeparator() + "binnt" ), iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "wpp386.exe" ), tmp1, NIL ) }, "win" , "watcom" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( DirAddPathSep( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "watcom" + hb_osPathSeparator() + "binnt" ), iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "wpp386.exe" ), tmp1, NIL ) }, "dos" , "watcom" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) @@ -1055,11 +1055,12 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) !( hbmk[ _HBMK_cPLAT ] == "dos" ) DO CASE - CASE hbmk[ _HBMK_cCOMP ] == "mingw" - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := "/opt/xmingw/bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "win", "mingw" , "i386-mingw-", NIL } ) - CASE hbmk[ _HBMK_cCOMP ] == "mingwarm" - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := "/opt/mingw32ce/bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "wce", "mingwarm", "arm-mingw32ce-", NIL } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := "/opt/mingw32ce/bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "wce", "mingwarm", "arm-wince-mingw32ce-", NIL } ) + CASE hbmk[ _HBMK_cPLAT ] == "win" + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := "/opt/xmingw/bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "win", "mingw" , "i386-mingw-", NIL } ) + CASE hbmk[ _HBMK_cPLAT ] == "wce" + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := "/opt/mingw32ce/bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "wce", "mingwarm", "arm-mingw32ce-", NIL } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := "/opt/mingw32ce/bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "wce", "mingwarm", "arm-wince-mingw32ce-", NIL } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := "/opt/x86mingw32ce/bin", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT ), tmp1, NIL ) }, "wce", "mingw" , "i386-mingw32ce-", NIL } ) ENDCASE ENDIF @@ -2452,7 +2453,7 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) cBin_Link := "wlink" + cCCEXT DO CASE CASE hbmk[ _HBMK_cPLAT ] == "linux" ; cOpt_Link := "OP quiet SYS linux {FL} NAME {OE} {LO} {DL} {LL} {LB}{SCRIPT}" - CASE hbmk[ _HBMK_cPLAT ] == "win" ; cOpt_Link := "OP quiet SYS nt {FL} NAME {OE} {LO} {DL} {LL} {LB} {LS}{SCRIPT}" + CASE hbmk[ _HBMK_cPLAT ] == "win" ; cOpt_Link := "OP quiet {FL} NAME {OE} {LO} {DL} {LL} {LB} {LS}{SCRIPT}" CASE hbmk[ _HBMK_cPLAT ] == "dos" ; cOpt_Link := "OP quiet SYS dos4g OP stub=wstubq.exe {FL} NAME {OE} {LO} {DL} {LL} {LB}{SCRIPT}" CASE hbmk[ _HBMK_cPLAT ] == "os2" ; cOpt_Link := "OP quiet SYS os2v2 {FL} NAME {OE} {LO} {DL} {LL} {LB} {LS}{SCRIPT}" ENDCASE @@ -6536,6 +6537,33 @@ FUNCTION hbmk_KEYW( hbmk, cKeyword ) RETURN .F. +STATIC PROCEDURE ParseCOMPPLAT( hbmk, cString, nMainTarget ) + LOCAL aToken := hb_ATokens( Lower( cString ), "/", .T., .T. ) + LOCAL cToken + + IF Len( aToken ) == 1 + IF ! Empty( cString ) + SWITCH nMainTarget + CASE _TARG_PLAT ; hbmk[ _HBMK_cPLAT ] := AllTrim( cString ) ; EXIT + CASE _TARG_COMP ; hbmk[ _HBMK_cCOMP ] := AllTrim( cString ) ; EXIT + ENDSWITCH + ENDIF + ELSE + FOR EACH cToken IN aToken + IF ! Empty( cToken ) + SWITCH cToken:__enumIndex() + CASE 1 ; hbmk[ _HBMK_cPLAT ] := AllTrim( cToken ) ; EXIT + CASE 2 ; hbmk[ _HBMK_cCOMP ] := AllTrim( cToken ) ; EXIT + ENDSWITCH + IF cToken:__enumIndex() > 2 + EXIT + ENDIF + ENDIF + NEXT + ENDIF + + RETURN + STATIC FUNCTION MacOSXFiles( hbmk, nType, cPROGNAME ) LOCAL cString @@ -6667,7 +6695,7 @@ STATIC PROCEDURE ShowHelp( hbmk, lLong ) " - darwin : gcc, icc",; " - win : mingw, msvc, bcc, watcom, icc, pocc, cygwin, xcc,",; " - mingw64, msvc64, msvcia64, iccia64, pocc64",; - " - wce : mingwarm, msvcarm, poccarm",; + " - wce : mingwarm, mingw, msvcarm, poccarm",; " - os2 : gcc, watcom",; " - dos : djgpp, watcom",; " - bsd : gcc",;