pg_config MSVC makefile

Started by Andrew Dunstanover 21 years ago14 messagespatches
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

Attached is a makefile I hacked up to build pg_config under MSVC - the
reason is that it's required (more or less) in order to build the latest
DBD::Pg code and I was testing that out under MSVC. Should be saved as
src/bin/pg_config/win32.mak if we're to be consistent. I haven't yet
done a patch to the upper level makefile to call it.

cheers

andrew

Attachments:

pg_config-win32.maktext/plain; name=pg_config-win32.makDownload
#2Bruce Momjian
bruce@momjian.us
In reply to: Andrew Dunstan (#1)
Re: pg_config MSVC makefile

This has been saved for the 8.1 release:

http:/momjian.postgresql.org/cgi-bin/pgpatches2

---------------------------------------------------------------------------

Andrew Dunstan wrote:

Attached is a makefile I hacked up to build pg_config under MSVC - the
reason is that it's required (more or less) in order to build the latest
DBD::Pg code and I was testing that out under MSVC. Should be saved as
src/bin/pg_config/win32.mak if we're to be consistent. I haven't yet
done a patch to the upper level makefile to call it.

cheers

andrew

# Makefile for Microsoft Visual C++ 5.0 (or compat)

!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF

CPP=cl.exe

!IFDEF DEBUG
OPT=/Od /Zi /MDd
LOPT=/DEBUG
DEBUGDEF=/D _DEBUG
OUTDIR=.\Debug
INTDIR=.\Debug
!ELSE
OPT=/O2 /MD
LOPT=
DEBUGDEF=/D NDEBUG
OUTDIR=.\Release
INTDIR=.\Release
!ENDIF

ALL : "..\..\port\pg_config_paths.h" "$(OUTDIR)\pg_config.exe"

CLEAN :
-@erase "$(INTDIR)\pg_config.obj"
-@erase "$(OUTDIR)\pg_config.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)\pg_config.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
/I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \
/D "HAVE_STRDUP" /D "FRONTEND" /D VAL_CONFIGURE="\"\""

CPP_OBJS=$(INTDIR)/
CPP_SBRS=.

LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
/pdb:"$(OUTDIR)\pg_config.pdb" /machine:I386 $(LOPT) /out:"$(OUTDIR)\pg_config.exe"
LINK32_OBJS= \
"$(INTDIR)\pg_config.obj" \
"$(INTDIR)\pgstrcasecmp.obj" \
"$(OUTDIR)\path.obj" \
"$(INTDIR)\exec.obj" \
!IFDEF DEBUG
"..\..\interfaces\libpq\Debug\libpqddll.lib"
!ELSE
"..\..\interfaces\libpq\Release\libpqdll.lib"
!ENDIF

"$(OUTDIR)\pg_config.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<

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

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

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

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

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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

-- 
  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
#3Dave Page
dpage@pgadmin.org
In reply to: Bruce Momjian (#2)
Re: pg_config MSVC makefile

-----Original Message-----
From: pgsql-patches-owner@postgresql.org
[mailto:pgsql-patches-owner@postgresql.org] On Behalf Of Bruce Momjian
Sent: 07 January 2005 05:33
To: Andrew Dunstan
Cc: Patches (PostgreSQL)
Subject: Re: [PATCHES] pg_config MSVC makefile

This has been saved for the 8.1 release:

http:/momjian.postgresql.org/cgi-bin/pgpatches2

--------------------------------------------------------------
-------------

Andrew Dunstan wrote:

Attached is a makefile I hacked up to build pg_config under

MSVC - the

reason is that it's required (more or less) in order to

build the latest

DBD::Pg code and I was testing that out under MSVC.

Err, I missed this earlier - we had discussed getting rid of all the
VC++ & Borland makefiles for 8.1. With Mingw now working they are a
little redundant now, and Bruce & I (and probably others) had to jump
through hoops to keep them working this release. Admittedley that pain
will probably be less in the future, but still, they are a pita to
maintain (especially Borland as no-one seems to have the compiler
anyway!)

Regards, Dave.

#4Tony and Bryn Reina
reina_ga@hotmail.com
In reply to: Dave Page (#3)
Re: pg_config MSVC makefile

Dave Page wrote:
Err, I missed this earlier - we had discussed getting rid of all the
VC++ & Borland makefiles for 8.1. With Mingw now working they are a
little redundant now, and Bruce & I (and probably others) had to jump
through hoops to keep them working this release. Admittedley that pain
will probably be less in the future, but still, they are a pita to
maintain (especially Borland as no-one seems to have the compiler
anyway!)

I have VC++ and have been using it to compile my libpq.dll files since PG 6.5.

Has anyone compared the DLL files using Mingw and using VC++ in terms of size and speed on win32? I'm not sure if there's any huge difference but would hate to have VC++ support for compiling the DLLs dropped without that knowledge.

I'd be happy to provide VC++ compiled DLLs for Mingw and VC++ if anyone would like to try them. I suppose I could also code some sort of test program in C and do the tests myself.

Not sure if this has been discussed already. I'd hate to be re-visting someone else's attempt.

-Tony

#5Dave Page
dpage@pgadmin.org
In reply to: Tony and Bryn Reina (#4)
Re: pg_config MSVC makefile

________________________________

From: pgsql-patches-owner@postgresql.org
[mailto:pgsql-patches-owner@postgresql.org] On Behalf Of Tony and Bryn
Reina
Sent: 07 January 2005 10:57
To: pgsql-patches@postgresql.org
Subject: Re: [PATCHES] pg_config MSVC makefile

Dave Page wrote:
Err, I missed this earlier - we had discussed getting rid of

all the

VC++ & Borland makefiles for 8.1. With Mingw now working they

are a

little redundant now, and Bruce & I (and probably others) had

to jump

through hoops to keep them working this release. Admittedley

that pain

will probably be less in the future, but still, they are a

pita to

maintain (especially Borland as no-one seems to have the

compiler

anyway!)

I have VC++ and have been using it to compile my libpq.dll files
since PG 6.5.

Has anyone compared the DLL files using Mingw and using VC++ in
terms of size and speed on win32? I'm not sure if there's any huge
difference but would hate to have VC++ support for compiling the DLLs
dropped without that knowledge.

I'd be happy to provide VC++ compiled DLLs for Mingw and VC++ if
anyone would like to try them. I suppose I could also code some sort of
test program in C and do the tests myself.

Not sure if this has been discussed already. I'd hate to be
re-visting someone else's attempt.

As far as I know, there have been no real benchmarks done, however,
pgAdmin now ships with a Mingw compiled libpq where previous versions
used a (static) VC++ one and I've neither noticed any difference myself,
or had any reports of poor performance on the pgAdmin lists (or
privately) from other users.

Personally I don't think minor size differences are much of an issue
given today's storage and network capabilities and the fact that the
file is only around 150Kb anyway.

Regards, Dave.

#6Tony and Bryn Reina
reina_ga@hotmail.com
In reply to: Dave Page (#5)
Re: pg_config MSVC makefile

As far as I know, there have been no real benchmarks done, however,
pgAdmin now ships with a Mingw compiled libpq where previous versions
used a (static) VC++ one and I've neither noticed any difference myself,
or had any reports of poor performance on the pgAdmin lists (or
privately) from other users.

Fair enough. I suppose PgAdmin would be a decent test for any differences in
execution speed.

-Tony

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar � get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

#7Bruce Momjian
bruce@momjian.us
In reply to: Dave Page (#3)
Re: pg_config MSVC makefile

Dave Page wrote:

Attached is a makefile I hacked up to build pg_config under

MSVC - the

reason is that it's required (more or less) in order to

build the latest

DBD::Pg code and I was testing that out under MSVC.

Err, I missed this earlier - we had discussed getting rid of all the
VC++ & Borland makefiles for 8.1. With Mingw now working they are a
little redundant now, and Bruce & I (and probably others) had to jump
through hoops to keep them working this release. Admittedley that pain
will probably be less in the future, but still, they are a pita to
maintain (especially Borland as no-one seems to have the compiler
anyway!)

I am not in favor of removing those makefiles in 8.1 unless they become
more of a pain. If people are submitting patches it means they are
using them so they should be kept.

-- 
  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
#8Dave Page
dpage@pgadmin.org
In reply to: Bruce Momjian (#7)
Re: pg_config MSVC makefile

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: 07 January 2005 15:14
To: Dave Page
Cc: Andrew Dunstan; Patches (PostgreSQL)
Subject: Re: [PATCHES] pg_config MSVC makefile

I am not in favor of removing those makefiles in 8.1 unless
they become
more of a pain. If people are submitting patches it means they are
using them so they should be kept.

Fair enough, but bear in mind that none of the fixes you or I made to
the borland ones have ever been tested as far as I am aware - does
anyone actually use them? Also, I'm using the Mingw build now, so
probably won't be spending time on the VC++ builds in the future. If
others can maintain them I won't object.

Regards, Dave.

#9Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#7)
Re: pg_config MSVC makefile

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Dave Page wrote:

Err, I missed this earlier - we had discussed getting rid of all the
VC++ & Borland makefiles for 8.1. With Mingw now working they are a
little redundant now,

I am not in favor of removing those makefiles in 8.1 unless they become
more of a pain. If people are submitting patches it means they are
using them so they should be kept.

Is anyone doing so though?

I recall proposing a couple months ago that we kill those makefiles,
but there was at least one objection at the time.

It occurs to me that the availability of the native port might actually
increase rather than decrease the demand for these makefiles --- or at
least the demand for the ability to build libpq that way. Consider
people who are building database-using apps using MSVC or Borland.

regards, tom lane

#10Dave Page
dpage@pgadmin.org
In reply to: Tom Lane (#9)
Re: pg_config MSVC makefile

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 07 January 2005 16:25
To: Bruce Momjian
Cc: Dave Page; Andrew Dunstan; Patches (PostgreSQL)
Subject: Re: [PATCHES] pg_config MSVC makefile

more of a pain. If people are submitting patches it means they are
using them so they should be kept.

Is anyone doing so though?

Not that I've seen.

I recall proposing a couple months ago that we kill those makefiles,
but there was at least one objection at the time.

It occurs to me that the availability of the native port
might actually
increase rather than decrease the demand for these makefiles --- or at
least the demand for the ability to build libpq that way. Consider
people who are building database-using apps using MSVC or Borland.

They don't need to build libpq themselves though - we provide import
libs with the installer for VC++ that allows the supplied mingw build of
the dll to be used (that's how pgAdmin is built). I'm sure that a
Borland lib could be generated in the same way if anyone had the
equivalent Borland tool (with VC++ we use lib.exe).

My main concern is that they don't end up suffering terminal bit-rot
because I stop helping maintain them - if we ship them, they should
work.

Regards, Dave.

#11Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dave Page (#10)
Re: pg_config MSVC makefile

"Dave Page" <dpage@vale-housing.co.uk> writes:

From: Tom Lane [mailto:tgl@sss.pgh.pa.us]

I recall proposing a couple months ago that we kill those makefiles,
but there was at least one objection at the time.

My main concern is that they don't end up suffering terminal bit-rot
because I stop helping maintain them - if we ship them, they should
work.

Don't feel that it's on your head to keep them working. The project's
attitude towards port-specific files has always been that it's the
responsibility of the users of that port to keep 'em working. If there
are no users of a port, it will suffer bit-rot, and eventually we'll
decide to remove it. But I think it's a bit early to declare that there
are no users of the MSVC or Borland ports.

regards, tom lane

#12Dave Page
dpage@pgadmin.org
In reply to: Tom Lane (#11)
Re: pg_config MSVC makefile

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: 07 January 2005 17:07
To: Dave Page
Cc: Bruce Momjian; Andrew Dunstan; Patches (PostgreSQL)
Subject: Re: [PATCHES] pg_config MSVC makefile

Don't feel that it's on your head to keep them working. The project's
attitude towards port-specific files has always been that it's the
responsibility of the users of that port to keep 'em working.
If there
are no users of a port, it will suffer bit-rot, and eventually we'll
decide to remove it. But I think it's a bit early to declare
that there
are no users of the MSVC or Borland ports.

OK, fair enough :-)

/D

#13Bruce Momjian
bruce@momjian.us
In reply to: Dave Page (#8)
Re: pg_config MSVC makefile

Dave Page wrote:

-----Original Message-----
From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
Sent: 07 January 2005 15:14
To: Dave Page
Cc: Andrew Dunstan; Patches (PostgreSQL)
Subject: Re: [PATCHES] pg_config MSVC makefile

I am not in favor of removing those makefiles in 8.1 unless
they become
more of a pain. If people are submitting patches it means they are
using them so they should be kept.

Fair enough, but bear in mind that none of the fixes you or I made to
the borland ones have ever been tested as far as I am aware - does
anyone actually use them? Also, I'm using the Mingw build now, so

I think we got fixes for Borland for 7.4 after the 7.4 release so I
expect fixes post-8.0.0 for those.

probably won't be spending time on the VC++ builds in the future. If
others can maintain them I won't object.

Agreed.

-- 
  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
#14Bruce Momjian
bruce@momjian.us
In reply to: Andrew Dunstan (#1)
Re: pg_config MSVC makefile

Patch applied. Thanks.

I also updated the top-level win32.mak for this.

---------------------------------------------------------------------------

Andrew Dunstan wrote:

Attached is a makefile I hacked up to build pg_config under MSVC - the
reason is that it's required (more or less) in order to build the latest
DBD::Pg code and I was testing that out under MSVC. Should be saved as
src/bin/pg_config/win32.mak if we're to be consistent. I haven't yet
done a patch to the upper level makefile to call it.

cheers

andrew

# Makefile for Microsoft Visual C++ 5.0 (or compat)

!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF

CPP=cl.exe

!IFDEF DEBUG
OPT=/Od /Zi /MDd
LOPT=/DEBUG
DEBUGDEF=/D _DEBUG
OUTDIR=.\Debug
INTDIR=.\Debug
!ELSE
OPT=/O2 /MD
LOPT=
DEBUGDEF=/D NDEBUG
OUTDIR=.\Release
INTDIR=.\Release
!ENDIF

ALL : "..\..\port\pg_config_paths.h" "$(OUTDIR)\pg_config.exe"

CLEAN :
-@erase "$(INTDIR)\pg_config.obj"
-@erase "$(OUTDIR)\pg_config.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)\pg_config.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
/I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \
/D "HAVE_STRDUP" /D "FRONTEND" /D VAL_CONFIGURE="\"\""

CPP_OBJS=$(INTDIR)/
CPP_SBRS=.

LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:no\
/pdb:"$(OUTDIR)\pg_config.pdb" /machine:I386 $(LOPT) /out:"$(OUTDIR)\pg_config.exe"
LINK32_OBJS= \
"$(INTDIR)\pg_config.obj" \
"$(INTDIR)\pgstrcasecmp.obj" \
"$(OUTDIR)\path.obj" \
"$(INTDIR)\exec.obj" \
!IFDEF DEBUG
"..\..\interfaces\libpq\Debug\libpqddll.lib"
!ELSE
"..\..\interfaces\libpq\Release\libpqdll.lib"
!ENDIF

"$(OUTDIR)\pg_config.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<

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

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

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

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

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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

-- 
  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