From acc8da9057186dcd3985adede2ed351a7abb12ce Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 12 Apr 2010 09:13:03 +0000 Subject: [PATCH] 2010-04-12 11:08 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added feature to allow -inc mode when using harbour compiler as preprocessor: 'hbmk2 -hbraw -inc -p[] -s[] <.prg[s]>' + Added dummy handling for rest of '%__APP*__%' OSX macros. --- harbour/ChangeLog | 7 +++++++ harbour/utils/hbmk2/hbmk2.prg | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5323ca97e4..24c64aad1b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,13 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-04-12 11:08 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * utils/hbmk2/hbmk2.prg + + Added feature to allow -inc mode when using harbour compiler + as preprocessor: + 'hbmk2 -hbraw -inc -p[] -s[] <.prg[s]>' + + Added dummy handling for rest of '%__APP*__%' OSX macros. + 2010-04-11 21:45 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + -info parameter will now enable output line with target diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 7245dda4bf..8d6a19a1f6 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -706,6 +706,11 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) LOCAL cMakeImpLibLib := NIL LOCAL lMakeImpLibMS_bcc := .F. + LOCAL nHarbourPPO := 0 + LOCAL cHarbourOutputExt + LOCAL cHarbourOutputDir + LOCAL cHarbourPPODir := "" + LOCAL cWorkDir := NIL LOCAL aParams @@ -2029,6 +2034,19 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) IF SubStr( cParamL, 2 ) == "gh" lStopAfterHarbour := .T. ENDIF + /* Detect if Harbour is only used as preprocessor (-p + -s options) */ + IF SubStr( cParamL, 2 ) == "p" + ++nHarbourPPO + tmp := MacroProc( hbmk, ArchCompFilter( hbmk, SubStr( cParam, 3 ) ), aParam[ _PAR_cFileName ] ) + IF ! Empty( tmp ) + tmp := PathProc( PathSepToSelf( tmp ), aParam[ _PAR_cFileName ] ) + hb_FNameSplit( tmp, @cDir, @cName, @cExt ) + cHarbourPPODir := cDir + ENDIF + ENDIF + IF SubStr( cParamL, 2 ) == "s" + ++nHarbourPPO + ENDIF AAddNotEmpty( hbmk[ _HBMK_aOPTPRG ], PathSepToTarget( hbmk, cParam, 2 ) ) ENDCASE @@ -3786,11 +3804,19 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) /* Create incremental file list for .prg files */ - IF ! lSkipBuild .AND. ! lStopAfterInit .AND. ! lStopAfterHarbour .AND. hbmk[ _HBMK_nHBMODE ] != _HBMODE_RAW_C + IF ( ! lSkipBuild .AND. ! lStopAfterInit .AND. ! lStopAfterHarbour .AND. hbmk[ _HBMK_nHBMODE ] != _HBMODE_RAW_C ) .OR. ; + ( nHarbourPPO >= 2 .AND. lStopAfterHarbour ) /* or in preprocessor mode */ /* Incremental */ IF hbmk[ _HBMK_lINC ] .AND. ! hbmk[ _HBMK_lREBUILD ] + IF nHarbourPPO >= 2 .AND. lStopAfterHarbour /* .ppo files are the dependents in preprocessor mode */ + cHarbourOutputExt := ".ppo" + cHarbourOutputDir := cHarbourPPODir + ELSE + cHarbourOutputExt := ".c" + cHarbourOutputDir := cWorkDir + ENDIF l_aPRG_TODO := {} FOR EACH tmp IN hbmk[ _HBMK_aPRG ] IF LEFTEQUAL( tmp, "@" ) .AND. Lower( FN_ExtGet( tmp ) ) == ".clp" @@ -3800,9 +3826,9 @@ FUNCTION hbmk2( aArgs, /* @ */ lPause ) ENDIF IF hbmk[ _HBMK_lDEBUGINC ] hbmk_OutStd( hbmk, hb_StrFormat( "debuginc: PRG %1$s %2$s",; - tmp3, FN_DirExtSet( tmp3, cWorkDir, ".c" ) ) ) + tmp3, FN_DirExtSet( tmp3, cHarbourOutputDir, cHarbourOutputExt ) ) ) ENDIF - IF ! hb_FGetDateTime( FN_DirExtSet( tmp3, cWorkDir, ".c" ), @tmp2 ) .OR. ; + IF ! hb_FGetDateTime( FN_DirExtSet( tmp3, cHarbourOutputDir, cHarbourOutputExt ), @tmp2 ) .OR. ; ! hb_FGetDateTime( tmp3, @tmp1 ) .OR. ; tmp1 > tmp2 .OR. ; ( hbmk[ _HBMK_nHEAD ] != _HEAD_OFF .AND. FindNewerHeaders( hbmk, tmp, NIL, tmp2, .F., .F., cBin_CompC, NIL, @headstate ) ) @@ -8105,6 +8131,9 @@ STATIC FUNCTION MacOSXFiles( hbmk, nType, cPROGNAME ) cString := StrTran( cString, "%__APPNAME__%", cPROGNAME ) cString := StrTran( cString, "%__APPTYPE__%", "APPL" ) cString := StrTran( cString, "%__APPSIGN__%", PadR( cPROGNAME, 4, "?" ) ) + cString := StrTran( cString, "%__APPID__%" ) /* TODO */ + cString := StrTran( cString, "%__APPVERSION__%" ) /* TODO */ + cString := StrTran( cString, "%__APPCOPYRIGHT__%" ) /* TODO */ IF ! Empty( hbmk[ _HBMK_aICON ] ) cString := StrTran( cString, "%__APPICON__%", FN_NameExtGet( hbmk[ _HBMK_aICON ][ 1 ] ) ) ENDIF