Make libpgport FRONTEND/no-FRONTEND library versions - Mailing list pgsql-patches

From Bruce Momjian
Subject Make libpgport FRONTEND/no-FRONTEND library versions
Date
Msg-id 200410041345.i94DjEr05653@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
The attached applied patch makes libpgport be front-end only and adds
libpgport_srv be a backend library that uses palloc, ereport, etc.  This
simplifies the makefiles for client applications.

--
  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/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    4 Oct 2004 13:32:14 -0000
***************
*** 26,31 ****
--- 26,33 ----
  OBJS+= bootstrap/bootstrap.o
  endif

+ # Use server version of port library
+ LIBS := $(patsubst -lpgport,-lpgport_srv, $(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    4 Oct 2004 13:32:35 -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 $@$(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 $@$(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    4 Oct 2004 13:32:37 -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 $@$(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 $@$(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    4 Oct 2004 13:32:38 -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    4 Oct 2004 13:32:38 -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 $@$(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 $@$(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    4 Oct 2004 13:32:39 -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 $@$(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 $@$(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 $@$(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)

  .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.oexec.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    4 Oct 2004 13:32:41 -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 $@$(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 $@$(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    4 Oct 2004 13:32:42 -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 $@$(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    4 Oct 2004 13:32:42 -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 $@$(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 $@$(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    4 Oct 2004 13:32:48 -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 $@$(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 $@$(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    4 Oct 2004 13:32:51 -0000
***************
*** 1,11 ****
  #-------------------------------------------------------------------------
  #
! # Makefile--
  #    Makefile for the port-specific subsystem of the backend
  #
  # These files are used in other directories for portability on systems
! # with broken/missing library files.
!
  # IDENTIFICATION
  #    $PostgreSQL: pgsql-server/src/port/Makefile,v 1.18 2004/08/28 22:55:06 momjian Exp $
  #
--- 1,19 ----
  #-------------------------------------------------------------------------
  #
! # Makefile
  #    Makefile for the port-specific subsystem of the backend
  #
  # These files are used in other directories for portability on systems
! # with broken/missing library files, and for common code sharing.
! #
! # This makefile generates two outputs:
! #
! #    libpgport.a - contains object files with FRONTEND defined,
! #        for use by client application and libraries
! #
! #    libpgport_srv.a - contains object files without FRONTEND defined,
! #        for use only by the backend binaries
! #
  # IDENTIFICATION
  #    $PostgreSQL: pgsql-server/src/port/Makefile,v 1.18 2004/08/28 22:55:06 momjian Exp $
  #
***************
*** 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:
--- 23,39 ----
  top_builddir = ../..
  include $(top_builddir)/src/Makefile.global

! override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
  LIBS += $(PTHREAD_LIBS)

! # Replace object files that use FRONTEND define
! LIBOBJS_SRV := $(LIBOBJS)
! LIBOBJS_SRV := $(patsubst dirmod.o,dirmod_srv.o, $(LIBOBJS_SRV))
! LIBOBJS_SRV := $(patsubst exec.o,exec_srv.o, $(LIBOBJS_SRV))
! LIBOBJS_SRV := $(patsubst getaddrinfo.o,getaddrinfo_srv.o, $(LIBOBJS_SRV))
! LIBOBJS_SRV := $(patsubst thread.o,thread_srv.o, $(LIBOBJS_SRV))
!
! all: libpgport.a libpgport_srv.a

  # libpgport is needed by some contrib
  install-all-headers:
***************
*** 35,40 ****
--- 50,75 ----

  path.o: path.c pg_config_paths.h

+ #
+ # Server versions of object files
+ #
+
+ libpgport_srv.a: $(LIBOBJS_SRV)
+     $(AR) $(AROPT) $@ $^
+
+ dirmod_srv.o: dirmod.c
+     $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
+
+ exec_srv.o: exec.c
+     $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
+
+ getaddrinfo_srv.o: getaddrinfo.c
+     $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -c $< -o $@
+
+ # No thread flags for server version
+ thread_srv.o: thread.c
+     $(CC) $(CFLAGS) $(subst -DFRONTEND,, $(CPPFLAGS)) -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
--- 83,86 ----
      echo "#define LOCALEDIR \"$(localedir)\"" >>$@

  clean distclean maintainer-clean:
!     rm -f libpgport.a libpgport_srv.a $(LIBOBJS) $(LIBOBJS_SRV) pg_config_paths.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    4 Oct 2004 13:32:54 -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 $@$(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)

pgsql-patches by date:

Previous
From: "Dave Page"
Date:
Subject: FW: Win32 fix for miscinit.c
Next
From: Andrew Dunstan
Date:
Subject: Re: FW: Win32 fix for miscinit.c