utils C files - Mailing list pgsql-patches

From Bruce Momjian
Subject utils C files
Date
Msg-id 200207152131.g6FLV0218350@candle.pha.pa.us
Whole thread Raw
Responses Re: utils C files
List pgsql-patches
I have applied the following diff to make the sharing of C files among
modules more sane.  Instead of having configure.in set the file name to
strdup.o and have the Makefiles specify the path, I set it to the full
path $(top_builddir)/src/utils/strdup.o and have the makefiles use
that directly, rather than going through with 'make -c dirname
filename'.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql/configure.in,v
retrieving revision 1.187
diff -c -r1.187 configure.in
*** configure.in    7 Jul 2002 20:28:24 -0000    1.187
--- configure.in    15 Jul 2002 21:07:07 -0000
***************
*** 870,877 ****
  # have working "long long int" support -- see below.

  SNPRINTF=''
! AC_CHECK_FUNCS(snprintf, [], SNPRINTF='snprintf.o')
! AC_CHECK_FUNCS(vsnprintf, [], SNPRINTF='snprintf.o')
  AC_SUBST(SNPRINTF)


--- 870,877 ----
  # have working "long long int" support -- see below.

  SNPRINTF=''
! AC_CHECK_FUNCS(snprintf, [], SNPRINTF='$(top_builddir)/src/backend/port/snprintf.o')
! AC_CHECK_FUNCS(vsnprintf, [], SNPRINTF='$(top_builddir)/src/backend/port/snprintf.o')
  AC_SUBST(SNPRINTF)


***************
*** 913,921 ****
  AC_SUBST(MISSING_RANDOM)
  AC_CHECK_FUNCS(inet_aton, [], INET_ATON='inet_aton.o')
  AC_SUBST(INET_ATON)
! AC_CHECK_FUNCS(strerror, [], STRERROR='strerror.o')
  AC_SUBST(STRERROR)
! AC_CHECK_FUNCS(strdup, [], STRDUP='../../utils/strdup.o')
  AC_SUBST(STRDUP)
  AC_CHECK_FUNCS(strtol, [], STRTOL='strtol.o')
  AC_SUBST(STRTOL)
--- 913,921 ----
  AC_SUBST(MISSING_RANDOM)
  AC_CHECK_FUNCS(inet_aton, [], INET_ATON='inet_aton.o')
  AC_SUBST(INET_ATON)
! AC_CHECK_FUNCS(strerror, [], STRERROR='$(top_builddir)/src/backend/port/strerror.o')
  AC_SUBST(STRERROR)
! AC_CHECK_FUNCS(strdup, [], STRDUP='$(top_builddir)/src/utils/strdup.o')
  AC_SUBST(STRDUP)
  AC_CHECK_FUNCS(strtol, [], STRTOL='strtol.o')
  AC_SUBST(STRTOL)
***************
*** 1093,1109 ****
    ],
    [ AC_MSG_RESULT(no)
      # Force usage of our own snprintf, since system snprintf is broken
!     SNPRINTF='snprintf.o'
      INT64_FORMAT='"%lld"'
    ],
    [ AC_MSG_RESULT(assuming not on target machine)
      # Force usage of our own snprintf, since we cannot test foreign snprintf
!     SNPRINTF='snprintf.o'
      INT64_FORMAT='"%lld"'
    ]) ],
    [ AC_MSG_RESULT(assuming not on target machine)
      # Force usage of our own snprintf, since we cannot test foreign snprintf
!     SNPRINTF='snprintf.o'
      INT64_FORMAT='"%lld"'
    ])
    else
--- 1093,1109 ----
    ],
    [ AC_MSG_RESULT(no)
      # Force usage of our own snprintf, since system snprintf is broken
!     SNPRINTF='$(top_builddir)/src/backend/port/snprintf.o'
      INT64_FORMAT='"%lld"'
    ],
    [ AC_MSG_RESULT(assuming not on target machine)
      # Force usage of our own snprintf, since we cannot test foreign snprintf
!     SNPRINTF='$(top_builddir)/src/backend/port/snprintf.o'
      INT64_FORMAT='"%lld"'
    ]) ],
    [ AC_MSG_RESULT(assuming not on target machine)
      # Force usage of our own snprintf, since we cannot test foreign snprintf
!     SNPRINTF='$(top_builddir)/src/backend/port/snprintf.o'
      INT64_FORMAT='"%lld"'
    ])
    else
