From 5e2d58dff31a06d20d1407181793407b06b0726e Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 29 Jan 2011 13:01:10 +0000 Subject: [PATCH] 2011-01-29 14:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/utils/hbmk2/hbmk2.prg ! remove .d files from .hbmk working dir when -clean option is used ! do not ignore dependencies list read from .d files * check dependencies specified by .d files for .c and .o files generated from .prg ones % some minor optimizations ; TOFIX: it's not safe to call FindNewerHeaders() with 3-rd parameter set to NIL (RTE) and HBMK2 does it when -autohbc option is used --- harbour/ChangeLog | 10 ++++++ harbour/utils/hbmk2/hbmk2.prg | 65 ++++++++++++++++++++++++++++------- 2 files changed, 63 insertions(+), 12 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0c9480b0ea..4e03aae8a3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,16 @@ The license applies to all entries newer than 2009-04-28. */ +2011-01-29 14:00 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/utils/hbmk2/hbmk2.prg + ! remove .d files from .hbmk working dir when -clean option is used + ! do not ignore dependencies list read from .d files + * check dependencies specified by .d files for .c and .o files + generated from .prg ones + % some minor optimizations + ; TOFIX: it's not safe to call FindNewerHeaders() with 3-rd parameter + set to NIL (RTE) and HBMK2 does it when -autohbc option is used + 2011-01-29 00:32 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * package/winuni/mpkg_win_uni.bat * package/winuni/mpkg_win_uni.nsi diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 5e00337958..2064337a1d 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -861,7 +861,7 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) LOCAL cLibHBX_Regex LOCAL bBlk_ImpLib LOCAL cPath_CompC - LOCAL tmp, tmp1, tmp2, tmp3, array + LOCAL tmp, tmp1, tmp2, tmp3, tmp4, array LOCAL cLibBCC_CRTL LOCAL cScriptFile LOCAL fhnd @@ -4764,14 +4764,16 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) ELSE tmp3 := tmp ENDIF + tmp4 := FNameDirExtSet( tmp3, cHarbourOutputDir, cHarbourOutputExt ) IF hbmk[ _HBMK_lDEBUGINC ] hbmk_OutStd( hbmk, hb_StrFormat( "debuginc: PRG %1$s %2$s",; - tmp3, FNameDirExtSet( tmp3, cHarbourOutputDir, cHarbourOutputExt ) ) ) + tmp3, tmp4 ) ) ENDIF - IF ! hb_FGetDateTime( FNameDirExtSet( tmp3, cHarbourOutputDir, cHarbourOutputExt ), @tmp2 ) .OR. ; + IF ! hb_FGetDateTime( tmp4, @tmp2 ) .OR. ; ! hb_FGetDateTime( tmp3, @tmp1 ) .OR. ; tmp1 > tmp2 .OR. ; - ( hbmk[ _HBMK_nHEAD ] != _HEAD_OFF .AND. FindNewerHeaders( hbmk, tmp, tmp2, .F., cBin_CompC ) ) + ( hbmk[ _HBMK_nHEAD ] != _HEAD_OFF .AND. FindNewerHeaders( hbmk, tmp, tmp2, .F., cBin_CompC ) ) .OR.; + checkDepTime( hbmk, tmp4, tmp2 ) AAdd( l_aPRG_TODO, tmp ) ENDIF NEXT @@ -5543,15 +5545,16 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) ELSE tmp3 := tmp ENDIF + tmp4 := FNameDirExtSet( tmp3, hbmk[ _HBMK_cWorkDir ], cObjExt ) IF hbmk[ _HBMK_lDEBUGINC ] hbmk_OutStd( hbmk, hb_StrFormat( "debuginc: CPRG %1$s %2$s",; - FNameDirExtSet( tmp3, hbmk[ _HBMK_cWorkDir ], ".c" ),; - FNameDirExtSet( tmp3, hbmk[ _HBMK_cWorkDir ], cObjExt ) ) ) + FNameDirExtSet( tmp3, hbmk[ _HBMK_cWorkDir ], ".c" ), tmp4 ) ) ENDIF IF ! hb_FGetDateTime( FNameDirExtSet( tmp3, hbmk[ _HBMK_cWorkDir ], ".c" ), @tmp1 ) .OR. ; - ! hb_FGetDateTime( FNameDirExtSet( tmp3, hbmk[ _HBMK_cWorkDir ], cObjExt ), @tmp2 ) .OR. ; + ! hb_FGetDateTime( tmp4, @tmp2 ) .OR. ; tmp1 > tmp2 .OR. ; - hb_FSize( FNameDirExtSet( tmp3, hbmk[ _HBMK_cWorkDir ], cObjExt ) ) == 0 + hb_FSize( tmp4 ) == 0 .OR. ; + checkDepTime( hbmk, tmp4, tmp2 ) AAdd( l_aPRG_TODO, tmp ) ENDIF NEXT @@ -6107,6 +6110,9 @@ FUNCTION hbmk2( aArgs, nArgTarget, /* @ */ lPause, nLevel ) IF ! hbmk[ _HBMK_lINC ] .OR. hbmk[ _HBMK_lCLEAN ] AEval( ListDirExt( hbmk[ _HBMK_aPRG ], hbmk[ _HBMK_cWorkDir ], ".c", .T. ), {| tmp | FErase( tmp ) } ) ENDIF + IF hbmk[ _HBMK_lINC ] .AND. hbmk[ _HBMK_lCLEAN ] + AEval( ListDirExt( hbmk[ _HBMK_aPRG ], hbmk[ _HBMK_cWorkDir ], ".d", .T. ), {| tmp | FErase( tmp ) } ) + ENDIF IF ! lStopAfterCComp .OR. hbmk[ _HBMK_lCreateLib ] .OR. hbmk[ _HBMK_lCreateDyn ] IF ! hbmk[ _HBMK_lINC ] .OR. hbmk[ _HBMK_lCLEAN ] IF ! Empty( cResExt ) @@ -6693,8 +6699,13 @@ STATIC FUNCTION FindNewerHeaders( hbmk, cFileName, tTimeParent, lCMode, cBin_Com RETURN .F. ENDIF - IF tTimeParent != NIL .AND. hb_FGetDateTime( cFileName, @tTimeSelf ) .AND. tTimeSelf > tTimeParent - RETURN .T. + IF tTimeParent != NIL + IF hb_FGetDateTime( cFileName, @tTimeSelf ) .AND. tTimeSelf > tTimeParent + RETURN .T. + ENDIF + IF checkDepTime( hbmk, cFileName, tTimeParent ) + RETURN .T. + ENDIF ENDIF cExt := Lower( FNameExtGet( cFileName ) ) @@ -7076,6 +7087,36 @@ STATIC FUNCTION getNewestTime( hbmk, cFile, hFiles, lCMode ) RETURN tTime +STATIC FUNCTION checkDepTime( hbmk, cFile, tTime ) + LOCAL cDepFile, tDepTime + + IF hbmk[ _HBMK_lDEBUGINC ] + hbmk_OutStd( hbmk, hb_StrFormat( "debuginc: CHECK DepTime: %s (%s)", cFile, hb_tsToStr(tTime)) ) + ENDIF + + IF cFile $ hbmk[ _HBMK_hDEPTS ] + IF hbmk[ _HBMK_lDEBUGINC ] + hbmk_OutStd( hbmk, hb_StrFormat( "debuginc: CHECKING....", cFile) ) + ENDIF + FOR EACH cDepFile IN hbmk[ _HBMK_hDEPTS ][ cFile ] + IF ( cDepFile := FindHeader( hbmk, cDepFile, "", .F., .F. ) ) != NIL + IF ! hb_FGetDateTime( cDepFile, @tDepTime ) .OR. ; + tDepTime > tTime + IF hbmk[ _HBMK_lDEBUGINC ] + hbmk_OutStd( hbmk, hb_StrFormat( "debuginc: CHECK DepTime=%s !!! (%s>%s)", cDepFile, hb_tsToStr(tDepTime), hb_tsToStr(tTime) ) ) + ENDIF + RETURN .T. + ENDIF + IF hbmk[ _HBMK_lDEBUGINC ] + hbmk_OutStd( hbmk, hb_StrFormat( "debuginc: CHECK DepTime=%s (%s)", cDepFile, hb_tsToStr(tDepTime) ) ) + ENDIF + ENDIF + NEXT + ENDIF + + RETURN .F. + + STATIC FUNCTION clpfile_read( cFileName ) LOCAL cFileBody := MemoRead( cFileName ) LOCAL aFiles @@ -7543,8 +7584,8 @@ STATIC FUNCTION FindHeader( hbmk, cFileName, cParentDir, lSystemHeader, lSkipDep IF ! lSystemHeader IF Empty( cParentDir ) /* Check in current dir */ - IF hb_FileExists( PathSepToSelf( cFileName ) ) - RETURN PathSepToSelf( cFileName ) + IF hb_FileExists( tmp := PathSepToSelf( cFileName ) ) + RETURN tmp ENDIF ELSE /* Check in parent dir */