# -*-makefile-*-
-# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.196 2004/10/01 02:06:52 neilc Exp $
+# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.197 2004/10/05 19:30:19 momjian Exp $
 
 #------------------------------------------------------------------------------
 # All PostgreSQL makefiles include this file and use the variables it sets,
 %.bz2: %
        $(BZIP2) -f $<
 
+ifeq ($(PORTNAME),win32)
+# Build rules to add versioninfo resources to win32 binaries
+WIN32RES += win32ver.o
+ifeq ($(PGFILESHLIB),1)
+PGFTYPE=VFT_DLL
+else
+PGFTYPE=VFT_APP
+endif
+ifneq (,$(PGAPPICON))
+PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
+endif
+win32ver.rc: $(top_builddir)/src/port/win32ver.rc
+       sed -e "s;FILEDESC;$(PGFILEDESC);" -e "s/VFT_APP/$(PGFTYPE)/" -e "s/_ICO_/$(PGICOSTR)/" $(top_builddir)/src/port/win32ver.rc > win32ver.rc      
+win32ver.o: win32ver.rc
+       windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
+       rm -f win32ver.rc
+endif
 
 ifndef PGXS
 
 
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/backend/Makefile,v 1.105 2004/10/04 13:43:54 momjian Exp $
+# $PostgreSQL: pgsql/src/backend/Makefile,v 1.106 2004/10/05 19:30:20 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "PostgreSQL Database Backend"
 subdir = src/backend
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
 
 ifeq ($(PORTNAME), win32)
 
-postgres: $(OBJS) $(DLLINIT) postgres.def libpostgres.a
+postgres: $(OBJS) $(DLLINIT) postgres.def libpostgres.a $(WIN32RES)
        $(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def
-       $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(LIBS)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(OBJS) $(WIN32RES) $(LIBS)
        $(DLLTOOL) --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
-       $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) $@.exp $(OBJS) $(LIBS)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o $@$(X) $@.exp $(OBJS) $(WIN32RES) $(LIBS)
        rm -f $@.exp $@.base
 
 postgres.def: $(OBJS)
 
 # Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.46 2004/10/04 18:05:53 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.47 2004/10/05 19:30:21 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "initdb - initialize a new database cluster"
 subdir = src/bin/initdb
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
 override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)
 
-OBJS=  initdb.o
+OBJS=  initdb.o $(WIN32RES)
 
 all: submake-libpq submake-libpgport initdb
 
 
 #
 # Copyright (c) 1998-2002, PostgreSQL Global Development Group
 #
-# $PostgreSQL: pgsql/src/bin/pg_controldata/Makefile,v 1.10 2004/10/04 13:43:55 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/pg_controldata/Makefile,v 1.11 2004/10/05 19:30:21 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "pg_controldata - reads the data from pg_control"
 subdir = src/bin/pg_controldata
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
 override CPPFLAGS += -DFRONTEND
 
-OBJS= pg_controldata.o pg_crc.o
+OBJS= pg_controldata.o pg_crc.o $(WIN32RES)
 
 all: submake-libpgport pg_controldata
 
 
 # Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/bin/pg_ctl/Makefile,v 1.17 2004/10/04 18:05:54 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/pg_ctl/Makefile,v 1.18 2004/10/05 19:30:22 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "pg_ctl - starts/stops/restarts the PostgreSQL server"
 subdir = src/bin/pg_ctl
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
 override CPPFLAGS := -DFRONTEND -DDEF_PGPORT=$(DEF_PGPORT) -I$(libpq_srcdir) $(CPPFLAGS)
 
-OBJS=  pg_ctl.o
+OBJS=  pg_ctl.o $(WIN32RES)
 
 all: submake-libpq submake-libpgport pg_ctl
 
 
 # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.55 2004/10/04 20:32:58 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.56 2004/10/05 19:30:23 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "pg_dump/pg_restore/pg_dumpall - backup and restore PostgreSQL databases"
 subdir = src/bin/pg_dump
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
 OBJS=  pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
        pg_backup_files.o pg_backup_null.o pg_backup_tar.o \
