From 00048732c1976592474fe8d857cfe286e68be1c2 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 27 Feb 2009 19:18:26 +0000 Subject: [PATCH] 2009-02-27 20:15 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * make_gnu.bat + Added autodetection of mingw32-make.exe. If found in PATH, it will be used instead of make.exe. This way the build process is much less resistant of environment configuration. If this works out, I'll lax the rules in INSTALL. * utils/hbmk2/hbmk2.prg * Minor internal cleanup to previous. --- harbour/ChangeLog | 11 +++++++++++ harbour/make_gnu.bat | 33 ++++++++++++++++++++++++++++----- harbour/utils/hbmk2/hbmk2.prg | 11 ++++++++--- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 413169f946..1d0af3e5d3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-27 20:15 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * make_gnu.bat + + Added autodetection of mingw32-make.exe. If found in + PATH, it will be used instead of make.exe. + This way the build process is much less resistant of + environment configuration. If this works out, I'll + lax the rules in INSTALL. + + * utils/hbmk2/hbmk2.prg + * Minor internal cleanup to previous. + 2009-02-27 19:59 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * INSTALL + Added text to specifically tell to rename mingw32-make.exe diff --git a/harbour/make_gnu.bat b/harbour/make_gnu.bat index 1aeaccce3e..e254affc63 100644 --- a/harbour/make_gnu.bat +++ b/harbour/make_gnu.bat @@ -74,6 +74,27 @@ if not exist %HB_INC_INSTALL%\*.* md %HB_INC_INSTALL% :MAKE + rem --------------------------------------------------------------- + rem Detect name of GNU Make + rem + rem Look for mingw32-make.exe and use it if found. Works only + rem on Windows NT and upper. [vszakats] + + set _HB_MAKE=make.exe + if not "%OS%" == "Windows_NT" goto _FM_DONE + set _HB_CHECK=mingw32-make.exe + set _HB_PATH=%PATH% + :_FM_LOOP + for /F "delims=; tokens=1,2*" %%p in ("%_HB_PATH%") do ( + if exist "%%p\%_HB_CHECK%" ( set _HB_MAKE=%_HB_CHECK%&& goto _FM_DONE ) + if exist "%%p%_HB_CHECK%" ( set _HB_MAKE=%_HB_CHECK%&& goto _FM_DONE ) + set _HB_PATH=%%~q;%%~r + ) + if not "%_HB_PATH%"==";" goto _FM_LOOP + :_FM_DONE + set _HB_CHECK= + set _HB_PATH= + rem --------------------------------------------------------------- rem Start the GNU make system @@ -89,22 +110,24 @@ if not exist %HB_INC_INSTALL%\*.* md %HB_INC_INSTALL% set _HB_CONTRIB_ADDONS=%HB_CONTRIB_ADDONS% set HB_CONTRIBLIBS=no set HB_CONTRIB_ADDONS= - make clean %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 - make install %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 + %_HB_MAKE% clean %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 + %_HB_MAKE% install %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 set HB_BUILD_DLL= set HB_CONTRIBLIBS=%_HB_CONTRIBLIBS% set HB_CONTRIB_ADDONS=%_HB_CONTRIB_ADDONS% set _HB_CONTRIBLIBS= set _HB_CONTRIB_ADDONS= - make clean %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 - make install %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 + %_HB_MAKE% clean %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 + %_HB_MAKE% install %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 set HB_BUILD_DLL=yes goto END :SKIP_WINDLL - make %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 + %_HB_MAKE% %HB_USER_MAKEFLAGS% %1 %2 %3 %4 %5 %6 %7 %8 %9 goto END :END + +set _HB_MAKE= diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 5409fd5512..f9bd07079f 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -239,6 +239,7 @@ FUNCTION Main( ... ) LOCAL cDynLibExt LOCAL cResPrefix LOCAL cResExt + LOCAL cBinExt LOCAL cCommand #if defined( HBMK_INTEGRATED_COMPILER ) @@ -393,6 +394,7 @@ FUNCTION Main( ... ) s_aLIBHBGT := { "gttrm", "gtxwc" } t_cGTDEFAULT := "gttrm" cDynLibNamePrefix := "lib" + cBinExt := NIL SWITCH t_cARCH CASE "darwin" ; cDynLibExt := ".dylib" ; EXIT CASE "hpux" ; cDynLibExt := ".sl" ; EXIT @@ -407,6 +409,7 @@ FUNCTION Main( ... ) t_cGTDEFAULT := "gtdos" cDynLibNamePrefix := "" cDynLibExt := "" + cBinExt := ".exe" CASE t_cARCH == "os2" aCOMPDET := { { {|| FindInPath( "gcc" ) != NIL }, "gcc" },; { {|| FindInPath( "wpp386" ) != NIL }, "owatcom" },; /* TODO: Add full support for wcc386 */ @@ -417,6 +420,7 @@ FUNCTION Main( ... ) t_cGTDEFAULT := "gtos2" cDynLibNamePrefix := "" cDynLibExt := ".dll" + cBinExt := ".exe" CASE t_cARCH == "win" /* Order is significant. owatcom also keeps a cl.exe in it's binary dir. */ @@ -439,6 +443,7 @@ FUNCTION Main( ... ) t_cGTDEFAULT := "gtwin" cDynLibNamePrefix := "" cDynLibExt := ".dll" + cBinExt := ".exe" OTHERWISE OutErr( "hbmk: Error: Architecture value unknown: " + t_cARCH + hb_osNewLine() ) PauseForKey() @@ -1704,7 +1709,7 @@ FUNCTION Main( ... ) GetEnv( "HB_USER_LDFLAGS" ) + " " + ArrayToList( s_aOPTL ) ) cOpt_CompC := StrTran( cOpt_CompC, "{OD}" , PathSepToTarget( FN_DirGet( s_cPROGNAME ) ) ) cOpt_CompC := StrTran( cOpt_CompC, "{OO}" , PathSepToTarget( FN_ExtSet( s_cPROGNAME, cObjExt ) ) ) - cOpt_CompC := StrTran( cOpt_CompC, "{OE}" , PathSepToTarget( FN_ExtSet( s_cPROGNAME, iif( t_cARCH $ "os2|win|dos", ".exe", NIL ) ) ) ) + cOpt_CompC := StrTran( cOpt_CompC, "{OE}" , PathSepToTarget( FN_ExtSet( s_cPROGNAME, cBinExt ) ) ) cOpt_CompC := StrTran( cOpt_CompC, "{OM}" , PathSepToTarget( FN_ExtSet( s_cPROGNAME, ".map" ) ) ) cOpt_CompC := StrTran( cOpt_CompC, "{DL}" , ArrayToList( ListCook( s_aLIBPATH, cLibPathPrefix ), cLibPathSep ) ) cOpt_CompC := StrTran( cOpt_CompC, "{DB}" , s_cHB_BIN_INSTALL ) @@ -1758,7 +1763,7 @@ FUNCTION Main( ... ) cOpt_Link := StrTran( cOpt_Link, "{LL}" , ArrayToList( s_aLIB ) ) cOpt_Link := StrTran( cOpt_Link, "{FL}" , iif( s_lBLDFLGL, cSelfFlagL + " ", "" ) +; GetEnv( "HB_USER_LDFLAGS" ) + " " + ArrayToList( s_aOPTL ) ) - cOpt_Link := StrTran( cOpt_Link, "{OE}" , PathSepToTarget( FN_ExtSet( s_cPROGNAME, iif( t_cARCH $ "os2|win|dos", ".exe", NIL ) ) ) ) + cOpt_Link := StrTran( cOpt_Link, "{OE}" , PathSepToTarget( FN_ExtSet( s_cPROGNAME, cBinExt ) ) ) cOpt_Link := StrTran( cOpt_Link, "{OM}" , PathSepToTarget( FN_ExtSet( s_cPROGNAME, ".map" ) ) ) cOpt_Link := StrTran( cOpt_Link, "{DL}" , ArrayToList( ListCook( s_aLIBPATH, cLibPathPrefix ), cLibPathSep ) ) cOpt_Link := StrTran( cOpt_Link, "{DB}" , s_cHB_BIN_INSTALL ) @@ -1814,7 +1819,7 @@ FUNCTION Main( ... ) IF nErrorLevel != 0 PauseForKey() ELSEIF s_lRUN - s_cPROGNAME := FN_ExtSet( s_cPROGNAME, iif( t_cARCH $ "os2|win|dos", ".exe", NIL ) ) + s_cPROGNAME := FN_ExtSet( s_cPROGNAME, cBinExt ) #if !( defined( __PLATFORM__WINDOWS ) .OR. defined( __PLATFORM__DOS ) .OR. defined( __PLATFORM__OS2 ) ) IF Empty( FN_DirGet( s_cPROGNAME ) ) s_cPROGNAME := "." + hb_osPathSeparator() + s_cPROGNAME