As many know, the FRONTEND usage of /src/port is very fragile.  It
requires every binary that uses certain libpgport object files to create
its own version, which is very fragile, and could easily break if a
function call is added in a subrelease, especially on certain ports.

The following patch addresses this issue by making libpgport usable
unchanged by client applications, and makes a special server version for
the backend.   This is much less fragile than trying to make sure you
hit every single binary that uses libpgport.  

I originally tried abstracting out the #ifdef FRONTEND defines in pgport
but found that that wasn't easily done so making separate libraries was
cleaner.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/Makefile,v
retrieving revision 1.104
diff -c -c -r1.104 Makefile
*** src/backend/Makefile        1 Aug 2004 18:07:42 -0000       1.104
--- src/backend/Makefile        1 Oct 2004 04:04:00 -0000
***************
*** 26,31 ****
--- 26,33 ----
  OBJS+= bootstrap/bootstrap.o
  endif
  
+ # Add server version of port object files first
+ LIBS:=$(subst -lpgport, -lpgport_srv -lpgport, $(LIBS))
  
  ##########################################################################
  
Index: src/bin/initdb/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/initdb/Makefile,v
retrieving revision 1.44
diff -c -c -r1.44 Makefile
*** src/bin/initdb/Makefile     29 Aug 2004 04:13:01 -0000      1.44
--- src/bin/initdb/Makefile     1 Oct 2004 04:04:06 -0000
***************
*** 13,33 ****
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)
  
! OBJS= initdb.o dirmod.o exec.o
  
  all: submake-libpq submake-libpgport initdb
  
  initdb: $(OBJS) $(libpq_builddir)/libpq.a
        $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
- dirmod.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
- exec.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  install: all installdirs
        $(INSTALL_PROGRAM) initdb$(X) $(DESTDIR)$(bindir)/initdb$(X)
  
--- 13,27 ----
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
  
! OBJS= initdb.o
  
  all: submake-libpq submake-libpgport initdb
  
  initdb: $(OBJS) $(libpq_builddir)/libpq.a
        $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
  install: all installdirs
        $(INSTALL_PROGRAM) initdb$(X) $(DESTDIR)$(bindir)/initdb$(X)
  
***************
*** 38,44 ****
        rm -f $(DESTDIR)$(bindir)/initdb$(X)
  
  clean distclean maintainer-clean:
!       rm -f initdb$(X) $(OBJS) dirmod.c exec.c
  
  
  # ensure that changes in datadir propagate into object file
--- 32,38 ----
        rm -f $(DESTDIR)$(bindir)/initdb$(X)
  
  clean distclean maintainer-clean:
!       rm -f initdb$(X) $(OBJS)
  
  
  # ensure that changes in datadir propagate into object file
Index: src/bin/pg_config/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_config/Makefile,v
retrieving revision 1.8
diff -c -c -r1.8 Makefile
*** src/bin/pg_config/Makefile  1 Aug 2004 06:56:38 -0000       1.8
--- src/bin/pg_config/Makefile  1 Oct 2004 04:04:06 -0000
***************
*** 1,18 ****
! # $PostgreSQL: pgsql-server/src/bin/pg_config/Makefile,v 1.8 2004/08/01 06:56:38 
momjian Exp $
  
  subdir = src/bin/pg_config
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global
  
! OBJS=   pg_config.o exec.o
  
! override CPPFLAGS :=  -DFRONTEND -I$(libpq_srcdir) 
-DVAL_CONFIGURE="\"$(configure_args)\"" $(CPPFLAGS)
  
  all: submake-libpgport pg_config
  
- exec.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  pg_config: $(OBJS)
        $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
--- 1,23 ----
! #-------------------------------------------------------------------------
! #
! # Makefile for src/bin/pg_controldata
! #
! # Copyright (c) 1998-2002, PostgreSQL Global Development Group
! #
! # $PostgreSQL: pgsql-server/src/bin/pg_controldata/Makefile,v 1.9 2004/05/26 
17:24:01 tgl Exp $
! #
! #-------------------------------------------------------------------------
  
  subdir = src/bin/pg_config
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global
  
! OBJS=   pg_config.o
  
! override CPPFLAGS := -I$(libpq_srcdir) -DVAL_CONFIGURE="\"$(configure_args)\"" 
$(CPPFLAGS)
  
  all: submake-libpgport pg_config
  
  pg_config: $(OBJS)
        $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
