diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 57ab6b7485..5d7d2d1265 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,30 @@ +19990716-20:00 EDT David G. Holm + * config/rules.cf + + Added ifeq section for BCC, which requires that the output + file be listed ahead of the input file on the command line + (at least for version 3.1) + + config/dos/bcc31.cf + + New GNU Make System module for Borland C++ 3.1 + (adapted from original config/win32/bcc32.cf) + * config/dos/global.cf + + Added 'if not exist' to both 'dirbase::' commands + + Added 'if exist' to all deletes of a single file type + * config/win32/bcc32.cf + * Applied several changes from config/dos/bcc31.cf, + but remains untested + * doc/gmake.txt + + Added dos/bcc31 + * source/hbpp/hbpp.c + ! Temporary fix to avoid an incorrect "Cycled #define" error + * source/hbpp/hbppint.c + ! Use of exit() warrants inclusion of stdlib.h for all compilers + * source/rtl/environ.c + + Added RUN() support for MSC, IBMCPP, and GCC for OS/2 + * tests/working/dosshell.prg + + Added support for OS/2 + * tests/working/procline.prg + - Removed unneeded 'local a' that I accidentally left in earlier + Fri Jul 16 17:53:35 1999 Gonzalo A. Diethelm * source/rtl/gt/gtwin.c: diff --git a/harbour/config/dos/bcc31.cf b/harbour/config/dos/bcc31.cf new file mode 100644 index 0000000000..252dbf62b2 --- /dev/null +++ b/harbour/config/dos/bcc31.cf @@ -0,0 +1,71 @@ +# +# $Id$ +# +# The Harbour Project +# GNU MAKE file for Borland C/C++ 3.1 + +include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf + +OBJ_EXT = .obj +EXE_EXT = .exe +LIB_PREF = +LIB_EXT = .lib + +$(HB_ARCHITECTURE)_$(HB_COMPILER)_GRANDP = $(subst /,\\,$(GRANDP)) +_HB_INC_COMPILE = $(subst /,\\,$(HB_INC_COMPILE)) +_HL = $(notdir $(HB_LIB_COMPILE)) +ifeq ($(_HL),) +#there is an ending slash +_HB_LIB_COMPILE = $(subst /,\\,$(HB_LIB_COMPILE)) +else +_HB_LIB_COMPILE = $(subst /,\\,$(HB_LIB_COMPILE)/) +endif + +CC = bcc +CC_IN = -c +CC_OUT = -o +CPPFLAGS = -I$($(HB_ARCHITECTURE)_$(HB_COMPILER)_GRANDP) -I$(_HB_INC_COMPILE) +CFLAGS = -O2 -mh + +#Note: The empty line below HAVE TO exist! +define link_file +echo $(file) >> __link__.tmp + +endef + + +define link_exe_file +echo $(LDFLAGS) -e$@ > __link__.tmp +$(foreach file, $^, $(link_file)) +$(foreach file, $(LINKLIBS), $(link_file)) +-$(LD) @__link__.tmp +endef + +LD = bcc +LDFLAGS = -O2 -mh +ifeq ($(HB_LIB_COMPILE),) +LINKLIBS = $(foreach lib, $(LIBS), $(TOP)$(ROOT)source/$(lib)/$(ARCH)/$(lib)$(LIB_EXT)) +else +LINKLIBS = $(foreach lib, $(LIBS), $(lib)$(LIB_EXT)) +endif +LD_RULE = $(link_exe_file) + +#Note: The empty line below HAVE TO exist! +define lib_object +echo -+$(file) &>> __lib__.tmp + +endef + +define create_library +echo $@ &> __lib__.tmp +$(foreach file, $^, $(lib_object)) +echo ,, >> __lib__.tmp +$(AR) @__lib__.tmp +del __lib__.tmp +endef + +AR = tlib +ARFLAGS = +AR_RULE = $(create_library) + +include $(TOP)$(ROOT)config/rules.cf diff --git a/harbour/config/dos/global.cf b/harbour/config/dos/global.cf index 8ebe6b2185..0da5d83037 100644 --- a/harbour/config/dos/global.cf +++ b/harbour/config/dos/global.cf @@ -34,6 +34,6 @@ clean:: -if exist *.obj $(RM) *.obj -if exist core $(RM) core -if exist *.o $(RM) *.o - -if exist $(ARCH_DOS) $(RD) $(ARCH_DOS) - -if exist $(HB_ARCHITECTURE) $(RD) $(HB_ARCHITECTURE) + -$(RD) $(ARCH_DOS) + -$(RD) $(HB_ARCHITECTURE) endif \ No newline at end of file diff --git a/harbour/config/rules.cf b/harbour/config/rules.cf index d371b79880..bcdd9224f4 100644 --- a/harbour/config/rules.cf +++ b/harbour/config/rules.cf @@ -42,6 +42,16 @@ ifeq ($(SOURCE_DIR),) SOURCE_DIR = $(GRANDP) endif +# BCC (at least version 3.1) requires that the output file be listed ahead of the input file +ifeq ($(CC),bcc) +# Rule to generate an object file from a C source file in the parent. +%$(OBJ_EXT) : $(SOURCE_DIR)%.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_OUT)$(subst .c,$(OBJ_EXT),$(subst $(SOURCE_DIR),,$?)) $(CC_IN) $? + +# Rule to generate an object file from a C source file. +%$(OBJ_EXT) : %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_OUT)$(?:.c=$(OBJ_EXT)) $(CC_IN) $? +else # Rule to generate an object file from a C source file in the parent. %$(OBJ_EXT) : $(SOURCE_DIR)%.c $(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_IN) $? $(CC_OUT)$(subst .c,$(OBJ_EXT),$(subst $(SOURCE_DIR),,$?)) @@ -49,6 +59,7 @@ endif # Rule to generate an object file from a C source file. %$(OBJ_EXT) : %.c $(CC) $(CPPFLAGS) $(CFLAGS) $(C_USR) $(CC_IN) $? $(CC_OUT)$(?:.c=$(OBJ_EXT)) +endif # Rule to generate an executable file from an object file. %$(EXE_EXT) : %$(OBJ_EXT) diff --git a/harbour/config/win32/bcc32.cf b/harbour/config/win32/bcc32.cf index cbe71c3bf2..38b29ca527 100644 --- a/harbour/config/win32/bcc32.cf +++ b/harbour/config/win32/bcc32.cf @@ -3,8 +3,6 @@ # # The Harbour Project # GNU MAKE file for Borland C/C++ Builder -# -# This code is NOT TESTED yet! (19990711) include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf @@ -18,16 +16,16 @@ _HB_INC_COMPILE = $(subst /,\\,$(HB_INC_COMPILE)) _HL = $(notdir $(HB_LIB_COMPILE)) ifeq ($(_HL),) #there is an ending slash -_HB_LIB_COMPILE = $(subst /,\,$(HB_LIB_COMPILE)) +_HB_LIB_COMPILE = $(subst /,\\,$(HB_LIB_COMPILE)) else -_HB_LIB_COMPILE = $(subst /,\,$(HB_LIB_COMPILE)/) +_HB_LIB_COMPILE = $(subst /,\\,$(HB_LIB_COMPILE)/) endif CC = bcc32 CC_IN = -c CC_OUT = -o -CPPFLAGS = -O2 -CFLAGS = -i. -i$(_HB_INC_COMPILE) +CPPFLAGS = -I$($(HB_ARCHITECTURE)_$(HB_COMPILER)_GRANDP) -I$(_HB_INC_COMPILE) +CFLAGS = -O2 #Note: The empty line below HAVE TO exist! define link_file @@ -43,20 +41,25 @@ $(COMSPEC) /E:2048 /Cecho $(LINKLIBS) >> __link__.tmp -$(LD) @__link__.tmp endef -LD = bcc32 +LD = bcc LDFLAGS = -O2 -LINKLIBS = $(foreach lib, $(LIBS), $(_HB_LIB_COMPILE)$(lib)) +ifeq ($(HB_LIB_COMPILE),) +LINKLIBS = $(foreach lib, $(LIBS), $(TOP)$(ROOT)source/$(lib)/$(ARCH)/$(lib)$(LIB_EXT)) +else +LINKLIBS = $(foreach lib, $(LIBS), $(lib)$(LIB_EXT)) +endif LD_RULE = $(link_exe_file) #Note: The empty line below HAVE TO exist! define lib_object -echo -+$(file) >> __lib__.tmp +echo -+$(file) &>> __lib__.tmp endef define create_library -echo $@ > __lib__.tmp +echo $@ &> __lib__.tmp $(foreach file, $^, $(lib_object)) +echo ,, >> __lib__.tmp $(AR) @__lib__.tmp del __lib__.tmp endef @@ -66,4 +69,3 @@ ARFLAGS = AR_RULE = $(create_library) include $(TOP)$(ROOT)config/rules.cf - diff --git a/harbour/doc/gmake.txt b/harbour/doc/gmake.txt index 01282d6cc7..69aa7defe9 100644 --- a/harbour/doc/gmake.txt +++ b/harbour/doc/gmake.txt @@ -157,6 +157,10 @@ For IBM Visual Age C++ on OS/2: HB_ARCHITECTURE os2 HB_COMPILER icc +For Borland C++ 3.1 + HB_ARCHITECTURE dos + HB_COMPILER bcc31 + For DJGPP (GCC port for DOS) HB_ARCHITECTURE dos HB_COMPILER djgpp diff --git a/harbour/source/hbpp/hbpp.c b/harbour/source/hbpp/hbpp.c index 858367109d..b695beae72 100644 --- a/harbour/source/hbpp/hbpp.c +++ b/harbour/source/hbpp/hbpp.c @@ -544,11 +544,11 @@ int ParseExpression( char* sLine, char* sOutLine ) if ( (stdef=DefSearch(sToken)) != NULL ) { for(i=0;i #if defined(__GNUC__) #include - #include #else #if (defined(_MSC_VER) || defined(__IBMCPP__) || defined(__WATCOMC__)) #include - #include #else #include #include diff --git a/harbour/source/rtl/environ.c b/harbour/source/rtl/environ.c index 6212c8d328..41eea9bc42 100644 --- a/harbour/source/rtl/environ.c +++ b/harbour/source/rtl/environ.c @@ -263,7 +263,7 @@ HARBOUR HB_GETENV(void) */ HARBOUR HB___RUN( void ) { -#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__DJGPP__) +#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__DJGPP__) || defined(__MSC__) || defined(_MSC_VER) || defined(__IBMCPP__) || defined(HARBOUR_GCC_OS2) if( hb_pcount() == 1 ) /* Parameter passed */ { system( hb_parc( 1 ) ); diff --git a/harbour/tests/working/dosshell.prg b/harbour/tests/working/dosshell.prg index 08ff122faa..bf64ed03d2 100644 --- a/harbour/tests/working/dosshell.prg +++ b/harbour/tests/working/dosshell.prg @@ -21,11 +21,12 @@ function Main() local cOs := Upper( OS() ) local cShell := GetEnv("COMSPEC") - if (at( "WINDOWS", cOs ) != 0) .or. at( "DOS", cOs ) != 0 + if at( "WINDOWS", cOs ) != 0 .or. at( "DOS", cOs ) != 0 ; + .or. at( "OS/2", cOs ) != 0 ? "About to shell to DOS.." ! (cShell) ? "Hey, I am back !" else - ? "Sorry this program is for Windows and DOS only" + ? "Sorry this program is for Windows, DOS, and OS/2 only" endif return nil diff --git a/harbour/tests/working/procline.prg b/harbour/tests/working/procline.prg index f5d7196f30..cd92464a09 100644 --- a/harbour/tests/working/procline.prg +++ b/harbour/tests/working/procline.prg @@ -4,7 +4,7 @@ FUNCTION Main() -local a + ? "hello 1", ProcLine(), "Expected: ", 8 ? "hello 2", ProcLine(), "Expected: ", 10