From a8633c7b467fe9a4effb9990ca76f2d8a0e995df Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 6 Apr 2009 21:38:31 +0000 Subject: [PATCH] 2009-04-06 23:38 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg ! Fixed to properly set errorlevels. For some reason I thought returning a number from MAIN() will set the errorlevel. Now using ErrorLevel() function. * contrib/hbqt/generator/rebuild_hbqt.bat * Added errorlevel checking after hbmk2 call. ! Removed HB_COMPILER check. --- harbour/ChangeLog | 10 ++++ .../contrib/hbqt/generator/rebuild_hbqt.bat | 21 ++++----- harbour/utils/hbmk2/hbmk2.prg | 46 ++++++++++++------- 3 files changed, 48 insertions(+), 29 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f9d1f3c2f7..7fe21e63c0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-04-06 23:38 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk2/hbmk2.prg + ! Fixed to properly set errorlevels. For some reason I thought + returning a number from MAIN() will set the errorlevel. Now + using ErrorLevel() function. + + * contrib/hbqt/generator/rebuild_hbqt.bat + * Added errorlevel checking after hbmk2 call. + ! Removed HB_COMPILER check. + 2009-04-06 22:45 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg ! Adding hbmainstd/hbmainwin libs as object for win/owatcom. diff --git a/harbour/contrib/hbqt/generator/rebuild_hbqt.bat b/harbour/contrib/hbqt/generator/rebuild_hbqt.bat index 922b9beef2..e2af72e5d8 100644 --- a/harbour/contrib/hbqt/generator/rebuild_hbqt.bat +++ b/harbour/contrib/hbqt/generator/rebuild_hbqt.bat @@ -1,11 +1,14 @@ -@echo off -rem $Id$ -rem +@rem +@rem $Id$ +@rem -IF %HB_COMPILER%.==. GOTO ERR_ENV +@echo off echo. Making hbqtgen ... -..\..\..\bin\hbmk2.exe hbqtgen +set _HBMK=hbmk2.exe +if exist ..\..\..\bin\hbmk2.exe set _HBMK=..\..\..\bin\hbmk2.exe +%_HBMK% hbqtgen +IF ERRORLEVEL 1 GOTO SHOW_ERROR echo. done echo. echo. Cleaning gensource and doc folders ... @@ -18,7 +21,7 @@ echo. done echo. echo. Generating gensource and doc files hbqtgen.exe qt45.qtp > hbqtgen.log 2>&1 -IF NOT ERRORLEVEL 0 GOTO SHOW_ERROR +IF ERRORLEVEL 1 GOTO SHOW_ERROR echo. done echo. echo. Cleaning hbqt root files ... @@ -48,11 +51,5 @@ GOTO END_BATCH :SHOW_ERROR echo. There is an error on building hbqt. echo. Please check hbqtgen.log file -GOTO END_BATCH - -:ERR_ENV -echo. Please set correctly your environment: -echo. set HB_COMPILER=mingw -echo. and your PATH, then restart this batch. :END_BATCH diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 3fdbb0e5cb..7cc50e48c4 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -149,7 +149,7 @@ THREAD STATIC t_cHBPOSTFIX #define _PAR_cFileName 2 #define _PAR_nLine 3 -FUNCTION Main( ... ) +PROCEDURE Main( ... ) LOCAL aLIB_BASE1 := {; "hbcpage" ,; @@ -295,7 +295,7 @@ FUNCTION Main( ... ) LOCAL cBin_Res LOCAL cBin_Lib LOCAL cBin_Dyn - LOCAL nErrorLevel + LOCAL nErrorLevel := 0 LOCAL tmp, tmp1, array LOCAL cScriptFile LOCAL fhnd @@ -338,7 +338,8 @@ FUNCTION Main( ... ) ShowHeader() ShowHelp() PauseForKey() - RETURN 9 + ErrorLevel( 9 ) + RETURN ENDIF FOR EACH cParam IN hb_AParams() @@ -363,13 +364,15 @@ FUNCTION Main( ... ) ShowHeader() ShowHelp( .T. ) PauseForKey() - RETURN 9 + ErrorLevel( 9 ) + RETURN CASE cParamL == "--version" ShowHeader() PauseForKey() - RETURN 0 + ErrorLevel( 0 ) + RETURN ENDCASE NEXT @@ -563,7 +566,8 @@ FUNCTION Main( ... ) OTHERWISE OutErr( "hbmk: Error: Architecture value unknown: " + t_cARCH + hb_osNewLine() ) PauseForKey() - RETURN 1 + ErrorLevel( 1 ) + RETURN ENDCASE t_aLIBCOREGT := ArrayJoin( aLIB_BASE_GT, s_aLIBHBGT ) @@ -597,7 +601,8 @@ FUNCTION Main( ... ) OTHERWISE OutErr( "hbmk: Error: HB_INSTALL_PREFIX not set, failed to autodetect." + hb_osNewLine() ) PauseForKey() - RETURN 3 + ErrorLevel( 3 ) + RETURN ENDCASE /* Detect special *nix dir layout (/bin, /lib/harbour, /include/harbour) */ IF hb_FileExists( DirAddPathSep( s_cHB_INSTALL_PREFIX ) + "include" +; @@ -618,7 +623,8 @@ FUNCTION Main( ... ) ( Empty( s_cHB_BIN_INSTALL ) .OR. Empty( s_cHB_LIB_INSTALL ) .OR. Empty( s_cHB_INC_INSTALL ) ) OutErr( "hbmk: Error: Harbour locations couldn't be determined." + hb_osNewLine() ) PauseForKey() - RETURN 3 + ErrorLevel( 3 ) + RETURN ENDIF IF t_cARCH $ "win|wce" @@ -691,13 +697,15 @@ FUNCTION Main( ... ) OutErr( " " + ArrayToList( aCOMPSUP, ", " ) + hb_osNewLine() ) ENDIF PauseForKey() - RETURN 2 + ErrorLevel( 2 ) + RETURN ENDIF ELSE IF AScan( aCOMPSUP, {|tmp| tmp == t_cCOMP } ) == 0 OutErr( "hbmk: Error: Compiler value unknown: " + t_cCOMP + hb_osNewLine() ) PauseForKey() - RETURN 2 + ErrorLevel( 2 ) + RETURN ENDIF IF t_cARCH $ "win|wce" /* Detect cross platform CCPREFIX and CCPATH if embedded MinGW installation is detected */ @@ -1123,7 +1131,8 @@ FUNCTION Main( ... ) IF ! lStopAfterInit .AND. ( Len( s_aPRG ) + Len( s_aC ) + Len( s_aOBJUSER ) + Len( s_aOBJA ) ) == 0 OutErr( "hbmk: Error: No source files were specified." + hb_osNewLine() ) PauseForKey() - RETURN 4 + ErrorLevel( 4 ) + RETURN ENDIF /* Harbour compilation */ @@ -1152,7 +1161,8 @@ FUNCTION Main( ... ) OutErr( "hbmk: Error: Running Harbour compiler. " + hb_ntos( tmp ) + hb_osNewLine() ) OutErr( ArrayToList( aCommand ) + hb_osNewLine() ) PauseForKey() - RETURN 6 + ErrorLevel( 6 ) + RETURN ENDIF #else cCommand := DirAddPathSep( PathSepToSelf( s_cHB_BIN_INSTALL ) ) +; @@ -1177,7 +1187,8 @@ FUNCTION Main( ... ) OutErr( "hbmk: Error: Running Harbour compiler. " + hb_ntos( tmp ) + ":" + hb_osNewLine() ) OutErr( cCommand + hb_osNewLine() ) PauseForKey() - RETURN 6 + ErrorLevel( 6 ) + RETURN ENDIF #endif ENDIF @@ -2086,7 +2097,8 @@ FUNCTION Main( ... ) OutErr( "hbmk: Warning: Stub helper .c program couldn't be created." + hb_osNewLine() ) AEval( ListDirExt( s_aPRG, "", ".c" ), {|tmp| FErase( tmp ) } ) PauseForKey() - RETURN 5 + ErrorLevel( 5 ) + RETURN ENDIF AAdd( s_aC, s_cCSTUB ) ENDIF @@ -2117,8 +2129,6 @@ FUNCTION Main( ... ) s_aOBJ := ListDirExt( ArrayJoin( s_aPRG, s_aC ), "", cObjExt ) s_aOBJUSER := ListCook( s_aOBJUSER, NIL, cObjExt ) - nErrorLevel := 0 - IF Len( s_aRESSRC ) > 0 .AND. ! Empty( cBin_Res ) /* Compiling resource */ @@ -2456,7 +2466,9 @@ FUNCTION Main( ... ) ENDIF ENDIF - RETURN nErrorLevel + ErrorLevel( nErrorLevel ) + + RETURN STATIC FUNCTION SetupForGT( cGT, /* @ */ s_cGT, /* @ */ s_lGUI )