***************
*** 26,29 ****
        rm -f $(DESTDIR)$(bindir)/pg_config
  
  clean distclean maintainer-clean:
!       rm -f pg_config$(X) $(OBJS) exec.c
--- 31,34 ----
        rm -f $(DESTDIR)$(bindir)/pg_config
  
  clean distclean maintainer-clean:
!       rm -f pg_config$(X) $(OBJS)
Index: src/bin/pg_controldata/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_controldata/Makefile,v
retrieving revision 1.9
diff -c -c -r1.9 Makefile
*** src/bin/pg_controldata/Makefile     26 May 2004 17:24:01 -0000      1.9
--- src/bin/pg_controldata/Makefile     1 Oct 2004 04:04:06 -0000
***************
*** 14,20 ****
  
  override CPPFLAGS += -DFRONTEND
  
! OBJS= pg_controldata.o pg_crc.o exec.o
  
  all: submake-libpgport pg_controldata
  
--- 14,20 ----
  
  override CPPFLAGS += -DFRONTEND
  
! OBJS= pg_controldata.o pg_crc.o
  
  all: submake-libpgport pg_controldata
  
***************
*** 24,32 ****
  pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
        rm -f $@ && $(LN_S) $< .
  
- exec.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  install: all installdirs
        $(INSTALL_PROGRAM) pg_controldata$(X) $(DESTDIR)$(bindir)/pg_controldata$(X)
  
--- 24,29 ----
***************
*** 37,40 ****
        rm -f $(DESTDIR)$(bindir)/pg_controldata$(X)
  
  clean distclean maintainer-clean:
!       rm -f pg_controldata$(X) $(OBJS) pg_crc.c exec.c
--- 34,37 ----
        rm -f $(DESTDIR)$(bindir)/pg_controldata$(X)
  
  clean distclean maintainer-clean:
!       rm -f pg_controldata$(X) $(OBJS) pg_crc.c
Index: src/bin/pg_ctl/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_ctl/Makefile,v
retrieving revision 1.15
diff -c -c -r1.15 Makefile
*** src/bin/pg_ctl/Makefile     29 Aug 2004 04:13:01 -0000      1.15
--- src/bin/pg_ctl/Makefile     1 Oct 2004 04:04:06 -0000
***************
*** 13,30 ****
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := -DFRONTEND -DDEF_PGPORT=$(DEF_PGPORT) -I$(libpq_srcdir) 
$(CPPFLAGS)
  
! OBJS= pg_ctl.o exec.o
  
  all: submake-libpq submake-libpgport pg_ctl
  
  pg_ctl: $(OBJS) $(libpq_builddir)/libpq.a
        $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
- exec.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  install: all installdirs
        $(INSTALL_PROGRAM) pg_ctl$(X) $(DESTDIR)$(bindir)/pg_ctl$(X)
  
--- 13,27 ----
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := -DDEF_PGPORT=$(DEF_PGPORT) -I$(libpq_srcdir) $(CPPFLAGS)
  
! OBJS= pg_ctl.o
  
  all: submake-libpq submake-libpgport pg_ctl
  
  pg_ctl: $(OBJS) $(libpq_builddir)/libpq.a
        $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
  install: all installdirs
        $(INSTALL_PROGRAM) pg_ctl$(X) $(DESTDIR)$(bindir)/pg_ctl$(X)
  
***************
*** 35,41 ****
        rm -f $(DESTDIR)$(bindir)/pg_ctl$(X)
  
  clean distclean maintainer-clean:
!       rm -f pg_ctl$(X) $(OBJS) exec.c
  
  
  # ensure that changes in DEF_PGPORT propagate into object file
--- 32,38 ----
        rm -f $(DESTDIR)$(bindir)/pg_ctl$(X)
  
  clean distclean maintainer-clean:
!       rm -f pg_ctl$(X) $(OBJS)
  
  
  # ensure that changes in DEF_PGPORT propagate into object file
Index: src/bin/pg_dump/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/Makefile,v
retrieving revision 1.52
diff -c -c -r1.52 Makefile
*** src/bin/pg_dump/Makefile    25 May 2004 01:00:24 -0000      1.52
--- src/bin/pg_dump/Makefile    1 Oct 2004 04:04:06 -0000
***************
*** 13,23 ****
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) -DFRONTEND
  
  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 exec.o
  
  EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
  
--- 13,23 ----
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
  
  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
  
  EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
  