Index: doc/FAQ_Solaris
===================================================================
RCS file: /cvsroot/pgsql/doc/FAQ_Solaris,v
retrieving revision 1.14
diff -c -r1.14 FAQ_Solaris
*** doc/FAQ_Solaris    4 Mar 2002 17:47:11 -0000    1.14
--- doc/FAQ_Solaris    15 Jul 2002 21:07:07 -0000
***************
*** 94,100 ****
  (1) In src/Makefile.global, change the line
      SNPRINTF =
  to read
!     SNPRINTF = snprintf.o

  (2) In src/backend/port/Makefile, add "snprintf.o" to OBJS.  (Skip this
  step if you see "$(SNPRINTF)" already listed in OBJS.)
--- 94,100 ----
  (1) In src/Makefile.global, change the line
      SNPRINTF =
  to read
!     SNPRINTF = $(top_builddir)/src/backend/port/snprint.o

  (2) In src/backend/port/Makefile, add "snprintf.o" to OBJS.  (Skip this
  step if you see "$(SNPRINTF)" already listed in OBJS.)
Index: src/backend/port/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/backend/port/Makefile,v
retrieving revision 1.13
diff -c -r1.13 Makefile
*** src/backend/port/Makefile    5 May 2002 16:02:37 -0000    1.13
--- src/backend/port/Makefile    15 Jul 2002 21:07:16 -0000
***************
*** 21,54 ****
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global

! OBJS = dynloader.o pg_sema.o pg_shmem.o

! OBJS += $(GETHOSTNAME) $(GETRUSAGE) $(INET_ATON) $(ISINF) $(MEMCMP) \
!         $(MISSING_RANDOM) $(SNPRINTF) $(SRANDOM) $(STRCASECMP) $(STRERROR) \
!         $(STRTOL) $(STRTOUL)

! OBJS += $(TAS)

- ifdef STRDUP
- OBJS += $(top_builddir)/src/utils/strdup.o
- endif
  ifeq ($(PORTNAME), qnx4)
! OBJS += getrusage.o qnx4/SUBSYS.o
  endif
  ifeq ($(PORTNAME), beos)
! OBJS += beos/SUBSYS.o
  endif
  ifeq ($(PORTNAME), darwin)
! OBJS += darwin/SUBSYS.o
  endif

  all: SUBSYS.o

  SUBSYS.o: $(OBJS)
      $(LD) $(LDREL) $(LDOUT) $@ $^
-
- $(top_builddir)/src/utils/strdup.o:
-     $(MAKE) -C $(top_builddir)/src/utils strdup.o

  qnx4/SUBSYS.o: qnx4.dir

--- 21,48 ----
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global

! OBJS=dynloader.o pg_sema.o pg_shmem.o

! OBJS+=$(GETHOSTNAME) $(GETRUSAGE) $(INET_ATON) $(ISINF) $(MEMCMP) \
!         $(MISSING_RANDOM) $(SNPRINTF) $(SRANDOM) $(STRCASECMP) $(STRDUP) \
!     $(STRERROR) $(STRTOL) $(STRTOUL)

! OBJS+=$(TAS)

  ifeq ($(PORTNAME), qnx4)
! OBJS+=getrusage.o qnx4/SUBSYS.o
  endif
  ifeq ($(PORTNAME), beos)
! OBJS+=beos/SUBSYS.o
  endif
  ifeq ($(PORTNAME), darwin)
! OBJS+=darwin/SUBSYS.o
  endif

  all: SUBSYS.o

  SUBSYS.o: $(OBJS)
      $(LD) $(LDREL) $(LDOUT) $@ $^

  qnx4/SUBSYS.o: qnx4.dir

Index: src/bin/pg_dump/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_dump/Makefile,v
retrieving revision 1.34
diff -c -r1.34 Makefile
*** src/bin/pg_dump/Makefile    6 Jul 2002 20:12:30 -0000    1.34
--- src/bin/pg_dump/Makefile    15 Jul 2002 21:07:17 -0000
***************
*** 14,34 ****
  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 sprompt.o
