From ccab51d63efbdb7a1962df09aa2c8c670f3ada03 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 5 Mar 2009 20:12:47 +0000 Subject: [PATCH] 2009-03-05 21:05 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * include/hbextern.ch + Added HB_SETENV() * utils/hbmk2/hbmk2.prg * Minor cleanups. * contrib/examples/uhttpd/uhttpd.hbm - Removed -n. It's now automatic. ; TODO: Remove the rest. * INSTALL * doc/man/hbmk.1 + config/win/icc.cf * utils/hbmk2/hbmk2.prg + Added Intel(R) C++ compiler support for Windows. + Added initial support also in hbmk2. ; This compile is actively developed and its famous of generating the fastest running code of all C compilers. It also outputs an extremely detailed warning list. And the best thing: It compiled Harbour without a single hitch. hbtest is also running fine. hbmk2 is able to create executables. --- harbour/ChangeLog | 24 +++++++++ harbour/INSTALL | 7 +-- harbour/config/win/icc.cf | 52 +++++++++++++++++++ harbour/contrib/examples/uhttpd/uhttpd.hbm | 2 +- harbour/doc/man/hbmk.1 | 2 +- harbour/include/hbextern.ch | 1 + harbour/utils/hbmk2/hbmk2.prg | 58 ++++++++++++++-------- 7 files changed, 120 insertions(+), 26 deletions(-) create mode 100644 harbour/config/win/icc.cf diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3574d2f032..fb1784c987 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,30 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-03-05 21:05 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * include/hbextern.ch + + Added HB_SETENV() + + * utils/hbmk2/hbmk2.prg + * Minor cleanups. + + * contrib/examples/uhttpd/uhttpd.hbm + - Removed -n. It's now automatic. + ; TODO: Remove the rest. + + * INSTALL + * doc/man/hbmk.1 + + config/win/icc.cf + * utils/hbmk2/hbmk2.prg + + Added Intel(R) C++ compiler support for Windows. + + Added initial support also in hbmk2. + ; This compile is actively developed and its famous of + generating the fastest running code of all C compilers. + It also outputs an extremely detailed warning list. + And the best thing: It compiled Harbour without a single + hitch. hbtest is also running fine. hbmk2 is able to + create executables. + 2009-03-05 19:44 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbapi.h * harbour/include/hbwince.h diff --git a/harbour/INSTALL b/harbour/INSTALL index 01eea61fd4..9ff7742be8 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -172,17 +172,18 @@ SUPPORTED C COMPILERS UNDER DIFFERENT PLATFORMS Windows ------- mingw - MinGW GNU C + mingwce - MinGW GNU C (Windows CE / ARM) msvc - Microsoft Visual C++ - owatcom - Open Watcom C++ - bcc - Borland/CodeGear C++ 4.x and above msvc64 - Microsoft Visual C++ x64 msvcia64 - Microsoft Visual C++ IA64 - mingwce - MinGW GNU C (Windows CE / ARM) msvcce - Microsoft Visual C++ (Windows CE / ARM) pocc - Pelles C 4.5 and above pocc64 - Pelles C 5.0 x64 poccce - Pelles C 5.0 (Windows CE / ARM) xcc - Pelles C for xhb + icc - Intel(R) C/C++ + bcc - Borland/CodeGear C++ 4.x and above + owatcom - Open Watcom C++ cygwin - Cygwin GNU C DOS (32-bit) diff --git a/harbour/config/win/icc.cf b/harbour/config/win/icc.cf new file mode 100644 index 0000000000..0a246b1bcc --- /dev/null +++ b/harbour/config/win/icc.cf @@ -0,0 +1,52 @@ +# +# $Id$ +# + +# Intel(R) C/C++ Compiler +# (usage is largely compatible with msvc) + +include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf + +OBJ_EXT = .obj +EXE_EXT = .exe +LIB_PREF = +LIB_EXT = .lib + +CC = icl.exe +CC_IN = -c +CC_OUT = -Fo +CPPFLAGS = -I. -I$(HB_INC_COMPILE) +CFLAGS = -W4 -Gs +# -Zi + +CFLAGS += -Ogt2yb1p -GX- -G6 -YX + +LD = icl.exe +LD_OUT = -Fe + +# Add all libraries specified in CONTRIBS and LIBS. +ifeq ($(HB_LIB_COMPILE),) +LINKPATHS += /link /libpath:$(LIB_DIR) +else +LINKPATHS += /link /libpath:$(HB_LIB_COMPILE) +endif +LINKLIBS += $(foreach lib, $(CONTRIBS), $(subst lib,,$(lib))$(LIB_EXT)) +LINKLIBS += $(foreach lib, $(LIBS), $(lib)$(LIB_EXT)) + +# If LIBS specifies the rdd library, add all DB drivers. +ifeq ($(findstring rdd,$(LIBS)),rdd) +LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), $(drv)$(LIB_EXT)) +endif + +# Add the specified GT driver library +ifeq ($(findstring rtl,$(LIBS)),rtl) +LINKLIBS += $(foreach gt, $(HB_GT_LIBS), $(gt)$(LIB_EXT)) +endif + +LDFLAGS = $(LINKPATHS) user32.lib wsock32.lib advapi32.lib gdi32.lib + +AR = xilib.exe +ARFLAGS = $(HB_USER_AFLAGS) +AR_RULE = $(AR) $(ARFLAGS) /out:$(LIB_DIR)/$@ $(^F) || $(RM) $(LIB_DIR)/$@ + +include $(TOP)$(ROOT)config/rules.cf diff --git a/harbour/contrib/examples/uhttpd/uhttpd.hbm b/harbour/contrib/examples/uhttpd/uhttpd.hbm index 95f129208d..c2c328da30 100644 --- a/harbour/contrib/examples/uhttpd/uhttpd.hbm +++ b/harbour/contrib/examples/uhttpd/uhttpd.hbm @@ -2,4 +2,4 @@ # $Id$ # --n -mt -gui uhttpd.prg cgifunc.prg cookie.prg session.prg uhttpdc.c socket.c -lhbct +-mt -gui uhttpd.prg cgifunc.prg cookie.prg session.prg uhttpdc.c socket.c -lhbct diff --git a/harbour/doc/man/hbmk.1 b/harbour/doc/man/hbmk.1 index 4f2d676984..24f69fb927 100644 --- a/harbour/doc/man/hbmk.1 +++ b/harbour/doc/man/hbmk.1 @@ -123,7 +123,7 @@ Defaults and feature support vary by architecture/compiler. Supported values for each supported value: linux: gcc, gpp, owatcom, icc, mingw, mingwce darwin: gcc -win: mingw, msvc, bcc, owatcom, pocc, cygwin, mingwce, msvc64, msvcia64, msvcce, pocc64, poccce +win: mingw, msvc, bcc, owatcom, icc, pocc, cygwin, mingwce, msvc64, msvcia64, msvcce, pocc64, poccce os2: gcc, owatcom dos: djgpp, owatcom bsd, hpux, sunos: gcc diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index 026221b8f3..89519a43f4 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -892,6 +892,7 @@ EXTERNAL HB_STRCDECODE EXTERNAL HB_STRXOR EXTERNAL HB_ISPRINTER EXTERNAL HB_GETENV +EXTERNAL HB_SETENV EXTERNAL HB_USERNAME EXTERNAL HB_RUN EXTERNAL HB_GETREADVAR diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index a443661703..5944b472c5 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -103,7 +103,7 @@ deal with "/" prefixed variant. Since we need to use -o 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: Sync default C/linker switches with the ones in Harbour GNU make system. */ /* TODO: Support for more compilers/platforms. */ /* TODO: Cross compilation support. */ /* TODO: Add support for library creation. */ @@ -454,9 +454,10 @@ FUNCTION Main( ... ) { {|| FindInPath( "bcc32" ) != NIL }, "bcc" },; { {|| FindInPath( "porc64" ) != NIL }, "pocc64" },; { {|| FindInPath( "pocc" ) != NIL }, "pocc" },; + { {|| FindInPath( "icl" ) != NIL }, "icc" },; { {|| FindInPath( "cygstart" ) != NIL }, "cygwin" },; { {|| FindInPath( "xcc" ) != NIL }, "xcc" } } - aCOMPSUP := { "mingw", "msvc", "bcc", "owatcom", "pocc", "xcc", "cygwin",; + aCOMPSUP := { "mingw", "msvc", "bcc", "owatcom", "icc", "pocc", "xcc", "cygwin",; "msvc64", "msvcia64", "pocc64",; "mingwce", "msvcce", "poccce" } cBin_CompPRG := "harbour.exe" @@ -574,13 +575,13 @@ FUNCTION Main( ... ) hb_osPathSeparator() + "harbour" +; hb_osPathSeparator() + "hbvm.h" ) IF Empty( s_cHB_BIN_INSTALL ) - s_cHB_BIN_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX, .T. ) + "bin" + s_cHB_BIN_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX ) + "bin" ENDIF IF Empty( s_cHB_LIB_INSTALL ) - s_cHB_LIB_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX, .T. ) + "lib" + hb_osPathSeparator() + "harbour" + s_cHB_LIB_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX ) + "lib" + hb_osPathSeparator() + "harbour" ENDIF IF Empty( s_cHB_INC_INSTALL ) - s_cHB_INC_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX, .T. ) + "include" + hb_osPathSeparator() + "harbour" + s_cHB_INC_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX ) + "include" + hb_osPathSeparator() + "harbour" ENDIF ENDIF ENDIF @@ -591,13 +592,13 @@ FUNCTION Main( ... ) RETURN 3 ENDIF IF Empty( s_cHB_BIN_INSTALL ) - s_cHB_BIN_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX, .T. ) + "bin" + s_cHB_BIN_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX ) + "bin" ENDIF IF Empty( s_cHB_LIB_INSTALL ) - s_cHB_LIB_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX, .T. ) + "lib" + s_cHB_LIB_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX ) + "lib" ENDIF IF Empty( s_cHB_INC_INSTALL ) - s_cHB_INC_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX, .T. ) + "include" + s_cHB_INC_INSTALL := PathNormalize( s_cHB_INSTALL_PREFIX ) + "include" ENDIF IF t_lInfo @@ -1004,7 +1005,7 @@ FUNCTION Main( ... ) IF lSysLoc cPrefix := "" ELSE - cPrefix := PathNormalize( s_cHB_LIB_INSTALL, .T. ) + cPrefix := PathNormalize( s_cHB_LIB_INSTALL ) ENDIF #if 1 cPostfix := "" @@ -1257,6 +1258,7 @@ FUNCTION Main( ... ) ENDIF CASE t_cARCH == "os2" .AND. t_cCOMP == "gcc" + cLibPrefix := "-l" cLibExt := "" cObjExt := ".o" @@ -1474,7 +1476,7 @@ FUNCTION Main( ... ) "hbmainstd",; "hbmainwin" } - CASE t_cARCH == "win" .AND. t_cCOMP $ "msvc|msvc64|msvcia64" + CASE t_cARCH == "win" .AND. t_cCOMP $ "msvc|msvc64|msvcia64|icc" IF s_lDEBUG AAdd( s_aOPTC, "-MTd -Zi" ) ENDIF @@ -1486,7 +1488,11 @@ FUNCTION Main( ... ) cLibPrefix := NIL cLibExt := ".lib" cObjExt := ".obj" - cBin_CompC := "cl.exe" + IF t_cCOMP == "icc" + cBin_CompC := "icl.exe" + ELSE + cBin_CompC := "cl.exe" + ENDIF cOpt_CompC := "-nologo -W3 {FC} -I{DI} {LC} {LO} /link {DL} {FL} {LL} {LS}" cLibPathPrefix := "/libpath:" cLibPathSep := " " @@ -1523,11 +1529,18 @@ FUNCTION Main( ... ) "harbour-" + cDL_Version_Alter + "-vc-ia64" ),; "hbmainstd",; "hbmainwin" } + CASE t_cCOMP == "icc" + s_aLIBSHARED := { iif( s_lMT, "harbourmt-" + cDL_Version_Alter + "-icc",; + "harbour-" + cDL_Version_Alter + "-icc" ),; + "hbmainstd",; + "hbmainwin" } ENDCASE - cBin_Res := "rc.exe" - cOpt_Res := "/r {LR}" - cResExt := ".res" + IF !( t_cCOMP == "icc" ) + cBin_Res := "rc.exe" + cOpt_Res := "/r {LR}" + cResExt := ".res" + ENDIF CASE t_cARCH == "win" .AND. t_cCOMP == "pocc" IF s_lGUI @@ -1600,7 +1613,7 @@ FUNCTION Main( ... ) DO CASE CASE ! s_lSHARED .OR. ; !( t_cARCH == "win" ) .OR. ; - t_cCOMP $ "msvc|msvc64|msvcia64" + t_cCOMP $ "msvc|msvc64|msvcia64|icc" /* NOTE: MSVC gives the warning: "LNK4217: locally defined symbol ... imported in function ..." @@ -1630,7 +1643,10 @@ FUNCTION Main( ... ) ENDIF /* Build C stub */ - FWrite( fhnd, '#include "hbapi.h"' + hb_osNewLine() ) + FWrite( fhnd, '/* This temp source file was generated by Harbour Make tool. */' + hb_osNewLine() +; + '/* You can safely delete it. */' + hb_osNewLine() +; + '' + hb_osNewLine() +; + '#include "hbapi.h"' + hb_osNewLine() ) IF ! Empty( array ) FWrite( fhnd, '' + hb_osNewLine() ) AEval( array, {|tmp| FWrite( fhnd, 'HB_FUNC_EXTERN( ' + tmp + ' );' + hb_osNewLine() ) } ) @@ -2210,7 +2226,7 @@ STATIC FUNCTION FN_NameGet( cFileName ) STATIC FUNCTION FN_ExtGet( cFileName ) LOCAL cExt - hb_FNameSplit( cFileName, , , @cExt ) + hb_FNameSplit( cFileName,,, @cExt ) RETURN cExt @@ -2647,8 +2663,8 @@ STATIC FUNCTION MacroProc( cString, cDirParent ) LOCAL nEnd LOCAL cMacro - DO WHILE ( nStart := At( "$(", cString ) ) > 0 .AND. ; - ( nEnd := hb_At( ")", cString, nStart ) ) > 0 + DO WHILE ( nStart := At( "${", cString ) ) > 0 .AND. ; + ( nEnd := hb_At( "}", cString, nStart ) ) > 0 cMacro := Upper( SubStr( cString, nStart + 2, nEnd - nStart - 1 ) ) @@ -2739,7 +2755,7 @@ STATIC FUNCTION commandResult( cCommand, nResult ) cResult := hb_MemoRead( cFileName ) FErase( cFileName ) ELSE - OutErr( "hbmk: Error: cannot create temporary file." + hb_osNewLine() ) + OutErr( "hbmk: Error: Cannot create temporary file." + hb_osNewLine() ) ENDIF RETURN cResult @@ -2841,7 +2857,7 @@ STATIC PROCEDURE ShowHelp( lLong ) " - Supported values for each supported value:" ,; " linux : gcc, gpp, owatcom, icc, mingw, mingwce" ,; " darwin : gcc" ,; - " win : mingw, msvc, bcc, owatcom, pocc, cygwin," ,; + " win : mingw, msvc, bcc, owatcom, icc, pocc, cygwin," ,; " mingwce, msvc64, msvcia64, msvcce, pocc64, poccce, xcc" ,; " os2 : gcc, owatcom" ,; " dos : djgpp, owatcom" ,;