***************
*** 30,41 ****
  pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
        $(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) 
-o [EMAIL PROTECTED](X)
  
! pg_dumpall: pg_dumpall.o dumputils.o exec.o $(libpq_builddir)/libpq.a
!       $(CC) $(CFLAGS) pg_dumpall.o dumputils.o exec.o $(EXTRA_OBJS) $(libpq) 
$(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
! 
! # We need our own build of exec.c so it gets made with -DFRONTEND
! exec.c: % : $(top_srcdir)/src/port/%
!       rm -f $@ && $(LN_S) $< .
  
  .PHONY: submake-backend
  submake-backend:
--- 30,37 ----
  pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
        $(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) 
-o [EMAIL PROTECTED](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 [EMAIL PROTECTED](X)
  
  .PHONY: submake-backend
  submake-backend:
***************
*** 54,57 ****
        rm -f $(addprefix $(DESTDIR)$(bindir)/, pg_dump$(X) pg_restore$(X) 
pg_dumpall$(X))
  
  clean distclean maintainer-clean:
!       rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X) $(OBJS) pg_dump.o common.o 
pg_dump_sort.o pg_restore.o pg_dumpall.o exec.c
--- 50,53 ----
        rm -f $(addprefix $(DESTDIR)$(bindir)/, pg_dump$(X) pg_restore$(X) 
pg_dumpall$(X))
  
  clean distclean maintainer-clean:
!       rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X) $(OBJS) pg_dump.o common.o 
pg_dump_sort.o pg_restore.o pg_dumpall.o
Index: src/bin/pg_resetxlog/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_resetxlog/Makefile,v
retrieving revision 1.11
diff -c -c -r1.11 Makefile
*** src/bin/pg_resetxlog/Makefile       1 Aug 2004 06:22:38 -0000       1.11
--- src/bin/pg_resetxlog/Makefile       1 Oct 2004 04:04:07 -0000
***************
*** 14,35 ****
  
  override CPPFLAGS += -DFRONTEND
  
! OBJS= pg_resetxlog.o pg_crc.o dirmod.o exec.o
  
  all: submake-libpgport pg_resetxlog
  
  pg_resetxlog: $(OBJS)
        $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
- dirmod.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
        rm -f $@ && $(LN_S) $< .
  
- exec.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  install: all installdirs
        $(INSTALL_PROGRAM) pg_resetxlog$(X) $(DESTDIR)$(bindir)/pg_resetxlog$(X)
  
--- 14,29 ----
  
  override CPPFLAGS += -DFRONTEND
  
! OBJS= pg_resetxlog.o pg_crc.o
  
  all: submake-libpgport pg_resetxlog
  
  pg_resetxlog: $(OBJS)
        $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
  pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
        rm -f $@ && $(LN_S) $< .
  
  install: all installdirs
        $(INSTALL_PROGRAM) pg_resetxlog$(X) $(DESTDIR)$(bindir)/pg_resetxlog$(X)
  
***************
*** 40,43 ****
        rm -f $(DESTDIR)$(bindir)/pg_resetxlog$(X)
  
  clean distclean maintainer-clean:
!       rm -f pg_resetxlog$(X) $(OBJS) pg_crc.c dirmod.c exec.c
--- 34,37 ----
        rm -f $(DESTDIR)$(bindir)/pg_resetxlog$(X)
  
  clean distclean maintainer-clean:
!       rm -f pg_resetxlog$(X) $(OBJS) pg_crc.c
Index: src/bin/psql/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/Makefile,v
retrieving revision 1.47
diff -c -c -r1.47 Makefile
*** src/bin/psql/Makefile       24 May 2004 01:01:37 -0000      1.47
--- src/bin/psql/Makefile       1 Oct 2004 04:04:07 -0000
***************
*** 19,25 ****
  
  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 exec.o
  
  FLEXFLAGS = -Cfe
  
--- 19,25 ----
  
  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
  
  FLEXFLAGS = -Cfe
  
***************
*** 29,37 ****
  psql: $(OBJS) $(libpq_builddir)/libpq.a
        $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
- exec.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  help.o: $(srcdir)/sql_help.h
  
  ifdef PERL
--- 29,34 ----
***************
*** 63,69 ****
  
  # psqlscan.c is in the distribution tarball, so is not cleaned here
  clean distclean:
