Update Borland makefile and improve MSC makefile - Mailing list pgsql-patches

From Bruce Momjian
Subject Update Borland makefile and improve MSC makefile
Date
Msg-id 200504290424.j3T4OJL23249@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
The following applied patch allows Borland C to build libpq, and
improves the structure of the MSC makefile.  I almost got BCC to build
psql but got an error with popen() which I could not find a fix.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/bin/psql/bcc32.mak
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/bcc32.mak,v
retrieving revision 1.12
diff -c -c -r1.12 bcc32.mak
*** src/bin/psql/bcc32.mak    28 Sep 2004 16:17:26 -0000    1.12
--- src/bin/psql/bcc32.mak    29 Apr 2005 04:17:41 -0000
***************
*** 1,6 ****
  # Makefile for Borland C++ 5.5
  # Borland C++ base install directory goes here
! # BCB=d:\Borland\Bcc55

  !MESSAGE Building PSQL.EXE ...
  !MESSAGE
--- 1,17 ----
  # Makefile for Borland C++ 5.5
+
  # Borland C++ base install directory goes here
! # BCB=c:\Borland\Bcc55
!
! !IF "$(BCB)" == ""
! !MESSAGE You must edit bcc32.mak and define BCB at the top
! !ERROR missing BCB
! !ENDIF
!
! !IF "$(__NMAKE__)" == ""
! !MESSAGE You must use the -N compatibility flag, e.g. make -N -f bcc32.make
! !ERROR missing -N
! !ENDIF

  !MESSAGE Building PSQL.EXE ...
  !MESSAGE
***************
*** 19,25 ****
  !MESSAGE You can specify a configuration when running MAKE
  !MESSAGE by defining the macro CFG on the command line. For example:
  !MESSAGE
! !MESSAGE make  -DCFG=[Release | Debug] /f bcc32.mak
  !MESSAGE
  !MESSAGE Possible choices for configuration are:
  !MESSAGE
--- 30,36 ----
  !MESSAGE You can specify a configuration when running MAKE
  !MESSAGE by defining the macro CFG on the command line. For example:
  !MESSAGE
! !MESSAGE make -N -DCFG=[Release | Debug] -f bcc32.mak
  !MESSAGE
  !MESSAGE Possible choices for configuration are:
  !MESSAGE
***************
*** 49,58 ****
  !endif
  REFDOCDIR=../../../doc/src/sgml/ref

  .path.obj = $(INTDIR)

