From 2a8789652e36cec95dca39b2726db7245f963761 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 21 Aug 2009 19:00:06 +0000 Subject: [PATCH] 2009-08-21 21:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * source/vm/maindllh.c * source/vm/Makefile + Added support for os2 .dll. Please review. * config/os2/watcom.mk + Added os2 .dll generation for watcom. Now it generates OK. * source/Makefile * config/lib.mk + Added support for os2 and some level of *nix support. * INSTALL * Minor update to a few option description. * utils/hbmk2/hbmk2.prg + Added preliminary/experimental/untested OS/2 -shared (.dll) support for watcom targets. --- harbour/ChangeLog | 20 ++++++++++++++++++++ harbour/INSTALL | 6 ++++-- harbour/config/lib.mk | 2 +- harbour/config/os2/watcom.mk | 21 +++++++++++++++++++++ harbour/source/Makefile | 21 +++++++++++++++++---- harbour/source/vm/Makefile | 1 + harbour/source/vm/maindllh.c | 8 ++++++++ harbour/utils/hbmk2/hbmk2.prg | 14 ++++++++++++-- 8 files changed, 84 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9e0d73d8ee..200acd94ec 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,26 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-21 21:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * source/vm/maindllh.c + * source/vm/Makefile + + Added support for os2 .dll. Please review. + + * config/os2/watcom.mk + + Added os2 .dll generation for watcom. + Now it generates OK. + + * source/Makefile + * config/lib.mk + + Added support for os2 and some level of *nix support. + + * INSTALL + * Minor update to a few option description. + + * utils/hbmk2/hbmk2.prg + + Added preliminary/experimental/untested OS/2 -shared (.dll) + support for watcom targets. + 2009-08-21 20:06 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/globsh.mk + Extended NOTE about max cmdline lenght on nt shells. diff --git a/harbour/INSTALL b/harbour/INSTALL index 36b1aec38d..546d6121b8 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -325,9 +325,11 @@ OPTIONS AVAILABLE WHEN BUILDING HARBOUR - HB_BUILD_PKG=yes Create release package. Default: no Requires 'clean install' in root source dir. (currently on Windows/Windows CE/DOS) - - HB_BUILD_DLL=no Create Harbour .dlls. Default: yes + - HB_BUILD_DLL=no Create Harbour dynamic libraries. Default: yes - HB_BUILD_IMPLIB=yes Create import libraries for external .dll - dependencies. Default: no + dependencies (including contribs). Default: no + (for Windows targets created on Windows NT + shells only) - HB_BUILD_DEBUG=yes Create a debug build. Default: no - HB_BUILD_OPTIM=no Enable C compiler optimizations. Default: yes - HB_BUILD_UNICODE=yes Create Unicode build (on Windows/Windows CE). diff --git a/harbour/config/lib.mk b/harbour/config/lib.mk index d22ca5e438..4c22c263f7 100644 --- a/harbour/config/lib.mk +++ b/harbour/config/lib.mk @@ -7,7 +7,7 @@ include $(TOP)$(ROOT)config/global.mk ifneq ($(HB_ARCHITECTURE),) ifneq ($(HB_COMPILER),) -HB_DYN_LIBS := hbcommon hbpp hbrtl hbmacro hblang hbcpage hbpcre hbzlib hbextern hbrdd rddntx rddnsx rddcdx rddfpt hbsix hbhsx hbusrrdd gtcgi gtpca gtstd gtwvt gtgui gtwin hbvm hbvmmt hbmaindllh +HB_DYN_LIBS := hbcommon hbpp hbrtl hbmacro hblang hbcpage hbpcre hbzlib hbextern hbrdd rddntx rddnsx rddcdx rddfpt hbsix hbhsx hbusrrdd gtcgi gtpca gtstd gtwvt gtgui gtwin gtos2 gttrm hbvm hbvmmt hbmaindllh include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/$(HB_COMPILER).mk include $(TOP)$(ROOT)config/c.mk diff --git a/harbour/config/os2/watcom.mk b/harbour/config/os2/watcom.mk index 76fd9558b8..139fad2efb 100644 --- a/harbour/config/os2/watcom.mk +++ b/harbour/config/os2/watcom.mk @@ -8,6 +8,9 @@ OBJ_EXT := .obj LIB_PREF := LIB_EXT := .lib +HB_DYN_COPT := -DHB_DYNLIB +OBJ_DYN_POSTFIX := _dyn + ifeq ($(HB_BUILD_MODE),c) CC := wcc386 endif @@ -61,4 +64,22 @@ LDFLAGS += SYS os2v2 LDLIBS := $(foreach lib,$(LIBS),$(LIB_DIR)/$(lib)) +DY := $(LD) +DFLAGS := OP quiet SYS os2v2_dll +DY_OUT := +DLIBS := + +# NOTE: The empty line directly before 'endef' HAVE TO exist! +define dyn_object + @$(ECHO) $(ECHOQUOTE)FILE '$(file)'$(ECHOQUOTE) >> __dyn__.tmp + +endef +define create_dynlib + $(if $(wildcard __dyn__.tmp),@$(RM) __dyn__.tmp,) + $(foreach file,$^,$(dyn_object)) + $(DY) $(DFLAGS) $(HB_USER_DFLAGS) NAME '$(subst /,$(DIRSEP),$(DYN_DIR)/$@)' OP implib='$(IMP_FILE)' @__dyn__.tmp +endef + +DY_RULE = $(create_dynlib) + include $(TOP)$(ROOT)config/common/watcom.mk diff --git a/harbour/source/Makefile b/harbour/source/Makefile index 5979ced59a..82c2c5b6f6 100644 --- a/harbour/source/Makefile +++ b/harbour/source/Makefile @@ -48,14 +48,27 @@ else endif endif endif + else + ifeq ($(HB_ARCHITECTURE),os2) + DYNNAME_POST := $(DYNNAME_POST)-os2 + endif endif endif - DYNDIRLIST_BASE := source/common source/pp source/rtl source/macro source/lang source/codepage source/hbpcre source/hbzlib source/hbextern source/rdd source/rdd/dbfntx source/rdd/dbfnsx source/rdd/dbfcdx source/rdd/dbffpt source/rdd/hbsix source/rdd/hsx source/rdd/usrrdd source/rtl/gtcgi source/rtl/gtpca source/rtl/gtstd source/rtl/gtwvt source/rtl/gtgui - ifneq ($(HB_ARCHITECTURE),wce) - DYNDIRLIST_BASE += source/rtl/gtwin + DYNDIRLIST_BASE := source/common source/pp source/rtl source/macro source/lang source/codepage source/hbpcre source/hbzlib source/hbextern source/rdd source/rdd/dbfntx source/rdd/dbfnsx source/rdd/dbfcdx source/rdd/dbffpt source/rdd/hbsix source/rdd/hsx source/rdd/usrrdd source/rtl/gtcgi source/rtl/gtpca source/rtl/gtstd + ifeq ($(HB_ARCHITECTURE),os2) + DYNDIRLIST_BASE += source/rtl/gtos2 endif - ifeq ($(HB_ARCHITECTURE)-$(HB_COMPILER),win-watcom) + ifeq ($(HB_ARCHITECTURE),wce) + DYNDIRLIST_BASE += source/rtl/gtwvt source/rtl/gtgui + endif + ifeq ($(HB_ARCHITECTURE),win) + DYNDIRLIST_BASE += source/rtl/gtwvt source/rtl/gtgui source/rtl/gtwin + endif + ifeq ($(HB_OS_UNIX),yes) + DYNDIRLIST_BASE += source/rtl/gttrm + endif + ifeq ($(HB_COMPILER),watcom) DYNDIRLIST_BASE += source/vm/maindllh endif diff --git a/harbour/source/vm/Makefile b/harbour/source/vm/Makefile index b227e186b3..8e669b01c6 100644 --- a/harbour/source/vm/Makefile +++ b/harbour/source/vm/Makefile @@ -49,6 +49,7 @@ else else ifeq ($(HB_ARCHITECTURE),os2) C_MAIN := mainstd.c + DIRS := maindllh else C_MAIN := main.c endif diff --git a/harbour/source/vm/maindllh.c b/harbour/source/vm/maindllh.c index 5eb8e97409..7879d0e8cb 100644 --- a/harbour/source/vm/maindllh.c +++ b/harbour/source/vm/maindllh.c @@ -94,4 +94,12 @@ void hb_forceLinkMainStd( void ) {} HB_EXTERN_END #endif +#elif defined( HB_OS_OS2 ) + +#if defined( __WATCOMC__ ) +HB_EXTERN_BEGIN +void hb_forceLinkMainStd( void ) {} +HB_EXTERN_END +#endif + #endif diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index a8b63fab32..d7b80c72cd 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -2474,7 +2474,8 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) IF hbmk[ _HBMK_cARCH ] $ "win|os2|dos" AAdd( hbmk[ _HBMK_aOPTA ], "-p=64" ) ENDIF - IF hbmk[ _HBMK_cARCH ] == "win" + DO CASE + CASE hbmk[ _HBMK_cARCH ] == "win" l_aLIBSYS := ArrayAJoin( { l_aLIBSYS, l_aLIBSYSCORE, l_aLIBSYSMISC } ) l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + cLibExt,; "harbour" + cDL_Version_Alter + cLibExt ) } @@ -2482,7 +2483,16 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) IF hbmk[ _HBMK_lSHARED ] AAdd( hbmk[ _HBMK_aOPTL ], "FILE " + FN_ExtSet( l_cHB_LIB_INSTALL + hb_osPathSeparator() + iif( hbmk[ _HBMK_lGUI ], "hbmainwin", "hbmainstd" ), cLibExt ) ) ENDIF - ENDIF + CASE hbmk[ _HBMK_cARCH ] == "os2" + l_aLIBSYS := ArrayAJoin( { l_aLIBSYS, l_aLIBSYSCORE, l_aLIBSYSMISC } ) + l_aLIBSHARED := { iif( hbmk[ _HBMK_lMT ], "harbourmt" + cDL_Version_Alter + "-os2" + cLibExt,; + "harbour" + cDL_Version_Alter + "-os2" + cLibExt ) } + + IF hbmk[ _HBMK_lSHARED ] + /* TOFIX: This line is plain guessing. */ + AAdd( hbmk[ _HBMK_aOPTL ], "FILE " + FN_ExtSet( l_cHB_LIB_INSTALL + hb_osPathSeparator() + iif( hbmk[ _HBMK_lGUI ], "hbmainstd", "hbmainstd" ), cLibExt ) ) + ENDIF + ENDCASE IF hbmk[ _HBMK_cARCH ] $ "win|os2" cBin_Res := "wrc" + cCCEXT cResExt := ".res"