!       rm -f psql$(X) $(OBJS) exec.c
  
  maintainer-clean: distclean
        rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c
--- 60,66 ----
  
  # psqlscan.c is in the distribution tarball, so is not cleaned here
  clean distclean:
!       rm -f psql$(X) $(OBJS)
  
  maintainer-clean: distclean
        rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c
Index: src/bin/scripts/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/scripts/Makefile,v
retrieving revision 1.28
diff -c -c -r1.28 Makefile
*** src/bin/scripts/Makefile    26 May 2004 17:24:05 -0000      1.28
--- src/bin/scripts/Makefile    1 Oct 2004 04:04:07 -0000
***************
*** 15,42 ****
  
  PROGRAMS = createdb createlang createuser dropdb droplang dropuser clusterdb vacuumdb
  
! override CPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/bin/pg_dump 
-I$(top_srcdir)/src/bin/psql -I$(libpq_srcdir) $(CPPFLAGS)
  
  all: submake-libpq submake-backend $(PROGRAMS)
  
  %: %.o
        $(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
! createdb: createdb.o common.o exec.o dumputils.o 
$(top_builddir)/src/backend/parser/keywords.o
! createlang: createlang.o common.o exec.o print.o mbprint.o
! createuser: createuser.o common.o exec.o dumputils.o 
$(top_builddir)/src/backend/parser/keywords.o
! dropdb: dropdb.o common.o exec.o dumputils.o 
$(top_builddir)/src/backend/parser/keywords.o
! droplang: droplang.o common.o exec.o print.o mbprint.o
! dropuser: dropuser.o common.o exec.o dumputils.o 
$(top_builddir)/src/backend/parser/keywords.o
! clusterdb: clusterdb.o common.o exec.o dumputils.o 
$(top_builddir)/src/backend/parser/keywords.o
! vacuumdb: vacuumdb.o common.o exec.o
  
  dumputils.c: % : $(top_srcdir)/src/bin/pg_dump/%
        rm -f $@ && $(LN_S) $< .
  
- exec.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  print.c mbprint.c : % : $(top_srcdir)/src/bin/psql/%
        rm -f $@ && $(LN_S) $< .
  
--- 15,39 ----
  
  PROGRAMS = createdb createlang createuser dropdb droplang dropuser clusterdb vacuumdb
  
! override CPPFLAGS := -I$(top_srcdir)/src/bin/pg_dump -I$(top_srcdir)/src/bin/psql 
-I$(libpq_srcdir) $(CPPFLAGS)
  
  all: submake-libpq submake-backend $(PROGRAMS)
  
  %: %.o
        $(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
! createdb: createdb.o common.o dumputils.o 
$(top_builddir)/src/backend/parser/keywords.o
! createlang: createlang.o common.o print.o mbprint.o
! createuser: createuser.o common.o dumputils.o 
$(top_builddir)/src/backend/parser/keywords.o
! dropdb: dropdb.o common.o dumputils.o $(top_builddir)/src/backend/parser/keywords.o
! droplang: droplang.o common.o print.o mbprint.o
! dropuser: dropuser.o common.o dumputils.o 
$(top_builddir)/src/backend/parser/keywords.o
! clusterdb: clusterdb.o common.o dumputils.o 
$(top_builddir)/src/backend/parser/keywords.o
! vacuumdb: vacuumdb.o common.o
  
  dumputils.c: % : $(top_srcdir)/src/bin/pg_dump/%
        rm -f $@ && $(LN_S) $< .
  
  print.c mbprint.c : % : $(top_srcdir)/src/bin/psql/%
        rm -f $@ && $(LN_S) $< .
  
***************
*** 64,68 ****
  
  clean distclean maintainer-clean:
        rm -f $(addsuffix $(X), $(PROGRAMS)) $(addsuffix .o, $(PROGRAMS))
!       rm -f common.o dumputils.o exec.o print.o mbprint.o
!       rm -f dumputils.c exec.c print.c mbprint.c
--- 61,65 ----
  
  clean distclean maintainer-clean:
        rm -f $(addsuffix $(X), $(PROGRAMS)) $(addsuffix .o, $(PROGRAMS))
!       rm -f common.o dumputils.o print.o mbprint.o
!       rm -f dumputils.c print.c mbprint.c
Index: src/interfaces/ecpg/preproc/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/ecpg/preproc/Makefile,v
retrieving revision 1.107
diff -c -c -r1.107 Makefile
*** src/interfaces/ecpg/preproc/Makefile        24 May 2004 01:01:38 -0000      1.107
--- src/interfaces/ecpg/preproc/Makefile        1 Oct 2004 04:04:11 -0000
***************
*** 1,4 ****
! # $PostgreSQL: pgsql-server/src/interfaces/ecpg/preproc/Makefile,v 1.107 2004/05/24 
01:01:38 momjian Exp $
  
  subdir = src/interfaces/ecpg/preproc
  top_builddir = ../../../..
--- 1,12 ----
! #-------------------------------------------------------------------------
! #
! # Makefile for src/interfaces/ecpg/preproc
! #
! # Copyright (c) 1998-2002, PostgreSQL Global Development Group
! #
! # $PostgreSQL: pgsql-server/src/bin/pg_controldata/Makefile,v 1.9 2004/05/26 
17:24:01 tgl Exp $
! #
! #-------------------------------------------------------------------------
  
  subdir = src/interfaces/ecpg/preproc
  top_builddir = ../../../..
***************
*** 10,17 ****
  
  override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) \
        -DMAJOR_VERSION=$(MAJOR_VERSION) \
!       -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
!       -DFRONTEND
  
  ifeq ($(GCC), yes)
  override CFLAGS += -Wno-error
--- 18,24 ----
  
  override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) \
        -DMAJOR_VERSION=$(MAJOR_VERSION) \