! .c.obj:
!     $(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<

  ALL : sql_help.h psqlscan.c "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe"

--- 60,88 ----
  !endif
  REFDOCDIR=../../../doc/src/sgml/ref

+ CPP_PROJ = -I$(BCB)\include;..\..\include;..\..\interfaces\libpq;..\..\include\port\win32 \
+            -c -D$(USERDEFINES) -DFRONTEND -n"$(INTDIR)" -tWM -tWC -q -5 -a8 -pc -X -w-use \
+        -w-par -w-pia -w-csu -w-aus -w-ccc
+
+ !IFDEF DEBUG
+ CPP_PROJ      = $(CPP_PROJ) -Od -r- -k -v -y -vi- -D_DEBUG
+ LIBPG_DIR     = Debug
+ !ELSE
+ CPP_PROJ    = $(CPP_PROJ) -O -Oi -OS -DNDEBUG
+ LIBPG_DIR     = Release
+ !ENDIF
+
+ !IFDEF DLL_LIBS
+ CPP_PROJ    = $(CPP_PROJ) -D_RTLDLL
+ LIBRARIES    = cw32mti.lib ..\..\interfaces\libpq\$(LIBPG_DIR)\blibpqdll.lib
+ !ELSE
+ CPP_PROJ    = $(CPP_PROJ) -DBCC32_STATIC
+ LIBRARIES    = cw32mt.lib ..\..\interfaces\libpq\$(LIBPG_DIR)\blibpq.lib
+ !ENDIF
+
  .path.obj = $(INTDIR)

! USERDEFINES = WIN32;_CONSOLE;_MBCS;HAVE_STRDUP

  ALL : sql_help.h psqlscan.c "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe"

***************
*** 86,153 ****
      -@erase "$(OUTDIR)\psql.exe"
      -@erase "$(INTDIR)\..\..\port\pg_config_paths.h"

! "..\..\port\pg_config_paths.h": win32.mak
!     echo #define PGBINDIR "" >$@
!     echo #define PGSHAREDIR "" >>$@
!     echo #define SYSCONFDIR "" >>$@
!     echo #define INCLUDEDIR "" >>$@
!     echo #define PKGINCLUDEDIR "" >>$@
!     echo #define INCLUDEDIRSERVER "" >>$@
!     echo #define LIBDIR "" >>$@
!     echo #define PKGLIBDIR "" >>$@
!     echo #define LOCALEDIR "" >>$@
!
! "$(OUTDIR)" :
!     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
!
! USERDEFINES = WIN32;_CONSOLE;_MBCS;HAVE_STRDUP
!
! # ---------------------------------------------------------------------------
! CPP_PROJ = -I$(BCB)\include;..\..\include;..\..\interfaces\libpq;..\..\include\port\win32 \
!            -c -D$(USERDEFINES) -DFRONTEND -tWM -tWC -q -5 -a8 -pc -X -w-use -w-par -w-pia \
!        -w-csu -w-aus -w-ccc

  !IFDEF DEBUG
! CPP_PROJ      = $(CPP_PROJ) -Od -r- -k -v -y -vi- -D_DEBUG
! LIBPG_DIR     = Debug
  !ELSE
! CPP_PROJ    = $(CPP_PROJ) -O -Oi -OS -DNDEBUG
! LIBPG_DIR     = Release
  !ENDIF

! !IFDEF DLL_LIBS
! CPP_PROJ    = $(CPP_PROJ) -D_RTLDLL
! LIBRARIES    = cw32mti.lib ..\..\interfaces\libpq\$(LIBPG_DIR)\blibpqdll.lib
! !ELSE
! CPP_PROJ    = $(CPP_PROJ) -DBCC32_STATIC
! LIBRARIES    = cw32mt.lib ..\..\interfaces\libpq\$(LIBPG_DIR)\blibpq.lib
! !ENDIF

! LINK32=ilink32.exe
! LINK32_FLAGS=-L$(BCB)\lib;.\$(LIBPG_DIR) -x -v
! LINK32_OBJS= \
!     command.obj \
!     common.obj \
!     copy.obj \
!     describe.obj \
!     help.obj \
!     input.obj \
!     large_obj.obj \
!     mainloop.obj \
!     mbprint.obj
!     print.obj \
!     prompt.obj \
!     startup.obj \
!     stringutils.obj \
!     tab-complete.obj \
!     variables.obj \
!     exec.obj \
!     getopt.obj \
!     getopt_long.obj \
!     path.obj \
!     pgstrcasecmp.obj \
!     sprompt.obj \
!

  "$(OUTDIR)\psql.exe" : "$(OUTDIR)" $(LINK32_OBJS)
      $(LINK32) @&&!
--- 116,166 ----
      -@erase "$(OUTDIR)\psql.exe"
      -@erase "$(INTDIR)\..\..\port\pg_config_paths.h"

! LINK32=ilink32.exe
! LINK32_FLAGS=-L$(BCB)\lib;.\$(LIBPG_DIR) -x -v
! LINK32_OBJS= \
!     "$(INTDIR)\command.obj" \
!     "$(INTDIR)\common.obj" \
!     "$(INTDIR)\copy.obj" \
!     "$(INTDIR)\describe.obj" \
!     "$(INTDIR)\help.obj" \
!     "$(INTDIR)\input.obj" \
!     "$(INTDIR)\large_obj.obj" \
!     "$(INTDIR)\mainloop.obj" \
!     "$(INTDIR)\mbprint.obj" \
!     "$(INTDIR)\print.obj" \
!     "$(INTDIR)\prompt.obj" \
!     "$(INTDIR)\psqlscan.obj" \
!     "$(INTDIR)\startup.obj" \
!     "$(INTDIR)\stringutils.obj" \
!     "$(INTDIR)\tab-complete.obj" \
!     "$(INTDIR)\variables.obj" \
!     "$(INTDIR)\exec.obj" \
!     "$(INTDIR)\getopt.obj" \
!     "$(INTDIR)\getopt_long.obj" \
!     "$(INTDIR)\path.obj" \
!     "$(INTDIR)\pgstrcasecmp.obj" \
!     "$(INTDIR)\sprompt.obj"

  !IFDEF DEBUG
! LINK32_OBJS    = $(LINK32_OBJS) "..\..\interfaces\libpq\Debug\blibpqddll.lib"
  !ELSE
! LINK32_OBJS    = $(LINK32_OBJS) "..\..\interfaces\libpq\Release\blibpqdll.lib"
  !ENDIF

! "..\..\port\pg_config_paths.h": win32.mak
!     echo \#define PGBINDIR "" >$@
!     echo \#define PGSHAREDIR "" >>$@
!     echo \#define SYSCONFDIR "" >>$@
!     echo \#define INCLUDEDIR "" >>$@
!     echo \#define PKGINCLUDEDIR "" >>$@
!     echo \#define INCLUDEDIRSERVER "" >>$@
!     echo \#define LIBDIR "" >>$@
!     echo \#define PKGLIBDIR "" >>$@
!     echo \#define LOCALEDIR "" >>$@

! "$(OUTDIR)" :
!     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"

  "$(OUTDIR)\psql.exe" : "$(OUTDIR)" $(LINK32_OBJS)
      $(LINK32) @&&!
***************
*** 157,171 ****
      import32.lib $(LIBRARIES),,
  !

! exec.obj : "$(OUTDIR)" ..\..\port\exec.c
! getopt.obj : "$(OUTDIR)" ..\..\port\getopt.c
! getopt_long.obj : "$(OUTDIR)" ..\..\port\getopt_long.c
! path.obj : "$(OUTDIR)" ..\..\port\path.c
! pgstrcasecmp.obj : "$(OUTDIR)" ..\..\port\pgstrcasecmp.c
! sprompt.obj : "$(OUTDIR)" ..\..\port\sprompt.c

  "sql_help.h": create_help.pl
         $(PERL) create_help.pl $(REFDOCDIR) $@

  psqlscan.c : psqlscan.l
      $(FLEX) -Cfe -opsqlscan.c psqlscan.l
--- 170,211 ----
      import32.lib $(LIBRARIES),,
  !

! "$(INTDIR)\exec.obj" : ..\..\port\exec.c
!     $(CPP) @<<
!     $(CPP_PROJ) ..\..\port\exec.c
! <<
!
! "$(INTDIR)\getopt.obj" : "$(INTDIR)" ..\..\port\getopt.c
!     $(CPP) @<<
!     $(CPP_PROJ) ..\..\port\getopt.c
! <<
!
! "$(INTDIR)\getopt_long.obj" : "$(INTDIR)" ..\..\port\getopt_long.c
!     $(CPP) @<<
!     $(CPP_PROJ) ..\..\port\getopt_long.c
! <<
!
! "$(INTDIR)\path.obj" : "$(INTDIR)" ..\..\port\path.c
!     $(CPP) @<<
!     $(CPP_PROJ) ..\..\port\path.c
! <<
!
! "$(INTDIR)\pgstrcasecmp.obj" : ..\..\port\pgstrcasecmp.c
!     $(CPP) @<<
!     $(CPP_PROJ) ..\..\port\pgstrcasecmp.c
! <<
!
! "$(INTDIR)\sprompt.obj" : "$(INTDIR)" ..\..\port\sprompt.c
!     $(CPP) @<<
!     $(CPP_PROJ) ..\..\port\sprompt.c
! <<

  "sql_help.h": create_help.pl
         $(PERL) create_help.pl $(REFDOCDIR) $@

  psqlscan.c : psqlscan.l
      $(FLEX) -Cfe -opsqlscan.c psqlscan.l
+
+ .c.obj:
+     $(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<
+
Index: src/bin/psql/command.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.142
diff -c -c -r1.142 command.c
*** src/bin/psql/command.c    16 Mar 2005 21:27:23 -0000    1.142
--- src/bin/psql/command.c    29 Apr 2005 04:17:42 -0000
***************
*** 8,13 ****
--- 8,17 ----
  #include "postgres_fe.h"
  #include "command.h"

+ #ifdef WIN32_CLIENT_ONLY    /* needed for BCC */
+ #undef mkdir
+ #endif
+
  #include <errno.h>
  #include <ctype.h>
  #ifdef HAVE_PWD_H
Index: src/bin/psql/startup.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/startup.c,v
retrieving revision 1.113
diff -c -c -r1.113 startup.c
*** src/bin/psql/startup.c    22 Feb 2005 04:40:58 -0000    1.113
--- src/bin/psql/startup.c    29 Apr 2005 04:17:42 -0000
***************
*** 19,25 ****
  #include "getopt_long.h"

  #ifndef HAVE_INT_OPTRESET
! int            optreset;
  #endif

  #include <locale.h>
--- 19,25 ----
  #include "getopt_long.h"

  #ifndef HAVE_INT_OPTRESET
! extern int optreset;
  #endif

  #include <locale.h>
Index: src/bin/psql/win32.mak
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/win32.mak,v
retrieving revision 1.26
diff -c -c -r1.26 win32.mak
*** src/bin/psql/win32.mak    26 Jan 2005 19:24:00 -0000    1.26
--- src/bin/psql/win32.mak    29 Apr 2005 04:17:42 -0000
***************
*** 26,31 ****
--- 26,39 ----

  REFDOCDIR= ../../../doc/src/sgml/ref

+ CPP_PROJ=/nologo $(OPT) /W3 /GX /D "WIN32" $(DEBUGDEF) /D "_CONSOLE" /D\
+  "_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
+  /I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \
+  /D "HAVE_STRDUP" /D "FRONTEND"
+
+ CPP_OBJS=$(INTDIR)/
+ CPP_SBRS=.
+
  ALL : sql_help.h psqlscan.c "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe"

  CLEAN :
***************
*** 55,82 ****
      -@erase "$(OUTDIR)\psql.exe"
      -@erase "$(INTDIR)\..\..\port\pg_config_paths.h"

- "..\..\port\pg_config_paths.h": win32.mak
-     echo #define PGBINDIR "" >$@
-     echo #define PGSHAREDIR "" >>$@
-     echo #define SYSCONFDIR "" >>$@
-     echo #define INCLUDEDIR "" >>$@
-     echo #define PKGINCLUDEDIR "" >>$@
-     echo #define INCLUDEDIRSERVER "" >>$@
-     echo #define LIBDIR "" >>$@
-     echo #define PKGLIBDIR "" >>$@
-     echo #define LOCALEDIR "" >>$@
-
- "$(OUTDIR)" :
-     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
- CPP_PROJ=/nologo $(OPT) /W3 /GX /D "WIN32" $(DEBUGDEF) /D "_CONSOLE" /D\
-  "_MBCS" /Fp"$(INTDIR)\psql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
-  /I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \
-  /D "HAVE_STRDUP" /D "FRONTEND"
-
- CPP_OBJS=$(INTDIR)/
- CPP_SBRS=.
-
  LINK32=link.exe
  LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
   advapi32.lib shfolder.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
--- 63,68 ----
***************
*** 104,116 ****
      "$(INTDIR)\getopt_long.obj" \
      "$(INTDIR)\path.obj" \
      "$(INTDIR)\pgstrcasecmp.obj" \
!     "$(INTDIR)\sprompt.obj" \
  !IFDEF DEBUG
!     "..\..\interfaces\libpq\Debug\libpqddll.lib"
  !ELSE
!     "..\..\interfaces\libpq\Release\libpqdll.lib"
  !ENDIF

  "$(OUTDIR)\psql.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
      $(LINK32) @<<
    $(LINK32_FLAGS) $(LINK32_OBJS)
--- 90,117 ----
      "$(INTDIR)\getopt_long.obj" \
      "$(INTDIR)\path.obj" \
      "$(INTDIR)\pgstrcasecmp.obj" \
!     "$(INTDIR)\sprompt.obj"
!
  !IFDEF DEBUG
! LINK32_OBJS    = $(LINK32_OBJS) "..\..\interfaces\libpq\Debug\libpqddll.lib"
  !ELSE
! LINK32_OBJS    = $(LINK32_OBJS) "..\..\interfaces\libpq\Release\libpqdll.lib"
  !ENDIF

+ "..\..\port\pg_config_paths.h": win32.mak
+     echo \#define PGBINDIR "" >$@
+     echo \#define PGSHAREDIR "" >>$@
+     echo \#define SYSCONFDIR "" >>$@
+     echo \#define INCLUDEDIR "" >>$@
+     echo \#define PKGINCLUDEDIR "" >>$@
+     echo \#define INCLUDEDIRSERVER "" >>$@
+     echo \#define LIBDIR "" >>$@
+     echo \#define PKGLIBDIR "" >>$@
+     echo \#define LOCALEDIR "" >>$@
+
+ "$(OUTDIR)" :
+     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
  "$(OUTDIR)\psql.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
      $(LINK32) @<<
    $(LINK32_FLAGS) $(LINK32_OBJS)
***************
*** 121,137 ****
      $(CPP_PROJ) ..\..\port\exec.c
  <<

! "$(OUTDIR)\getopt.obj" : "$(OUTDIR)" ..\..\port\getopt.c
      $(CPP) @<<
      $(CPP_PROJ) ..\..\port\getopt.c
  <<

! "$(OUTDIR)\getopt_long.obj" : "$(OUTDIR)" ..\..\port\getopt_long.c
      $(CPP) @<<
      $(CPP_PROJ) ..\..\port\getopt_long.c
  <<

! "$(OUTDIR)\path.obj" : "$(OUTDIR)" ..\..\port\path.c
      $(CPP) @<<
      $(CPP_PROJ) ..\..\port\path.c
  <<
--- 122,138 ----
      $(CPP_PROJ) ..\..\port\exec.c
  <<

! "$(INTDIR)\getopt.obj" : "$(INTDIR)" ..\..\port\getopt.c
      $(CPP) @<<
      $(CPP_PROJ) ..\..\port\getopt.c
  <<

! "$(INTDIR)\getopt_long.obj" : "$(INTDIR)" ..\..\port\getopt_long.c
      $(CPP) @<<
      $(CPP_PROJ) ..\..\port\getopt_long.c
  <<

! "$(INTDIR)\path.obj" : "$(INTDIR)" ..\..\port\path.c
      $(CPP) @<<
      $(CPP_PROJ) ..\..\port\path.c
  <<
***************
*** 141,163 ****
      $(CPP_PROJ) ..\..\port\pgstrcasecmp.c
  <<

! "$(OUTDIR)\sprompt.obj" : "$(OUTDIR)" ..\..\port\sprompt.c
      $(CPP) @<<
      $(CPP_PROJ) ..\..\port\sprompt.c
  <<

  .c{$(CPP_OBJS)}.obj::
     $(CPP) @<<
     $(CPP_PROJ) $<
  <<

- .cpp{$(CPP_OBJS)}.obj::
-    $(CPP) @<<
-    $(CPP_PROJ) $<
- <<

- sql_help.h : create_help.pl
-         $(PERL) create_help.pl $(REFDOCDIR) $@
-
- psqlscan.c: psqlscan.l
-     $(FLEX) -Cfe -opsqlscan.c psqlscan.l
--- 142,161 ----
      $(CPP_PROJ) ..\..\port\pgstrcasecmp.c
  <<

! "$(INTDIR)\sprompt.obj" : "$(INTDIR)" ..\..\port\sprompt.c
      $(CPP) @<<
      $(CPP_PROJ) ..\..\port\sprompt.c
  <<

+ "sql_help.h" : create_help.pl
+         $(PERL) create_help.pl $(REFDOCDIR) $@
+
+ psqlscan.c : psqlscan.l
+     $(FLEX) -Cfe -opsqlscan.c psqlscan.l
+
  .c{$(CPP_OBJS)}.obj::
     $(CPP) @<<
     $(CPP_PROJ) $<
  <<


Index: src/interfaces/libpq/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v
retrieving revision 1.131
diff -c -c -r1.131 Makefile
*** src/interfaces/libpq/Makefile    25 Mar 2005 00:34:28 -0000    1.131
--- src/interfaces/libpq/Makefile    29 Apr 2005 04:17:43 -0000
***************
*** 145,151 ****
      rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h
$(DESTDIR)$(includedir_internal)/pqexpbuffer.h

  clean distclean: clean-lib
!     rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c
md5.cip.c encnames.c wchar.c pthread.h 

  maintainer-clean: distclean
      rm -f $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def $(srcdir)/libpq.rc
--- 145,152 ----
      rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h
$(DESTDIR)$(includedir_internal)/pqexpbuffer.h

  clean distclean: clean-lib
!     # pg_config_paths.h might be left over from a Win32 client-only build
!     rm -f $(OBJS) pg_config_paths.h crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c
open.cthread.c md5.c ip.c encnames.c wchar.c pthread.h 

  maintainer-clean: distclean
      rm -f $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def $(srcdir)/libpq.rc
Index: src/interfaces/libpq/bcc32.mak
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/bcc32.mak,v
retrieving revision 1.15
diff -c -c -r1.15 bcc32.mak
*** src/interfaces/libpq/bcc32.mak    7 Mar 2005 21:10:58 -0000    1.15
--- src/interfaces/libpq/bcc32.mak    29 Apr 2005 04:17:43 -0000
***************
*** 4,10 ****
  #        and a Win32 dynamic library libpq.dll with import library libpqdll.lib

  # Borland C++ base install directory goes here
! # BCB=d:\Borland\Bcc55

  !MESSAGE Building the Win32 DLL and Static Library...
  !MESSAGE
--- 4,20 ----
  #        and a Win32 dynamic library libpq.dll with import library libpqdll.lib

  # Borland C++ base install directory goes here
! # BCB=c:\Borland\Bcc55
!
! !IF "$(BCB)" == ""
! !MESSAGE You must edit bcc32.mak and define BCB at the top
! !ERROR misssing BCB
! !ENDIF
!
! !IF "$(__NMAKE__)" == ""
! !MESSAGE You must use the -N compatibility flag, e.g. make -N -f bcc32.make
! !ERROR missing -N
! !ENDIF

  !MESSAGE Building the Win32 DLL and Static Library...
  !MESSAGE
***************
*** 22,28 ****
  !MESSAGE You can specify a configuration when running MAKE
  !MESSAGE by defining the macro CFG on the command line. For example:
  !MESSAGE
! !MESSAGE make  -DCFG=[Release | Debug] /f bcc32.mak
  !MESSAGE
  !MESSAGE Possible choices for configuration are:
  !MESSAGE
--- 32,38 ----
  !MESSAGE You can specify a configuration when running MAKE
  !MESSAGE by defining the macro CFG on the command line. For example:
  !MESSAGE
! !MESSAGE make -N -DCFG=[Release | Debug] -f bcc32.mak
  !MESSAGE
  !MESSAGE Possible choices for configuration are:
  !MESSAGE
***************
*** 52,58 ****
  USERDEFINES=FRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP;

  CPP=bcc32.exe
! CPP_PROJ = -I$(BCB)\include;..\..\include -WD -c -D$(USERDEFINES) -tWM \
          -a8 -X -w-use -w-par -w-pia -w-csu -w-aus -w-ccc

  !IFDEF DEBUG
--- 62,68 ----
  USERDEFINES=FRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP;

  CPP=bcc32.exe
! CPP_PROJ = -I$(BCB)\include;..\..\include -n"$(INTDIR)" -WD -c -D$(USERDEFINES) -tWM \
          -a8 -X -w-use -w-par -w-pia -w-csu -w-aus -w-ccc

  !IFDEF DEBUG
***************
*** 61,66 ****
--- 71,78 ----
  CPP_PROJ    = $(CPP_PROJ) -O -Oi -OS -DNDEBUG
  !endif

+ ALL : config "$(OUTDIR)" "$(OUTDIR)\blibpq.dll" "$(OUTDIR)\blibpq.lib"
+
  CLEAN :
      -@erase "$(INTDIR)\getaddrinfo.obj"
      -@erase "$(INTDIR)\pgstrcasecmp.obj"
***************
*** 93,98 ****
--- 105,111 ----
      -@erase "$(OUTDIR)\$(OUTFILENAME).tds"
      -@erase "$(INTDIR)\pg_config_paths.h"

+
  LIB32=tlib.exe
  LIB32_FLAGS=
  LIB32_OBJS= \
***************
*** 121,135 ****
      "$(INTDIR)\pthread-win32.obj"


- RSC=brcc32.exe
- RSC_PROJ=-l 0x409 -i$(BCB)\include -fo"$(INTDIR)\libpq.res"
-
- LINK32=ilink32.exe
- LINK32_FLAGS = -Gn -L$(BCB)\lib;$(INTDIR); -x -Tpd -v
- LINK32_OBJS= "$(INTDIR)\libpqdll.obj"
-
- ALL: config "$(OUTDIR)" "$(OUTDIR)\blibpq.dll" "$(OUTDIR)\blibpq.lib"
-
  config: ..\..\include\pg_config.h pthread.h pg_config_paths.h

  ..\..\include\pg_config.h: ..\..\include\pg_config.h.win32
--- 134,139 ----
***************
*** 138,222 ****
  pthread.h: pthread.h.win32
      copy pthread.h.win32 pthread.h

! pg_config_paths.h: win32.mak
!     echo #define SYSCONFDIR "" > pg_config_paths.h

  "$(OUTDIR)" :
      @if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"

! /* @&&! is a Response file, http://users.deltacomm.com/edmulroy/howto8.htm */

  "$(OUTDIR)\blibpq.dll": "$(OUTDIR)\blibpq.lib" $(LINK32_OBJS) "$(INTDIR)\libpq.res" blibpqdll.def
!     $(LINK32) @&&!
      $(LINK32_FLAGS) +
      c0d32.obj $(LINK32_OBJS), +
      $@,, +
      "$(OUTDIR)\blibpq.lib" import32.lib cw32mti.lib, +
      blibpqdll.def,"$(INTDIR)\libpq.res"
! !
      implib -w "$(OUTDIR)\blibpqdll.lib" blibpqdll.def $@

  "$(INTDIR)\libpq.res" : "$(INTDIR)" libpq.rc
      $(RSC) $(RSC_PROJ) libpq.rc

  "$(OUTDIR)\blibpq.lib": $(LIB32_OBJS)
!     $(LIB32) $@ @&&!
  +-"$(**: =" &^
  +-")"
! !


  "$(INTDIR)\getaddrinfo.obj" : ..\..\port\getaddrinfo.c
!     $(CPP) @&&!
      $(CPP_PROJ) ..\..\port\getaddrinfo.c
! !

  "$(INTDIR)\pgstrcasecmp.obj" : ..\..\port\pgstrcasecmp.c
!     $(CPP) @&&!
      $(CPP_PROJ) ..\..\port\pgstrcasecmp.c
! !

  "$(INTDIR)\thread.obj" : ..\..\port\thread.c
!     $(CPP) @&&!
      $(CPP_PROJ) ..\..\port\thread.c
! !

  "$(INTDIR)\inet_aton.obj" : ..\..\port\inet_aton.c
!     $(CPP) @&&!
      $(CPP_PROJ) ..\..\port\inet_aton.c
! !

  "$(INTDIR)\crypt.obj" : ..\..\port\crypt.c
!     $(CPP) @&&!
      $(CPP_PROJ) ..\..\port\crypt.c
! !

  "$(INTDIR)\noblock.obj" : ..\..\port\noblock.c
!     $(CPP) @&&!
      $(CPP_PROJ) ..\..\port\noblock.c
! !

  "$(INTDIR)\md5.obj" : ..\..\backend\libpq\md5.c
!     $(CPP) @&&!
      $(CPP_PROJ) ..\..\backend\libpq\md5.c
! !

  "$(INTDIR)\ip.obj" : ..\..\backend\libpq\ip.c
!     $(CPP) @&&!
      $(CPP_PROJ) ..\..\backend\libpq\ip.c
! !

  "$(INTDIR)\wchar.obj" : ..\..\backend\utils\mb\wchar.c
!     $(CPP) @&&!
!     $(CPP_PROJ) /I "." ..\..\backend\utils\mb\wchar.c
! !


  "$(INTDIR)\encnames.obj" : ..\..\backend\utils\mb\encnames.c
!     $(CPP) @&&!
!     $(CPP_PROJ) /I "." ..\..\backend\utils\mb\encnames.c
! !

  .c.obj:
!     $(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<
!
--- 142,232 ----
  pthread.h: pthread.h.win32
      copy pthread.h.win32 pthread.h

! pg_config_paths.h: bcc32.mak
!     echo \#define SYSCONFDIR "" > pg_config_paths.h

  "$(OUTDIR)" :
      @if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"

! RSC=brcc32.exe
! RSC_PROJ=-l 0x409 -i$(BCB)\include -fo"$(INTDIR)\libpq.res"
!
! LINK32=ilink32.exe
! LINK32_FLAGS = -Gn -L$(BCB)\lib;$(INTDIR); -x -Tpd -v
! LINK32_OBJS= "$(INTDIR)\libpqdll.obj"
!
! # @<< is a Response file, http://www.opussoftware.com/tutorial/TutMakefile.htm

  "$(OUTDIR)\blibpq.dll": "$(OUTDIR)\blibpq.lib" $(LINK32_OBJS) "$(INTDIR)\libpq.res" blibpqdll.def
!     $(LINK32) @<<
      $(LINK32_FLAGS) +
      c0d32.obj $(LINK32_OBJS), +
      $@,, +
      "$(OUTDIR)\blibpq.lib" import32.lib cw32mti.lib, +
      blibpqdll.def,"$(INTDIR)\libpq.res"
! <<
      implib -w "$(OUTDIR)\blibpqdll.lib" blibpqdll.def $@

  "$(INTDIR)\libpq.res" : "$(INTDIR)" libpq.rc
      $(RSC) $(RSC_PROJ) libpq.rc

  "$(OUTDIR)\blibpq.lib": $(LIB32_OBJS)
!     $(LIB32) $@ @<<
  +-"$(**: =" &^
  +-")"
! <<


  "$(INTDIR)\getaddrinfo.obj" : ..\..\port\getaddrinfo.c
!     $(CPP) @<<
      $(CPP_PROJ) ..\..\port\getaddrinfo.c
! <<

  "$(INTDIR)\pgstrcasecmp.obj" : ..\..\port\pgstrcasecmp.c
!     $(CPP) @<<
      $(CPP_PROJ) ..\..\port\pgstrcasecmp.c
! <<

  "$(INTDIR)\thread.obj" : ..\..\port\thread.c
!     $(CPP) @<<
      $(CPP_PROJ) ..\..\port\thread.c
! <<

  "$(INTDIR)\inet_aton.obj" : ..\..\port\inet_aton.c
!     $(CPP) @<<
      $(CPP_PROJ) ..\..\port\inet_aton.c
! <<

  "$(INTDIR)\crypt.obj" : ..\..\port\crypt.c
!     $(CPP) @<<
      $(CPP_PROJ) ..\..\port\crypt.c
! <<

  "$(INTDIR)\noblock.obj" : ..\..\port\noblock.c
!     $(CPP) @<<
      $(CPP_PROJ) ..\..\port\noblock.c
! <<

  "$(INTDIR)\md5.obj" : ..\..\backend\libpq\md5.c
!     $(CPP) @<<
      $(CPP_PROJ) ..\..\backend\libpq\md5.c
! <<

  "$(INTDIR)\ip.obj" : ..\..\backend\libpq\ip.c
!     $(CPP) @<<
      $(CPP_PROJ) ..\..\backend\libpq\ip.c
! <<

  "$(INTDIR)\wchar.obj" : ..\..\backend\utils\mb\wchar.c
!     $(CPP) @<<
!     $(CPP_PROJ) /I"." ..\..\backend\utils\mb\wchar.c
! <<


  "$(INTDIR)\encnames.obj" : ..\..\backend\utils\mb\encnames.c
!     $(CPP) @<<
!     $(CPP_PROJ) /I"." ..\..\backend\utils\mb\encnames.c
! <<

  .c.obj:
!     $(CPP) $(CPP_PROJ) $<
Index: src/interfaces/libpq/fe-exec.c
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v
retrieving revision 1.166
diff -c -c -r1.166 fe-exec.c
*** src/interfaces/libpq/fe-exec.c    31 Dec 2004 22:03:50 -0000    1.166
--- src/interfaces/libpq/fe-exec.c    29 Apr 2005 04:17:44 -0000
***************
*** 2294,2300 ****
  int
  PQflush(PGconn *conn)
  {
!     return (pqFlush(conn));
  }


--- 2294,2300 ----
  int
  PQflush(PGconn *conn)
  {
!     return pqFlush(conn);
  }


Index: src/interfaces/libpq/pthread-win32.c
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/pthread-win32.c,v
retrieving revision 1.4
diff -c -c -r1.4 pthread-win32.c
*** src/interfaces/libpq/pthread-win32.c    1 Jan 2005 20:44:31 -0000    1.4
--- src/interfaces/libpq/pthread-win32.c    29 Apr 2005 04:17:44 -0000
***************
*** 12,18 ****


  #include <windows.h>
! #include <pthread.h>

  HANDLE
  pthread_self()
--- 12,18 ----


  #include <windows.h>
! #include "pthread.h"

  HANDLE
  pthread_self()
Index: src/interfaces/libpq/win32.mak
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/libpq/win32.mak,v
retrieving revision 1.33
diff -c -c -r1.33 win32.mak
*** src/interfaces/libpq/win32.mak    7 Mar 2005 21:10:58 -0000    1.33
--- src/interfaces/libpq/win32.mak    29 Apr 2005 04:17:44 -0000
***************
*** 78,83 ****
--- 78,111 ----
      -@erase "$(INTDIR)\pg_config_paths.h"


+ LIB32=link.exe -lib
+ LIB32_FLAGS=$(LOPT) /nologo /out:"$(OUTDIR)\$(OUTFILENAME).lib"
+ LIB32_OBJS= \
+     "$(INTDIR)\win32.obj" \
+     "$(INTDIR)\getaddrinfo.obj" \
+     "$(INTDIR)\pgstrcasecmp.obj" \
+     "$(INTDIR)\thread.obj" \
+     "$(INTDIR)\inet_aton.obj" \
+     "$(INTDIR)\crypt.obj" \
+     "$(INTDIR)\noblock.obj" \
+     "$(INTDIR)\md5.obj" \
+     "$(INTDIR)\ip.obj" \
+     "$(INTDIR)\fe-auth.obj" \
+     "$(INTDIR)\fe-protocol2.obj" \
+     "$(INTDIR)\fe-protocol3.obj" \
+     "$(INTDIR)\fe-connect.obj" \
+     "$(INTDIR)\fe-exec.obj" \
+     "$(INTDIR)\fe-lobj.obj" \
+     "$(INTDIR)\fe-misc.obj" \
+     "$(INTDIR)\fe-print.obj" \
+     "$(INTDIR)\fe-secure.obj" \
+     "$(INTDIR)\pqexpbuffer.obj" \
+     "$(INTDIR)\pqsignal.obj" \
+     "$(INTDIR)\wchar.obj" \
+     "$(INTDIR)\encnames.obj" \
+     "$(INTDIR)\pthread-win32.obj"
+
+
  config: ..\..\include\pg_config.h pthread.h pg_config_paths.h

  ..\..\include\pg_config.h: ..\..\include\pg_config.h.win32
***************
*** 87,93 ****
      copy pthread.h.win32 pthread.h

  pg_config_paths.h: win32.mak
!     echo #define SYSCONFDIR "" > pg_config_paths.h

  "$(OUTDIR)" :
      if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
--- 115,121 ----
      copy pthread.h.win32 pthread.h

  pg_config_paths.h: win32.mak
!     echo \#define SYSCONFDIR "" > pg_config_paths.h

  "$(OUTDIR)" :
      if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
***************
*** 107,140 ****

  CPP_SBRS=.

- LIB32=link.exe -lib
- LIB32_FLAGS=$(LOPT) /nologo /out:"$(OUTDIR)\$(OUTFILENAME).lib"
- LIB32_OBJS= \
-     "$(INTDIR)\win32.obj" \
-     "$(INTDIR)\getaddrinfo.obj" \
-     "$(INTDIR)\pgstrcasecmp.obj" \
-     "$(INTDIR)\thread.obj" \
-     "$(INTDIR)\inet_aton.obj" \
-         "$(INTDIR)\crypt.obj" \
-     "$(INTDIR)\noblock.obj" \
-     "$(INTDIR)\md5.obj" \
-     "$(INTDIR)\ip.obj" \
-     "$(INTDIR)\fe-auth.obj" \
-     "$(INTDIR)\fe-protocol2.obj" \
-     "$(INTDIR)\fe-protocol3.obj" \
-     "$(INTDIR)\fe-connect.obj" \
-     "$(INTDIR)\fe-exec.obj" \
-     "$(INTDIR)\fe-lobj.obj" \
-     "$(INTDIR)\fe-misc.obj" \
-     "$(INTDIR)\fe-print.obj" \
-     "$(INTDIR)\fe-secure.obj" \
-     "$(INTDIR)\pqexpbuffer.obj" \
-     "$(INTDIR)\pqsignal.obj" \
-     "$(INTDIR)\wchar.obj" \
-     "$(INTDIR)\encnames.obj" \
-     "$(INTDIR)\pthread-win32.obj"
-
-
  RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"

  LINK32=link.exe
--- 135,140 ----
***************
*** 148,154 ****
      "$(OUTDIR)\libpq.res"


! /* @<< is a Response file, http://www.opussoftware.com/tutorial/TutMakefile.htm */

  "$(OUTDIR)\$(OUTFILENAME).lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
      $(LIB32) @<<
--- 148,154 ----
      "$(OUTDIR)\libpq.res"


! # @<< is a Response file, http://www.opussoftware.com/tutorial/TutMakefile.htm

  "$(OUTDIR)\$(OUTFILENAME).lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
      $(LIB32) @<<
***************
*** 206,247 ****

  "$(INTDIR)\wchar.obj" : ..\..\backend\utils\mb\wchar.c
      $(CPP) @<<
!     $(CPP_PROJ) /I "." ..\..\backend\utils\mb\wchar.c
  <<


  "$(INTDIR)\encnames.obj" : ..\..\backend\utils\mb\encnames.c
      $(CPP) @<<
!     $(CPP_PROJ) /I "." ..\..\backend\utils\mb\encnames.c
  <<

!
! .c{$(CPP_OBJS)}.obj::
!     $(CPP) @<<
!     $(CPP_PROJ) $<
! <<
!
! .cpp{$(CPP_OBJS)}.obj::
!     $(CPP) @<<
!     $(CPP_PROJ) $<
! <<
!
! .cxx{$(CPP_OBJS)}.obj::
!     $(CPP) @<<
!     $(CPP_PROJ) $<
! <<
!
! .c{$(CPP_SBRS)}.sbr::
!     $(CPP) @<<
!     $(CPP_PROJ) $<
! <<
!
! .cpp{$(CPP_SBRS)}.sbr::
!     $(CPP) @<<
!     $(CPP_PROJ) $<
! <<
!
! .cxx{$(CPP_SBRS)}.sbr::
!     $(CPP) @<<
!     $(CPP_PROJ) $<
! <<
--- 206,219 ----

  "$(INTDIR)\wchar.obj" : ..\..\backend\utils\mb\wchar.c
      $(CPP) @<<
!     $(CPP_PROJ) /I"." ..\..\backend\utils\mb\wchar.c
  <<


  "$(INTDIR)\encnames.obj" : ..\..\backend\utils\mb\encnames.c
      $(CPP) @<<
!     $(CPP_PROJ) /I"." ..\..\backend\utils\mb\encnames.c
  <<

! .c.obj:
!     $(CPP) $(CPP_PROJ) $<

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [INTERFACES] bcc32 libpq compile problem
Next
From: Neil Conway
Date:
Subject: pg_restore -F bug