From 65c1dfc0fb9decb4046fc514c5a19f3f8cfaeb33 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 16 Mar 2009 17:32:26 +0000 Subject: [PATCH] 2009-03-16 18:31 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk2/hbmk2.prg + Added __PLATFORM__* macro support for cross-compilation situations. * include/hbsetup.ch * Minor --- harbour/ChangeLog | 7 ++++ harbour/include/hbsetup.ch | 8 ++-- harbour/utils/hbmk2/hbmk2.prg | 71 +++++++++++++++++++++++++++++++---- 3 files changed, 75 insertions(+), 11 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4584168203..241223d521 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,13 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-03-16 18:31 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk2/hbmk2.prg + + Added __PLATFORM__* macro support for cross-compilation situations. + + * include/hbsetup.ch + * Minor + 2009-03-16 09:39 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/gtwvg.c * harbour/contrib/gtwvg/wincallb.c diff --git a/harbour/include/hbsetup.ch b/harbour/include/hbsetup.ch index 92f7dc0c52..b8263e37b3 100644 --- a/harbour/include/hbsetup.ch +++ b/harbour/include/hbsetup.ch @@ -6,7 +6,7 @@ * Harbour Project source code: * Header file for runtime configuration, common for Harbour and C level. * - * Copyright 1999-2001 Viktor Szakats + * Copyright 1999-2009 Viktor Szakats * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -59,16 +59,16 @@ /* NOTE: You can select here, which features you want to include of the different Clipper implementations. */ -/* #define HB_EXTENSION */ /* Enable Harbour non-portable extensions */ -#define HB_C52_UNDOC /* Enable Cl*pper 5.2e/5.3x undocumented features */ /* #define HB_C52_STRICT */ /* Enable Cl*pper 5.2e/5.3x strict compatibility */ +#define HB_C52_UNDOC /* Enable Cl*pper 5.2e/5.3x undocumented features */ #define HB_COMPAT_C53 /* Enable Cl*pper 5.3x extensions */ #define HB_COMPAT_XPP /* Enable Xbase++ extensions */ -/* #define HB_COMPAT_VO */ /* Enable VO extensions */ #define HB_COMPAT_FLAGSHIP /* Enable Flagship extensions */ +/* #define HB_COMPAT_VO */ /* Enable VO extensions */ /* #define HB_COMPAT_FOXPRO */ /* Enable FoxPro extensions */ /* #define HB_COMPAT_DBASE */ /* Enable dBase extensions */ /* #define HB_COMPAT_CLIP */ /* Enable CLIP extensions */ +/* #define HB_EXTENSION */ /* Enable Harbour non-portable extensions */ /* *********************************************************************** * Leave this #define if you want to allow usage of legacy Harbour 1.0.0/Clipper diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 30bdfc766c..c9e64ab684 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -104,12 +104,6 @@ Harbour switch, it will be a problem also when user tries to use -p option, .ppo files will be generated in temp dir. */ /* TODO: Sync default C/linker switches with the ones in Harbour GNU make system. */ -/* TODO: Support for more compilers/platforms. */ -/* TODO: Cross compilation support. - -D__PLATFORM__WINCE ? - -D__PLATFORM__WINDOWS - -undef:__PLATFORM__UNIX - -undef:__PLATFORM__LINUX */ /* TODO: Add support for library creation for rest of compilers. */ /* TODO: Add support for dynamic library creation for rest of compilers. */ /* TODO: Cleanup on variable names and compiler configuration. */ @@ -989,6 +983,8 @@ FUNCTION Main( ... ) IF Len( s_aPRG ) > 0 + PlatformPRGFlags( s_aOPTPRG ) + #if defined( HBMK_INTEGRATED_COMPILER ) aCommand := ArrayAJoin( { { iif( lCreateLib .OR. lCreateDyn, "-n1", "-n2" ) },; s_aPRG,; @@ -1700,13 +1696,13 @@ FUNCTION Main( ... ) /* TODO */ CASE t_cARCH == "linux" .AND. t_cCOMP == "icc" + CASE t_cARCH == "win" .AND. t_cCOMP == "msvcce" /* NOTE: Cross-platform: wince/ARM on win/x86 */ CASE t_cARCH == "win" .AND. t_cCOMP == "pocc64" /* NOTE: Cross-platform: win/amd64 on win/x86 */ CASE t_cARCH == "win" .AND. t_cCOMP == "poccce" /* NOTE: Cross-platform: wince/ARM on win/x86 */ CASE t_cARCH == "linux" .AND. t_cCOMP == "mingwce" /* NOTE: Cross-platform: wince/ARM on win/x86 */ IF ! s_lSHARED s_aLIBSYS := ArrayJoin( s_aLIBSYS, { "wininet", "ws2", "commdlg", "commctrl", "uuid", "ole32" } ) ENDIF - CASE t_cARCH == "win" .AND. t_cCOMP == "msvcce" /* NOTE: Cross-platform: wince/ARM on win/x86 */ ENDCASE IF lCreateDyn .AND. t_cARCH == "win" @@ -2984,6 +2980,67 @@ STATIC FUNCTION commandResult( cCommand, nResult ) RETURN cResult +PROCEDURE PlatformPRGFlags( aOPTPRG ) + + IF !( t_cARCH == hb_Version( HB_VERSION_BUILD_ARCH ) ) .OR. ; + t_cCOMP $ "mingwce|poccce|msvcce" + + #if defined( __PLATFORM__WINDOWS ) + AAdd( aOPTPRG, "-undef:__PLATFORM__WINDOWS" ) + #if defined( __PLATFORM__WINCE ) + AAdd( aOPTPRG, "-undef:__PLATFORM__WINCE" ) + #endif + #elif defined( __PLATFORM__DOS ) + AAdd( aOPTPRG, "-undef:__PLATFORM__DOS" ) + #elif defined( __PLATFORM__OS2 ) + AAdd( aOPTPRG, "-undef:__PLATFORM__OS2" ) + #elif defined( __PLATFORM__LINUX ) + AAdd( aOPTPRG, "-undef:__PLATFORM__LINUX" ) + AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + #elif defined( __PLATFORM__DARWIN ) + AAdd( aOPTPRG, "-undef:__PLATFORM__DARWIN" ) + AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + #elif defined( __PLATFORM__BSD ) + AAdd( aOPTPRG, "-undef:__PLATFORM__BSD" ) + AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + #elif defined( __PLATFORM__SUNOS ) + AAdd( aOPTPRG, "-undef:__PLATFORM__SUNOS" ) + AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + #elif defined( __PLATFORM__HPUX ) + AAdd( aOPTPRG, "-undef:__PLATFORM__HPUX" ) + AAdd( aOPTPRG, "-undef:__PLATFORM__UNIX" ) + #endif + + DO CASE + CASE t_cCOMP $ "mingwce|poccce|msvcce" + AAdd( aOPTPRG, "-D__PLATFORM__WINDOWS" ) + AAdd( aOPTPRG, "-D__PLATFORM__WINCE" ) + CASE t_cARCH == "win" + AAdd( aOPTPRG, "-D__PLATFORM__WINDOWS" ) + CASE t_cARCH == "dos" + AAdd( aOPTPRG, "-D__PLATFORM__DOS" ) + CASE t_cARCH == "os2" + AAdd( aOPTPRG, "-D__PLATFORM__OS2" ) + CASE t_cARCH == "linux" + AAdd( aOPTPRG, "-D__PLATFORM__LINUX" ) + AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + CASE t_cARCH == "darwin" + AAdd( aOPTPRG, "-D__PLATFORM__DARWIN" ) + AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + CASE t_cARCH == "bsd" + AAdd( aOPTPRG, "-D__PLATFORM__BDS" ) + AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + CASE t_cARCH == "sunos" + AAdd( aOPTPRG, "-D__PLATFORM__SUNOS" ) + AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + CASE t_cARCH == "hpux" + AAdd( aOPTPRG, "-D__PLATFORM__HPUX" ) + AAdd( aOPTPRG, "-D__PLATFORM__UNIX" ) + ENDCASE + ENDIF + + RETURN + /* Keep this public, it's used from macro. */ FUNCTION hbmk_ARCH() RETURN t_cARCH