diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7d001bec51..0e5f4e6e0e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,43 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-01 12:40 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * config/header.cf + * config/rules.cf + * config/none.cf + * config/global.cf + * config/doc.cf + * config/lib.cf + * config/bin.cf + * config/dir.cf + * config/test.cf + + Added HB_COMPILER and HB_ARCHITECTURE autodetection. + It's experimental yet. + + Added support for HB_BUILD_SUBDIR envvar which can + extend the / path by arbitrary subdir(s). + Useful to keep custom binary builds in parallel, f.e. + release/debug, cpp/c, cpu targets. Notice that hbmk2 + will not be able to use such customized directory + structure yet, but there'll probably be a cmdline option + for that in the future (it won't/can't be automatic). + Notice, this feature doesn't work yet on OS/2 because + the shell doesn't support 'mkdir -p' equivalent. + * Cleaned internal ARCH_COMP var usage. + % Deleted SOURCE_DIR usage, it was a no-op. + + * make_gnu.bat + ! Fixed autodetection of mingwarm. + ; Autodetection code will have to be deleted from here anyway. + + + config/os2-mkdir.exe + + Added OS/2 GNU mkdir executable. (not yet used) + + * examples/superlib/superlib.dif + + Added 'const'. + + * source/rtl/hbinet.c + ! Fixed to use hb_retc() to return hb_socketErrorStr() value. + 2009-07-31 13:21 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbthread.h ! unblocked MT compilation for WinCE diff --git a/harbour/config/bin.cf b/harbour/config/bin.cf index e060f23a4b..054c7fc905 100644 --- a/harbour/config/bin.cf +++ b/harbour/config/bin.cf @@ -2,15 +2,16 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf + ifneq ($(HB_ARCHITECTURE),) ifneq ($(HB_COMPILER),) # no slash at the end EXE_ARCH_DIR := $(TOP)$(ROOT)bin/$(HB_ARCHITECTURE) # no slash at the end -EXE_DIR := $(EXE_ARCH_DIR)/$(HB_COMPILER) +EXE_DIR := $(TOP)$(ROOT)bin/$(ARCH_COMP) -include $(TOP)$(ROOT)config/global.cf include $(TOP)$(ROOT)config/c.cf include $(TOP)$(ROOT)config/prg.cf diff --git a/harbour/config/dir.cf b/harbour/config/dir.cf index 1c39c00719..5d6cacdb0d 100644 --- a/harbour/config/dir.cf +++ b/harbour/config/dir.cf @@ -2,11 +2,11 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf + ifneq ($(HB_ARCHITECTURE),) ifneq ($(HB_COMPILER),) -include $(TOP)$(ROOT)config/global.cf - ifeq ($(HB_HOST_ARCH),dos) #do not use rules for parallel processing in DOS JOB_SRV := NO diff --git a/harbour/config/doc.cf b/harbour/config/doc.cf index 14b9410bb0..4e3eaeef64 100644 --- a/harbour/config/doc.cf +++ b/harbour/config/doc.cf @@ -2,11 +2,11 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf + ifneq ($(HB_ARCHITECTURE),) ifneq ($(HB_COMPILER),) -include $(TOP)$(ROOT)config/global.cf - first:: ifeq ($(HB_DOC_INSTALL),) diff --git a/harbour/config/global.cf b/harbour/config/global.cf index 0a229b73dc..4c70e59e99 100644 --- a/harbour/config/global.cf +++ b/harbour/config/global.cf @@ -25,11 +25,10 @@ else need := 3.81 ok := $(filter $(need),$(firstword $(sort $(MAKE_VERSION) $(need)))) -GRANDP = ../../../ -ARCH_COMP := $(HB_ARCHITECTURE)/$(HB_COMPILER) -OBJ_BASE := obj -OBJ_DIR := $(OBJ_BASE)/$(ARCH_COMP) -OBJ_ARCH_DIR := $(OBJ_BASE)/$(HB_ARCHITECTURE) +# Don't indent this subroutine +define find_in_path +$(strip $(foreach dir,$(subst $(PTHSEP), ,$(PATH)),$(wildcard $(dir)/$(1)$(HB_HOST_BIN_EXT)))) +endef define check_host @@ -182,6 +181,12 @@ ifeq ($(HB_HOST_ARCH),) endif endif +ifneq ($(findstring $(HB_HOST_ARCH),win wce dos os2),) + HB_HOST_BIN_EXT := .exe +else + HB_HOST_BIN_EXT := +endif + ifeq ($(HB_BUILD_VERBOSE),yes) ifeq ($(ok),) $(info Detected host platform: $(HB_HOST_ARCH)) @@ -209,6 +214,123 @@ ifeq ($(HB_BUILD_VERBOSE),yes) endif endif +ifeq ($(HB_ARCHITECTURE),) + HB_ARCHITECTURE := $(HB_HOST_ARCH) + ifneq ($(findstring $(HB_COMPILER),msvcarm mingwarm poccarm),) + HB_ARCHITECTURE := wce + endif + export HB_ARCHITECTURE +endif +ifeq ($(HB_COMPILER),) + ifeq ($(HB_ARCHITECTURE),win) + ifneq ($(call find_in_path,arm-wince-mingw32ce-gcc),) + HB_COMPILER := mingwarm + HB_ARCHITECTURE := wce + export HB_CCPREFIX := arm-wince-mingw32ce- + else + ifneq ($(call find_in_path,arm-mingw32ce-gcc),) + HB_COMPILER := mingwarm + HB_ARCHITECTURE := wce + export HB_CCPREFIX := arm-mingw32ce- + else + ifneq ($(call find_in_path,cygstart),) + HB_COMPILER := cygwin + else + ifneq ($(call find_in_path,gcc),) + HB_COMPILER := mingw + else + ifneq ($(call find_in_path,wpp386),) + HB_COMPILER := watcom + else + ifneq ($(call find_in_path,ml64),) + HB_COMPILER := msvc64 + else + ifneq ($(call find_in_path,icl),) + HB_COMPILER := icc + else + ifneq ($(call find_in_path,cl),) + HB_COMPILER := msvc + else + ifneq ($(call find_in_path,bcc32),) + HB_COMPILER := bcc + else + ifneq ($(call find_in_path,pocc),) + HB_COMPILER := pocc + else + ifneq ($(call find_in_path,xcc),) + HB_COMPILER := xcc + else + ifneq ($(call find_in_path,x86_64-w64-mingw32-gcc),) + HB_COMPILER := mingw64 + export HB_CCPREFIX := x86_64-w64-mingw32- + endif + endif + endif + endif + endif + endif + endif + endif + endif + endif + endif + endif + else + ifeq ($(HB_ARCHITECTURE),linux) + ifneq ($(call find_in_path,wpp386),) + HB_COMPILER := watcom + else + ifneq ($(call find_in_path,gcc),) + HB_COMPILER := gcc + endif + endif + else + ifeq ($(HB_ARCHITECTURE),sunos) + ifneq ($(call find_in_path,cc),) + HB_COMPILER := sunpro + else + ifneq ($(call find_in_path,gcc),) + HB_COMPILER := gcc + endif + endif + else + ifeq ($(HB_ARCHITECTURE),dos) + ifneq ($(call find_in_path,gcc),) + HB_COMPILER := djgpp + else + ifneq ($(call find_in_path,wpp386),) + HB_COMPILER := watcom + endif + endif + else + ifeq ($(HB_ARCHITECTURE),os2) + ifneq ($(call find_in_path,gcc),) + HB_COMPILER := gcc + else + ifneq ($(call find_in_path,wpp386),) + HB_COMPILER := watcom + endif + endif + else + # add other platforms here + endif + endif + endif + endif + endif + $(info Autodetected HB_COMPILER: $(HB_COMPILER)) + export HB_COMPILER +endif + +GRANDP = ../../../ +ARCH_COMP := $(HB_ARCHITECTURE)/$(HB_COMPILER) +ifneq ($(HB_BUILD_SUBDIR),) + ARCH_COMP += /$(subst \,/,$(HB_BUILD_SUBDIR)) +endif +OBJ_BASE := obj +OBJ_DIR := $(OBJ_BASE)/$(ARCH_COMP) +OBJ_ARCH_DIR := $(OBJ_BASE)/$(HB_ARCHITECTURE) + # TODO: Set this in /.cf HB_CPU := ifeq ($(HB_ARCHITECTURE),win) @@ -247,12 +369,6 @@ else HB_UNIX_COMPATIBLE := yes endif -ifneq ($(findstring $(HB_HOST_ARCH),win wce dos os2),) - HB_HOST_BIN_EXT := .exe -else - HB_HOST_BIN_EXT := -endif - ifeq ($(HB_BUILD_VERBOSE),yes) ifeq ($(ok),) $(info Detected host executable extension: $(HB_HOST_BIN_EXT)) @@ -373,7 +489,7 @@ ifneq ($(HB_DB_DRVEXT),) endif ifeq ($(HB_UNIX_COMPATIBLE),no) - LIBPOSTFIX := $(DIRSEP)$(HB_ARCHITECTURE)$(DIRSEP)$(HB_COMPILER) + LIBPOSTFIX := $(DIRSEP)$(subst /,$(DIRSEP),$(ARCH_COMP)) endif ifeq ($(HB_BIN_INSTALL),) diff --git a/harbour/config/header.cf b/harbour/config/header.cf index 1ab1ea02c8..8b102318a9 100644 --- a/harbour/config/header.cf +++ b/harbour/config/header.cf @@ -2,11 +2,11 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf + ifneq ($(HB_ARCHITECTURE),) ifneq ($(HB_COMPILER),) -include $(TOP)$(ROOT)config/global.cf - ALL_HEADERS = $(C_HEADERS) $(PRG_HEADERS) $(API_HEADERS) first:: diff --git a/harbour/config/lib.cf b/harbour/config/lib.cf index 4a50d2cbc9..02280b5849 100644 --- a/harbour/config/lib.cf +++ b/harbour/config/lib.cf @@ -2,15 +2,16 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf + ifneq ($(HB_ARCHITECTURE),) ifneq ($(HB_COMPILER),) # no slash at the end LIB_ARCH_DIR := $(TOP)$(ROOT)lib/$(HB_ARCHITECTURE) # no slash at the end -LIB_DIR := $(LIB_ARCH_DIR)/$(HB_COMPILER) +LIB_DIR := $(TOP)$(ROOT)lib/$(ARCH_COMP) -include $(TOP)$(ROOT)config/global.cf include $(TOP)$(ROOT)config/c.cf include $(TOP)$(ROOT)config/prg.cf @@ -19,7 +20,7 @@ LIB_NAME := $(LIB_PREF)$(LIBNAME)$(LIB_EXT) LIB_FILE := $(LIB_DIR)/$(LIB_NAME) ifeq ($(HB_SHELL),os2) -EXE_ARCH_DIR := $(TOP)$(ROOT)bin/$(HB_ARCHITECTURE) + EXE_ARCH_DIR := $(TOP)$(ROOT)bin/$(HB_ARCHITECTURE) endif EXE_DIR := $(TOP)$(ROOT)bin/$(ARCH_COMP) diff --git a/harbour/config/none.cf b/harbour/config/none.cf index f68491c595..579ffd8777 100644 --- a/harbour/config/none.cf +++ b/harbour/config/none.cf @@ -2,11 +2,11 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf + ifneq ($(HB_ARCHITECTURE),) ifneq ($(HB_COMPILER),) -include $(TOP)$(ROOT)config/global.cf - ifneq ($(LIBNAME),) DIR_RULE := @$(CMDPREF)echo "The '$(LIBNAME)' library ignored." else diff --git a/harbour/config/os2-mkdir.exe b/harbour/config/os2-mkdir.exe new file mode 100644 index 0000000000..fd14ae0b72 Binary files /dev/null and b/harbour/config/os2-mkdir.exe differ diff --git a/harbour/config/rules.cf b/harbour/config/rules.cf index 9b6a9c5fd3..4e1815aeaf 100644 --- a/harbour/config/rules.cf +++ b/harbour/config/rules.cf @@ -42,37 +42,26 @@ ifeq ($(LD_RULE),) LD_RULE = $(LD) $(CFLAGS) $(LD_OUT)$(subst /,$(DIRSEP),$(EXE_DIR)/$@) $(^F) $(LDFLAGS) $(HB_USER_LDFLAGS) $(LINKLIBS) endif - # Eliminate these rules. - %.c : %.y %.c : %.l -# Location of source C files -# Some DOS compilers doesn't like '/' in filenames - however the MAKE system -# requires '/' in filenames - this trick allows to solve this conflict -SOURCE_DIR := $($(HB_ARCHITECTURE)_$(HB_COMPILER)_GRANDP) -ifeq ($(SOURCE_DIR),) -SOURCE_DIR = $(GRANDP) -endif - # Rule to generate an object file from a C source file in the parent. -%$(OBJ_EXT) : $(SOURCE_DIR)%.c +%$(OBJ_EXT) : $(GRANDP)%.c $(CC_RULE) # Rule to generate an object file from a C source file. %$(OBJ_EXT) : %.c $(CC_RULE) -#rules for CPP files -%$(OBJ_EXT) : $(SOURCE_DIR)%.cpp +# Rules for CPP files +%$(OBJ_EXT) : $(GRANDP)%.cpp $(CPP_RULE) %$(OBJ_EXT) : %.cpp $(CPP_RULE) - # Rule to generate an executable file from an object file. %$(EXE_EXT) : %$(OBJ_EXT) $(LD_RULE) diff --git a/harbour/config/test.cf b/harbour/config/test.cf index 679ef6b90d..0dc42ace61 100644 --- a/harbour/config/test.cf +++ b/harbour/config/test.cf @@ -2,10 +2,11 @@ # $Id$ # +include $(TOP)$(ROOT)config/global.cf + ifneq ($(HB_ARCHITECTURE),) ifneq ($(HB_COMPILER),) -include $(TOP)$(ROOT)config/global.cf include $(TOP)$(ROOT)config/prg.cf first:: dirbase ^^^d^e^s^c^e^n^d^^^ diff --git a/harbour/examples/superlib/superlib.dif b/harbour/examples/superlib/superlib.dif index deceb88465..23cf74e6ad 100644 --- a/harbour/examples/superlib/superlib.dif +++ b/harbour/examples/superlib/superlib.dif @@ -1,15 +1,20 @@ diff -u superori/between.c superpat/between.c --- superori/between.c 1993-08-19 10:28:38.000000000 +0200 -+++ superpat/between.c 2009-06-18 07:36:43.000000000 +0200 -@@ -14,7 +14,7 @@ ++++ superpat/between.c 2009-08-01 11:37:11.000000000 +0200 +@@ -14,10 +14,10 @@ #include "extend.h" -CLIPPER takeout() +HB_FUNC( TAKEOUT ) { - char *string; - char *delim; +- char *string; +- char *delim; ++ const char *string; ++ const char *delim; + char *result; + char *empty = 0; + @@ -63,7 +63,7 @@ if (strend >= strstart && (fnd)) { @@ -168,16 +173,19 @@ diff -u superori/mline.c superpat/mline.c } diff -u superori/nextls.c superpat/nextls.c --- superori/nextls.c 1993-09-27 09:42:08.000000000 +0100 -+++ superpat/nextls.c 2009-06-18 07:36:11.000000000 +0200 -@@ -2,7 +2,7 @@ ++++ superpat/nextls.c 2009-08-01 11:37:43.000000000 +0200 +@@ -2,9 +2,9 @@ /*ÄÄÄÄÄÄÄÄÄÄget next line, return nil if noneÄÄÄÄÄÄÄÄÄÄÄÄ*/ -CLIPPER nextls() +HB_FUNC( NEXTLS ) { - char *string = _parc(1); +- char *string = _parc(1); ++ const char *string = _parc(1); unsigned int strlen = _parclen(1); + int offset = _parni(2); + char a141 = 141; diff -u superori/r_hcode.prg superpat/r_hcode.prg --- superori/r_hcode.prg 1993-10-08 11:30:40.000000000 +0100 +++ superpat/r_hcode.prg 2009-06-10 08:44:26.000000000 +0200 @@ -1212,16 +1220,19 @@ diff -u superori/s_scmod.prg superpat/s_scmod.prg if cTempFile==cAlias diff -u superori/s_scrbuf.c superpat/s_scrbuf.c --- superori/s_scrbuf.c 1992-11-02 17:15:40.000000000 +0100 -+++ superpat/s_scrbuf.c 2009-06-18 07:35:03.000000000 +0200 -@@ -1,7 +1,7 @@ ++++ superpat/s_scrbuf.c 2009-08-01 11:38:22.000000000 +0200 +@@ -1,9 +1,9 @@ #include "extend.h" -CLIPPER getscrow() +HB_FUNC( GETSCROW ) { - char *inscreenstring; /* saved screen */ +- char *inscreenstring; /* saved screen */ ++ const char *inscreenstring; /* saved screen */ char *ret_scr; + + int top,left,bottom,right,i; @@ -20,7 +20,7 @@ getrow = _parni(6)-1; top = top*80; @@ -1231,15 +1242,18 @@ diff -u superori/s_scrbuf.c superpat/s_scrbuf.c for(i=getrow*cols*2; i< (getrow+1)*cols*2;i++) ret_scr[count++] = inscreenstring[i]; -@@ -28,7 +28,7 @@ +@@ -28,9 +28,9 @@ _xfree(ret_scr); } -CLIPPER getsccol() +HB_FUNC( GETSCCOL ) { - char *inscreenstring; /* saved screen */ +- char *inscreenstring; /* saved screen */ ++ const char *inscreenstring; /* saved screen */ char *ret_scr; + + int top,left,bottom,right,i; @@ -47,7 +47,7 @@ rows = bottom-top+1; getcol = _parni(6)-1; @@ -1249,15 +1263,20 @@ diff -u superori/s_scrbuf.c superpat/s_scrbuf.c lastcol = (cols*(rows-1)+(getcol)+1)*2 ; for(i=getcol*2; i< lastcol ;i+=(cols*2)) -@@ -60,7 +60,7 @@ +@@ -60,10 +60,10 @@ } -CLIPPER ssprinkle() +HB_FUNC( SSPRINKLE ) { - char *oldscreen; /* saved screen */ - char *newscreen; +- char *oldscreen; /* saved screen */ +- char *newscreen; ++ const char *oldscreen; /* saved screen */ ++ const char *newscreen; + char *outscreen; + + int every,scrlen,i,columns,attpos,charpos; @@ -74,7 +74,7 @@ every = _parni(3); scrlen = _parclen(1); diff --git a/harbour/make_gnu.bat b/harbour/make_gnu.bat index 07bf522eb2..54986e6d72 100644 --- a/harbour/make_gnu.bat +++ b/harbour/make_gnu.bat @@ -39,6 +39,8 @@ if "%HB_COMPILER%" == "" set HB_COMPILER=djgpp if not "%OS%" == "Windows_NT" goto HELP rem Order is significant + call :COMP_DET_ONE arm-wince-mingw32ce-gcc.exe mingwarm wce arm-wince-mingw32ce- + call :COMP_DET_ONE arm-mingw32ce-gcc.exe mingwarm wce arm-mingw32ce- call :COMP_DET_ONE cygstart.exe cygwin win call :COMP_DET_ONE gcc.exe mingw win call :COMP_DET_ONE wpp386.exe watcom win @@ -49,8 +51,6 @@ if "%HB_COMPILER%" == "" set HB_COMPILER=djgpp call :COMP_DET_ONE pocc.exe pocc win call :COMP_DET_ONE xcc.exe xcc win call :COMP_DET_ONE x86_64-w64-mingw32-gcc.exe mingw64 win x86_64-w64-mingw32- - call :COMP_DET_ONE arm-wince-mingw32ce-gcc.exe mingwarm wce arm-wince-mingw32ce- - call :COMP_DET_ONE arm-mingw32ce-gcc.exe mingwarm wce arm-mingw32ce- if "%HB_COMPILER%" == "" ( echo HB_COMPILER couldn't be automatically determined. && goto HELP ) diff --git a/harbour/source/rtl/hbinet.c b/harbour/source/rtl/hbinet.c index 138055d4dc..8310132dfe 100644 --- a/harbour/source/rtl/hbinet.c +++ b/harbour/source/rtl/hbinet.c @@ -317,7 +317,8 @@ HB_FUNC( HB_INETERRORDESC ) case HB_INET_ERR_CLOSEDCONN : hb_retc_const( "Connection closed" ); return; case HB_INET_ERR_CLOSEDSOCKET : hb_retc_const( "Closed socket" ); return; case HB_INET_ERR_BUFFOVERRUN : hb_retc_const( "Buffer overrun" ); return; - default: hb_retc_const( hb_socketErrorStr( socket->iErrorCode ) ); + default: + hb_retc( hb_socketErrorStr( socket->iErrorCode ) ); } } else