!       -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL)
  
  ifeq ($(GCC), yes)
  override CFLAGS += -Wno-error
***************
*** 19,35 ****
  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 \
!       exec.o
  
  all: submake-libpgport ecpg
  
  ecpg: $(OBJS)
        $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) $(PTHREAD_LIBS) -o [EMAIL PROTECTED](X)
  
- exec.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  # pgc is compiled as part of preproc
  preproc.o: $(srcdir)/pgc.c
  
--- 26,38 ----
  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
  
  all: submake-libpgport ecpg
  
  ecpg: $(OBJS)
        $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) $(PTHREAD_LIBS) -o [EMAIL PROTECTED](X)
  
  # pgc is compiled as part of preproc
  preproc.o: $(srcdir)/pgc.c
  
***************
*** 66,72 ****
        rm -f $(DESTDIR)$(bindir)/ecpg$(X)
  
  clean distclean:
!       rm -f *.o ecpg$(X) exec.c
  # garbage from partial builds
        @rm -f y.tab.c y.tab.h
  # garbage from development
--- 69,75 ----
        rm -f $(DESTDIR)$(bindir)/ecpg$(X)
  
  clean distclean:
!       rm -f *.o ecpg$(X)
  # garbage from partial builds
        @rm -f y.tab.c y.tab.h
  # garbage from development
Index: src/port/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/Makefile,v
retrieving revision 1.18
diff -c -c -r1.18 Makefile
*** src/port/Makefile   28 Aug 2004 22:55:06 -0000      1.18
--- src/port/Makefile   1 Oct 2004 04:04:11 -0000
***************
*** 1,6 ****
  #-------------------------------------------------------------------------
  #
! # Makefile--
  #    Makefile for the port-specific subsystem of the backend
  #
  # These files are used in other directories for portability on systems
--- 1,6 ----
  #-------------------------------------------------------------------------
  #
! # Makefile
  #    Makefile for the port-specific subsystem of the backend
  #
  # These files are used in other directories for portability on systems
***************
*** 15,24 ****
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := -I$(top_builddir)/src/port $(CPPFLAGS)
  LIBS += $(PTHREAD_LIBS)
  
! all: libpgport.a
  
  # libpgport is needed by some contrib
  install-all-headers: 
--- 15,26 ----
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
  LIBS += $(PTHREAD_LIBS)
  
! LIBOBJS_SRV := $(subst .o,_srv.o, $(filter dirmod.o exec.o getaddrinfo.o thread.o, 
$(LIBOBJS)))
! 
! all: libpgport.a libpgport_srv.a
  
  # libpgport is needed by some contrib
  install-all-headers: 
***************
*** 30,40 ****
--- 32,60 ----
  libpgport.a: $(LIBOBJS)
        $(AR) $(AROPT) $@ $^
  
+ libpgport_srv.a: $(LIBOBJS_SRV)
+       $(AR) $(AROPT) $@ $^
+ 
  thread.o: thread.c
        $(CC) $(CFLAGS) $(CPPFLAGS) $(PTHREAD_CFLAGS) -c $<
  
  path.o: path.c pg_config_paths.h
  