!
! ifdef STRDUP
! OBJS+=$(top_builddir)/src/utils/strdup.o
!
! $(top_builddir)/src/utils/strdup.o:
!     $(MAKE) -C $(top_builddir)/src/utils strdup.o
! endif
!
! ifdef STRTOUL
! OBJS+=$(top_builddir)/src/backend/port/strtoul.o
!
! $(top_builddir)/src/backend/port/strtoul.o:
!     $(MAKE) -C $(top_builddir)/src/backend/port strtoul.o
! endif

  override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)

--- 14,21 ----
  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 sprompt.o \
!       $(STRDUP) $(STRTOUL)

  override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)

Index: src/bin/psql/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/Makefile,v
retrieving revision 1.33
diff -c -r1.33 Makefile
*** src/bin/psql/Makefile    6 Jul 2002 20:12:30 -0000    1.33
--- src/bin/psql/Makefile    15 Jul 2002 21:07:17 -0000
***************
*** 17,57 ****

  override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)

! 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 \
!     sprompt.o tab-complete.o mbprint.o

  all: submake psql
-
- ifdef STRDUP
- OBJS+=$(top_builddir)/src/utils/strdup.o
-
- $(top_builddir)/src/utils/strdup.o:
-     $(MAKE) -C $(top_builddir)/src/utils strdup.o
- endif
-
- # Move these to the utils directory?
-
- ifdef STRERROR
- OBJS+=$(top_builddir)/src/backend/port/strerror.o
-
- $(top_builddir)/src/backend/port/strerror.o:
-     $(MAKE) -C $(top_builddir)/src/backend/port strerror.o
- endif
-
- ifdef SNPRINTF
- OBJS+=$(top_builddir)/src/backend/port/snprintf.o
-
- $(top_builddir)/src/backend/port/snprintf.o:
-     $(MAKE) -C $(top_builddir)/src/backend/port snprintf.o
- endif
-
- ifdef STRTOUL
- OBJS+=$(top_builddir)/src/backend/port/strtoul.o
-
- $(top_builddir)/src/backend/port/strtoul.o:
-     $(MAKE) -C $(top_builddir)/src/backend/port strtoul.o
- endif

  # End of hacks for picking up backend 'port' modules

--- 17,28 ----

  override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)

! 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 \
!     sprompt.o tab-complete.o mbprint.o $(SNPRINTF) $(STRDUP) \
!     $(STRERROR) $(STRTOUL)

  all: submake psql

  # End of hacks for picking up backend 'port' modules

Index: src/interfaces/ecpg/preproc/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Makefile,v
retrieving revision 1.83
diff -c -r1.83 Makefile
*** src/interfaces/ecpg/preproc/Makefile    11 Mar 2002 12:56:02 -0000    1.83
--- src/interfaces/ecpg/preproc/Makefile    15 Jul 2002 21:07:17 -0000
***************
*** 18,40 ****
  endif

  OBJS=preproc.o pgc.o type.o ecpg.o ecpg_keywords.o output.o\
!     keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o

  all: ecpg
-
- ifdef SNPRINTF
- OBJS+=$(top_builddir)/src/backend/port/snprintf.o
-
- $(top_builddir)/src/backend/port/snprintf.o:
-     $(MAKE) -C $(top_builddir)/src/backend/port snprintf.o
- endif
-
- ifdef STRDUP
- OBJS+=$(top_builddir)/src/utils/strdup.o
-
- $(top_builddir)/src/utils/strdup.o:
-     $(MAKE) -C $(top_builddir)/src/utils strdup.o
- endif

  ecpg: $(OBJS)
      $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
--- 18,27 ----
  endif

  OBJS=preproc.o pgc.o type.o ecpg.o ecpg_keywords.o output.o\
!     keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o \
!     $(SNPRINTF) $(STRDUP)

  all: ecpg

  ecpg: $(OBJS)
      $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
Index: src/utils/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/utils/Makefile,v
retrieving revision 1.9
diff -c -r1.9 Makefile
*** src/utils/Makefile    31 Aug 2000 16:12:35 -0000    1.9
--- src/utils/Makefile    15 Jul 2002 21:07:18 -0000
***************
*** 22,27 ****
--- 22,29 ----
  include $(top_builddir)/src/Makefile.global

  all:
+     # Nothing required here.  These C files are compiled in
+     # directories as needed.

  clean distclean maintainer-clean:
      rm -f dllinit.o getopt.o strdup.o

pgsql-patches by date:

Previous
From: shockwave
Date:
Subject:
Next
From: Peter Eisentraut
Date:
Subject: Re: utils C files