-       dumputils.o
+       dumputils.o $(WIN32RES)
 
 EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
 
        $(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
 
 pg_dumpall: pg_dumpall.o dumputils.o $(libpq_builddir)/libpq.a
-       $(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
+       $(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(WIN32RES) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
 
 .PHONY: submake-backend
 submake-backend:
 
 #
 # Copyright (c) 1998-2002, PostgreSQL Global Development Group
 #
-# $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.12 2004/10/04 13:43:57 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/pg_resetxlog/Makefile,v 1.13 2004/10/05 19:30:23 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "pg_resetxlog - reset PostgreSQL WAL log"
 subdir = src/bin/pg_resetxlog
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
 override CPPFLAGS += -DFRONTEND
 
-OBJS= pg_resetxlog.o pg_crc.o
+OBJS= pg_resetxlog.o pg_crc.o $(WIN32RES)
 
 all: submake-libpgport pg_resetxlog
 
 
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "Eventlog message formatter"
+PGFILESHLIB = 1
 subdir = src/bin/pgevent
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 pgevent.dll: $(OBJS) pgevent.def
        dllwrap --def pgevent.def -o $(NAME) $(OBJS)
        
-pgmsgevent.o: pgmsgevent.rc
-       windres pgmsgevent.rc -o pgmsgevent.o
+pgmsgevent.o: pgmsgevent.rc win32ver.rc
+       windres pgmsgevent.rc -o pgmsgevent.o --include-dir=$(top_builddir)/src/include
 
 all-lib: $(NAME)
 
 install-lib: $(NAME)
        $(INSTALL_STLIB) $< $(DESTDIR)$(libdir)/$<
-       
+
 uninstall-lib:
        rm -f $(DESTDIR)$(libdir)/$(NAME)
 
 clean distclean:
-       rm -f $(OBJS) $(NAME)
+       rm -f $(OBJS) $(NAME) win32ver.rc
 
 clean-lib:
        rm -f $(NAME)
 
 LANGUAGE 0x9,0x1
 1 11 MSG00001.bin
+
+#include "win32ver.rc"
 
 # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.50 2004/10/04 20:36:10 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.51 2004/10/05 19:30:24 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "psql - the PostgreSQL interactive terminal"
+PGAPPICON=win32
 subdir = src/bin/psql
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
 OBJS=  command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
        startup.o prompt.o variables.o large_obj.o print.o describe.o \
-       psqlscan.o tab-complete.o mbprint.o
+       psqlscan.o tab-complete.o mbprint.o $(WIN32RES)
 
 FLEXFLAGS = -Cfe
 
 
 # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.30 2004/10/04 18:05:55 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/scripts/Makefile,v 1.31 2004/10/05 19:30:25 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "PostgreSQL utility"
 subdir = src/bin/scripts
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
 all: submake-libpq submake-backend $(PROGRAMS)
 
-%: %.o
+%: %.o $(WIN32RES)
        $(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
 
 createdb: createdb.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
 
 clean distclean maintainer-clean:
        rm -f $(addsuffix $(X), $(PROGRAMS)) $(addsuffix .o, $(PROGRAMS))
-       rm -f common.o dumputils.o print.o mbprint.o
+       rm -f common.o dumputils.o print.o mbprint.o $(WIN32RES)
        rm -f dumputils.c print.c mbprint.c
 
 #
 # Copyright (c) 1998-2002, PostgreSQL Global Development Group
 #
-# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.108 2004/10/04 13:43:58 momjian Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.109 2004/10/05 19:30:25 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
+PGFILEDESC = "ecpg - embedded SQL precompiler for C"
 subdir = src/interfaces/ecpg/preproc
 top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
 endif
 override CFLAGS += $(PTHREAD_CFLAGS)
 
-OBJS=  preproc.o type.o ecpg.o ecpg_keywords.o output.o\
-       keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o
+OBJS=  preproc.o type.o ecpg.o ecpg_keywords.o output.o \
+       keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o \
+       $(WIN32RES)
 
 all: submake-libpgport ecpg
 
 
--- /dev/null
+#include <winver.h>
+#include "pg_config.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION    7,4,999,999
+ PRODUCTVERSION 7,4,999,999
+ FILEFLAGSMASK  0x17L
+ FILEFLAGS      0x0L
+ FILEOS         VOS_NT_WINDOWS32
+ FILETYPE      VFT_APP
+ FILESUBTYPE    0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+  BLOCK "000004b0"
+  BEGIN
+   VALUE "CompanyName",      "PostgreSQL Global Development Group"
+   VALUE "FileDescription",  FILEDESC
+   VALUE "FileVersion",      PG_VERSION
+   VALUE "LegalCopyright", "Portions Copyright (C) 1996-2004 PostgreSQL Global Development Group. Portions Copyright (C) 1994, Regents of the University of California."
+   VALUE "ProductName",      "PostgreSQL"
+   VALUE "ProductVersion",   PG_VERSION
+  END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+  VALUE "Translation", 0x0, 1200
+ END
+END
+
+_ICO_