+ #
+ # Server versions of object files
+ #
+ dirmod_srv.o: dirmod.c
+       $(CC) $(CFLAGS) $(CPPFLAGS) -UFRONTEND -c $< -o $@
+ 
+ exec_srv.o: exec.c
+       $(CC) $(CFLAGS) $(CPPFLAGS) -UFRONTEND -c $< -o $@
+ 
+ getaddrinfo_srv.o: getaddrinfo.c
+       $(CC) $(CFLAGS) $(CPPFLAGS) -UFRONTEND -c $< -o $@
+ 
+ thread_srv.o: thread.c
+       $(CC) $(CFLAGS) $(CPPFLAGS) $(PTHREAD_CFLAGS) -UFRONTEND -c $< -o $@
+ 
  # Dependency is to ensure that path changes propagate
  pg_config_paths.h: $(top_builddir)/src/Makefile.global
        echo "#define PGBINDIR \"$(bindir)\"" >$@
***************
*** 48,51 ****
        echo "#define LOCALEDIR \"$(localedir)\"" >>$@
  
  clean distclean maintainer-clean:
!       rm -f libpgport.a $(LIBOBJS) pg_config_paths.h
--- 68,71 ----
        echo "#define LOCALEDIR \"$(localedir)\"" >>$@
  
  clean distclean maintainer-clean:
!       rm -f libpgport.a $(LIBOBJS) $(LIBOBJS_SRV) pg_config_paths.h
Index: src/port/getaddrinfo.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/getaddrinfo.c,v
retrieving revision 1.15
diff -c -c -r1.15 getaddrinfo.c
*** src/port/getaddrinfo.c      28 Sep 2004 00:07:01 -0000      1.15
--- src/port/getaddrinfo.c      1 Oct 2004 04:04:12 -0000
***************
*** 26,31 ****
--- 26,32 ----
  #include <netdb.h>
  #include <netinet/in.h>
  #include <arpa/inet.h>
+ #include <rpc/types.h>
  #endif
  
  #include "getaddrinfo.h"
Index: src/timezone/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/timezone/Makefile,v
retrieving revision 1.15
diff -c -c -r1.15 Makefile
*** src/timezone/Makefile       8 Aug 2004 05:19:44 -0000       1.15
--- src/timezone/Makefile       1 Oct 2004 04:04:13 -0000
***************
*** 1,6 ****
  #-------------------------------------------------------------------------
  #
! # Makefile--
  #    Makefile for the timezone library
  
  # IDENTIFICATION
--- 1,6 ----
  #-------------------------------------------------------------------------
  #
! # Makefile
  #    Makefile for the timezone library
  
  # IDENTIFICATION
***************
*** 12,24 ****
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
  
  # files to build into backend
  OBJS= localtime.o strftime.o pgtz.o
  
  # files needed to build zic utility program
! ZICOBJS= zic.o ialloc.o scheck.o localtime.o dirmod.o
  
  # timezone data files
  TZDATA := africa antarctica asia australasia europe northamerica southamerica \
--- 12,24 ----
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global
  
! override CPPFLAGS := $(CPPFLAGS)
  
  # files to build into backend
  OBJS= localtime.o strftime.o pgtz.o
  
  # files needed to build zic utility program
! ZICOBJS= zic.o ialloc.o scheck.o localtime.o
  
  # timezone data files
  TZDATA := africa antarctica asia australasia europe northamerica southamerica \
***************
*** 33,41 ****
  zic: $(ZICOBJS)
        $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o [EMAIL PROTECTED](X)
  
- dirmod.c: % : $(top_srcdir)/src/port/%
-       rm -f $@ && $(LN_S) $< .
- 
  install: all installdirs
        ./zic -d $(DESTDIR)$(datadir)/timezone $(TZDATAFILES)
  
--- 33,38 ----
***************
*** 43,46 ****
        $(mkinstalldirs) $(DESTDIR)$(datadir)
  
  clean distclean maintainer-clean:
!       rm -f SUBSYS.o zic $(OBJS) $(ZICOBJS) dirmod.c
--- 40,43 ----
        $(mkinstalldirs) $(DESTDIR)$(datadir)
  
  clean distclean maintainer-clean:
!       rm -f SUBSYS.o zic $(OBJS) $(ZICOBJS)
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to