diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ec693e2a11..060f8dfebc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,37 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-20 20:07 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * utils/hbmk2/hbmk2.prg + * config/global.mk + ! Fixed to -undef:__PLATFORM__UNIX even for Windows host platforms. + This is required because Cygwin builds have this envvar set. + I'm not sure that setting __PLATFORM__UNIX for Cygwin is right + behavior though. + + * config/dos/watcom.mk + * config/win/watcom.mk + * config/linux/watcom.mk + * config/os2/watcom.mk + + config/common/watcom.mk + % Moved common watcom compiler specific make logic to one file. + I've choosen OS/2 rules in this global makefile, as they will + work on all platforms, albeit in the known slighly hacky way. + It's easy to reintroduce shell specific rules for more advanced + shells. There was one common rule set for nt/dos shells, plus + a very clean one for sh. I may do this in a next commit. + After this change it's possible to create all possible watcom + cross-builds. Pls shout if I missed something or the concept + seems to have some potential flaws. + ; QUESTION: Does 'wlib' support '-p=64' option on Linux watcom builds? + ; NOTE: Still most of the not yet merged logic could be merged, + since there is only a few minor difference between them. + ; TODO: Add shell optimized watcom rules for nt/dos/sh shells. + ; TODO: Try to do a similar stunt for gcc.mk files. + + * source/pp/ppcore.c + * #ifdef -> #if defined() + 2009-08-20 15:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/global.mk ! Fixed dos autodetection to not be overridden by explicit diff --git a/harbour/config/common/watcom.mk b/harbour/config/common/watcom.mk new file mode 100644 index 0000000000..fb8fb31fae --- /dev/null +++ b/harbour/config/common/watcom.mk @@ -0,0 +1,82 @@ +# +# $Id$ +# + +# GNU MAKE file for Open Watcom C/C++ compiler + +# --------------------------------------------------------------- +# See option docs here: +# http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/cpopts.html +# http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/wlink.html +# http://www.users.pjwstk.edu.pl/~jms/qnx/help/watcom/compiler-tools/wlib.html +# --------------------------------------------------------------- + +ifeq ($(CC),wcc386) + ifneq ($(HB_HOST_ARCH),linux) + CPPFLAGS := $(subst /,\,$(CPPFLAGS)) + CC_RULE = $(CC) $(subst /,\,$(HB_INC_DEPEND)) $(CPPFLAGS) $(subst /,\,$(CFLAGS)) $(subst /,\,$(HB_CFLAGS)) $(subst /,\,$(HB_USER_CFLAGS)) $(CC_OUT)$(> __lib__.tmp,) + # -$(if $(wordlist 101,200,$(^F)), $(ECHO) $(wordlist 101,200,$(addprefix -+,$(^F))) >> __lib__.tmp,) + # -$(if $(wordlist 201,300,$(^F)), $(ECHO) $(wordlist 301,300,$(addprefix -+,$(^F))) >> __lib__.tmp,) + # anyhow OS/2 port# of GNU make 3.81 seems to have bug and GPFs when total + # commands length is too big so for %i in ( *$(OBJ_EXT) ) do ... below is + # ugly workaround for both problems + + ifeq ($(HB_SHELL),nt) + FILE := %%f + else + FILE := %f + endif + + define create_library + @$(ECHO) $(LIB_DIR)/$@ > __lib__.tmp + for $(FILE) in ( *$(OBJ_EXT) ) do @$(ECHO) -+$(FILE) >> __lib__.tmp + $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) @__lib__.tmp + endef +endif + +AR := wlib +ARFLAGS := -q -p=64 -c -n +AR_RULE = $(create_library) + +ifeq ($(HB_SHELL),dos) + + # disable DOS/4GW Banner + export DOS4G := quiet + + # work arround to DOS command line size limit + ifeq ($(CC),wcc386) + export WCC386 := $(strip $(CPPFLAGS)) + else + export WPP386 := $(strip $(CPPFLAGS)) + endif + CPPFLAGS := + + export HARBOURCMD := $(HB_FLAGS) + HB_FLAGS := +endif + +include $(TOP)$(ROOT)config/rules.mk diff --git a/harbour/config/dos/watcom.mk b/harbour/config/dos/watcom.mk index a056eb850f..19c119ca68 100644 --- a/harbour/config/dos/watcom.mk +++ b/harbour/config/dos/watcom.mk @@ -42,6 +42,7 @@ ifneq ($(HB_BUILD_OPTIM),no) # optimization flags # don't enable -ol optimization in OpenWatcom 1.1 - gives buggy code + # -oxaht CPPFLAGS += -onaehtr -s -ei -zp4 -zt0 #CPPFLAGS += -obl+m ifeq ($(CC),wpp386) @@ -57,33 +58,6 @@ ifeq ($(HB_BUILD_DEBUG),yes) CPPFLAGS += -d2 endif -ifeq ($(CC),wcc386) - ifneq ($(HB_HOST_ARCH),linux) - CPPFLAGS := $(subst /,\,$(CPPFLAGS)) - CC_RULE = $(CC) $(subst /,\,$(HB_INC_DEPEND)) $(CPPFLAGS) $(subst /,\,$(CFLAGS)) $(subst /,\,$(HB_CFLAGS)) $(subst /,\,$(HB_USER_CFLAGS)) $(CC_OUT)$(> __link__.tmp - -endef - -# NOTE: The empty line directly before 'endef' HAVE TO exist! -define link_lib - @$(ECHO) LIB $(lib) >> __link__.tmp - -endef - -define link_exe_file - @$(ECHO) $(LDFLAGS) NAME $(BIN_DIR)/$@ > __link__.tmp - $(foreach file,$(^F),$(link_file)) - $(foreach lib,$(LDLIBS),$(link_lib)) - -$(LD) @__link__.tmp -endef - LD := wlink ifeq ($(HB_BUILD_DEBUG),yes) LDFLAGS += DEBUG ALL @@ -96,41 +70,6 @@ else LDFLAGS += SYS dos4g OP STUB=wstubq.exe endif -LDLIBS := $(foreach lib,$(LIBS),$(LIB_DIR)/$(lib)) - -LD_RULE = $(link_exe_file) $(HB_USER_LDFLAGS) - -# NOTE: The empty line directly before 'endef' HAVE TO exist! -define lib_object - @$(ECHO) -+$(file) >> __lib__.tmp - -endef - -define create_library - @$(ECHO) $(LIB_DIR)/$@ > __lib__.tmp - $(foreach file,$(^F),$(lib_object)) - $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) @__lib__.tmp -endef - -AR := wlib -ARFLAGS := -q -p=64 -c -n -AR_RULE = $(create_library) - -ifeq ($(HB_SHELL),dos) - - # disable DOS/4GW Banner - export DOS4G := quiet - - # work arround to DOS command line size limit - ifeq ($(CC),wcc386) - export WCC386 := $(strip $(CPPFLAGS)) - else - export WPP386 := $(strip $(CPPFLAGS)) - endif - CPPFLAGS := - - export HARBOURCMD := $(HB_FLAGS) - HB_FLAGS := -endif +include $(TOP)$(ROOT)config/common/watcom.mk include $(TOP)$(ROOT)config/rules.mk diff --git a/harbour/config/global.mk b/harbour/config/global.mk index 5c343aa889..33016017fa 100644 --- a/harbour/config/global.mk +++ b/harbour/config/global.mk @@ -26,7 +26,6 @@ # TOFIX: $(realpath/abspath) need GNU Make 3.81 or upper # TOFIX: $(eval) needs GNU Make 3.80 or upper - ifeq ($(GLOBAL_CF_),) GLOBAL_CF_ := yes @@ -818,6 +817,8 @@ ifneq ($(HB_HOST_ARCH)$(HB_HOST_CPU),$(HB_ARCHITECTURE)$(HB_CPU)) # Setup platform macros (undefine host, define target) ifeq ($(HB_HOST_ARCH),win) HB_PRGFLAGS += -undef:__PLATFORM__WINDOWS + # We only need this to avoid problems with using Cygwin binaries as native ones. + HB_PRGFLAGS += -undef:__PLATFORM__UNIX else ifeq ($(HB_HOST_ARCH),dos) HB_PRGFLAGS += -undef:__PLATFORM__DOS diff --git a/harbour/config/linux/watcom.mk b/harbour/config/linux/watcom.mk index f8d1d081e0..16436a5c7b 100644 --- a/harbour/config/linux/watcom.mk +++ b/harbour/config/linux/watcom.mk @@ -66,40 +66,6 @@ ifeq ($(HB_BUILD_DEBUG),yes) endif LDFLAGS += SYS linux -LDLIBS := $(foreach lib,$(LIBS),$(LIB_DIR)/$(lib)) - -comma := , -LDFILES_COMMA = $(subst $(subst x,x, ),$(comma) ,$(^F)) -LDLIBS_COMMA := $(subst $(subst x,x, ),$(comma) ,$(strip $(LDLIBS))) -ifneq ($(HB_SHELL),sh) - LD_RULE = $(LD) $(LDFLAGS) $(HB_USER_LDFLAGS) NAME $(BIN_DIR)/$@. FILE $(LDFILES_COMMA) -else - LD_RULE = $(LD) $(LDFLAGS) $(HB_USER_LDFLAGS) NAME $(BIN_DIR)/$@ FILE $(LDFILES_COMMA) -endif -ifneq ($(LDLIBS_COMMA),) - LD_RULE += LIB $(LDLIBS_COMMA) -endif - -AR := wlib -# ARFLAGS := -q -c -n -fa -ARFLAGS := -q -c -n -AR_RULE = $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) $(LIB_DIR)/$@ $(foreach file,$(^F),-+$(file)) - -ifeq ($(HB_SHELL),dos) - - # disable DOS/4GW Banner - export DOS4G := quiet - - # work arround to DOS command line size limit - ifeq ($(CC),wcc386) - export WCC386 := $(strip $(CPPFLAGS)) - else - export WPP386 := $(strip $(CPPFLAGS)) - endif - CPPFLAGS := - - export HARBOURCMD := $(HB_FLAGS) - HB_FLAGS := -endif +include $(TOP)$(ROOT)config/common/watcom.mk include $(TOP)$(ROOT)config/rules.mk diff --git a/harbour/config/os2/watcom.mk b/harbour/config/os2/watcom.mk index 730ac2a2ff..d9fe428daa 100644 --- a/harbour/config/os2/watcom.mk +++ b/harbour/config/os2/watcom.mk @@ -42,6 +42,7 @@ ifneq ($(HB_BUILD_OPTIM),no) # optimization flags # don't enable -ol optimization in OpenWatcom 1.1 - gives buggy code + # -oxaht CPPFLAGS += -onaehtr -s -ei -zp4 -zt0 #CPPFLAGS += -obl+m ifeq ($(CC),wpp386) @@ -59,70 +60,12 @@ ifeq ($(HB_BUILD_DEBUG),yes) CPPFLAGS += -d2 endif -ifeq ($(CC),wcc386) - ifneq ($(HB_HOST_ARCH),linux) - CPPFLAGS := $(subst /,\,$(CPPFLAGS)) - CC_RULE = $(CC) $(subst /,\,$(HB_INC_DEPEND)) $(CPPFLAGS) $(subst /,\,$(CFLAGS)) $(subst /,\,$(HB_CFLAGS)) $(subst /,\,$(HB_USER_CFLAGS)) $(CC_OUT)$(> __lib__.tmp,) - # -$(if $(wordlist 101,200,$(^F)), $(ECHO) $(wordlist 101,200,$(addprefix -+,$(^F))) >> __lib__.tmp,) - # -$(if $(wordlist 201,300,$(^F)), $(ECHO) $(wordlist 301,300,$(addprefix -+,$(^F))) >> __lib__.tmp,) - # anyhow OS2 port# of GNU make 3.81 seems to have bug and GPFs when total - # commands length is too big so for %i in ( *$(OBJ_EXT) ) do ... below is - # ugly workaround for both problems - - ifeq ($(HB_SHELL),nt) - FILE := %%f - else - FILE := %f - endif - - define create_library - @$(ECHO) $(LIB_DIR)/$@ > __lib__.tmp - for $(FILE) in ( *$(OBJ_EXT) ) do @$(ECHO) -+$(FILE) >> __lib__.tmp - $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) @__lib__.tmp - endef -endif - -AR := wlib -ARFLAGS := -q -p=64 -c -n -AR_RULE = $(create_library) - -ifeq ($(HB_SHELL),dos) - - # disable DOS/4GW Banner - export DOS4G := quiet - - # work arround to DOS command line size limit - ifeq ($(CC),wcc386) - export WCC386 := $(strip $(CPPFLAGS)) - else - export WPP386 := $(strip $(CPPFLAGS)) - endif - CPPFLAGS := - - export HARBOURCMD := $(HB_FLAGS) - HB_FLAGS := -endif +include $(TOP)$(ROOT)config/common/watcom.mk include $(TOP)$(ROOT)config/rules.mk diff --git a/harbour/config/win/watcom.mk b/harbour/config/win/watcom.mk index 22f6a4e1e3..849dd3b187 100644 --- a/harbour/config/win/watcom.mk +++ b/harbour/config/win/watcom.mk @@ -46,6 +46,7 @@ ifneq ($(HB_BUILD_OPTIM),no) # don't enable -ol optimization in OpenWatcom 1.1 - gives buggy code # -oxaht CPPFLAGS += -onaehtr -s -ei -zp4 -zt0 + #CPPFLAGS += -obl+m ifeq ($(CC),wpp386) CPPFLAGS += -oi+ else @@ -61,75 +62,12 @@ ifeq ($(HB_BUILD_DEBUG),yes) CPPFLAGS += -d2 endif -ifeq ($(CC),wcc386) - ifneq ($(HB_HOST_ARCH),linux) - CPPFLAGS := $(subst /,\,$(CPPFLAGS)) - CC_RULE = $(CC) $(subst /,\,$(HB_INC_DEPEND)) $(CPPFLAGS) $(subst /,\,$(CFLAGS)) $(subst /,\,$(HB_CFLAGS)) $(subst /,\,$(HB_USER_CFLAGS)) $(CC_OUT)$(> __link__.tmp - -endef - -# NOTE: The empty line directly before 'endef' HAVE TO exist! -define link_lib - @$(ECHO) LIB $(lib) >> __link__.tmp - -endef - -define link_exe_file - @$(ECHO) $(LDFLAGS) NAME $(BIN_DIR)/$@ > __link__.tmp - $(foreach file,$(^F),$(link_file)) - $(foreach lib,$(LDLIBS),$(link_lib)) - -$(LD) @__link__.tmp -endef - LD := wlink ifeq ($(HB_BUILD_DEBUG),yes) LDFLAGS += DEBUG ALL endif LDFLAGS += SYS nt -LDLIBS := $(foreach lib,$(LIBS),$(LIB_DIR)/$(lib)) -LDLIBS += $(foreach lib,$(SYSLIBS),$(lib)) - -LD_RULE = $(link_exe_file) $(HB_USER_LDFLAGS) - -# NOTE: The empty line directly before 'endef' HAVE TO exist! -define lib_object - @$(ECHO) -+$(file) >> __lib__.tmp - -endef - -define create_library - @$(ECHO) $(LIB_DIR)/$@ > __lib__.tmp - $(foreach file,$(^F),$(lib_object)) - $(AR) $(ARFLAGS) $(HB_USER_AFLAGS) @__lib__.tmp -endef - -AR := wlib -ARFLAGS := -q -p=64 -c -n -AR_RULE = $(create_library) - -ifeq ($(HB_SHELL),dos) - - # disable DOS/4GW Banner - export DOS4G := quiet - - # work arround to DOS command line size limit - ifeq ($(CC),wcc386) - export WCC386 := $(strip $(CPPFLAGS)) - else - export WPP386 := $(strip $(CPPFLAGS)) - endif - CPPFLAGS := - - export HARBOURCMD := $(HB_FLAGS) - HB_FLAGS := -endif +include $(TOP)$(ROOT)config/common/watcom.mk include $(TOP)$(ROOT)config/rules.mk diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 45d8b429c2..0a61090d32 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -5361,7 +5361,7 @@ void hb_pp_initDynDefines( PHB_PP_STATE pState ) hb_xfree( szPlatform ); hb_pp_addDefine( pState, szDefine, szResult ); -#ifdef HB_OS_UNIX +#if defined( HB_OS_UNIX ) hb_strncpy( szDefine + 12, "UNIX", sizeof( szDefine ) - 13 ); hb_pp_addDefine( pState, szDefine, szResult ); #endif diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 048d268ade..4f491349cd 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -5677,6 +5677,10 @@ STATIC PROCEDURE PlatformPRGFlags( hbmk, aOPTPRG ) #if defined( __PLATFORM__WINCE ) AAdd( aUnd, "__PLATFORM__WINCE" ) #endif + /* This is defined with Cygwin */ + #if defined( __PLATFORM__UNIX ) + AAdd( aUnd, "__PLATFORM__UNIX" ) + #endif #elif defined( __PLATFORM__DOS ) AAdd( aUnd, "__PLATFORM__DOS" ) #elif defined( __PLATFORM__OS2 )