On Sat, Jan 17, 2015 at 10:08 PM, Andres Freund <and...@2ndquadrant.com> wrote:
> Observations:
> 1) Are we sure it's a good idea to rely on pgxs.mk in src/bin programs?
Yeah, this seems like a bad dependency, PGXS being made for contrib
modules... So corrected in the patch attached (the headers of the
Makefiles are improved as well to be consistent with the other
utilities, btw there is code duplication in each Makefile if we do not
use PGXS stuff in src/bin).

> 4) I have doubts that it's ok to integrate the tests in src/bin just the
>    way they were done in contrib.
Are you referring to the tests of pg_upgrade?

> 5) Doing the msvc support for all intermediate commits in a separate
>    commit strikes me as a bad idea. Essentially that makes the split
>    pretty pointless.
> 6) Similarly I'd much rather see the doc movement in the same commit as
>    the actually moved utility. Then we can start applying this one by one
>    on whatever we have agreement.
Well, sure. The split was done just to facilitate review with stuff to
be applied directly on top of what Peter already did. And note that I
agree as well that everything should be done in a single commit.
Separating things would break build on a platform or another if a
build is done based on an intermediate state of this work, that would
not be nice.

> 7) Are we sure that the authors in the affected contrib modules are ok
>    with their authorship notice being removed? I don't think Ants, Bruce
>    or Simon have a problem with that, but ...
Yeah, agreed that I have really too aggressive with what I did. Let's
CC all the authors on this thread and get directly their permission to
process then. Some people may accept, other no, so let's see.

> 8) Why did you remove Peter as the git author?
I applied on my local repo this series of patches after some bash-ing
without preserving any meta data, so the author name has just been
changed on the way, and then ran a simple git format to generate the
whole set once again. Well, sorry if this was confusing, but let's be
clear anyway: I have no intention to make mine the work of Peter (or
any other people).

> I've also pushed the git tree of these changes to
> http://git.postgresql.org/gitweb/?p=users/andresfreund/postgres.git;a=summary
> branch move-contrib-bins-to-bin
That's helpful. I just picked it up and built the patch attached that
can be applied on top of it, correcting the Makefiles and the
reference to the authors in the docs.

FWIW, my branch, based on yours is here:
https://github.com/michaelpq/postgres/tree/contrib_to_bin
Regards,
-- 
Michael
From 7b55ad274aa30d43cfdabb822f72257b3cec8336 Mon Sep 17 00:00:00 2001
From: Michael Paquier <mich...@otacoo.com>
Date: Sun, 18 Jan 2015 21:01:02 +0900
Subject: [PATCH] Fix Makefiles and re-add author references

---
 doc/src/sgml/ref/pgarchivecleanup.sgml |  8 ++++++++
 doc/src/sgml/ref/pgstandby.sgml        |  8 ++++++++
 doc/src/sgml/ref/pgtestfsync.sgml      |  8 ++++++++
 doc/src/sgml/ref/pgtesttiming.sgml     |  8 ++++++++
 src/bin/pg_archivecleanup/Makefile     | 30 +++++++++++++++++++++++----
 src/bin/pg_standby/Makefile            | 30 +++++++++++++++++++++++----
 src/bin/pg_test_fsync/Makefile         | 28 ++++++++++++++++++++++---
 src/bin/pg_test_timing/Makefile        | 28 ++++++++++++++++++++++---
 src/bin/pg_upgrade/Makefile            | 37 ++++++++++++++++++++++++++--------
 src/bin/pg_xlogdump/Makefile           | 33 ++++++++++++++++++++++++------
 src/bin/pgbench/Makefile               | 33 ++++++++++++++++++++++++------
 11 files changed, 217 insertions(+), 34 deletions(-)

diff --git a/doc/src/sgml/ref/pgarchivecleanup.sgml b/doc/src/sgml/ref/pgarchivecleanup.sgml
index 2665c53..f9f32e9 100644
--- a/doc/src/sgml/ref/pgarchivecleanup.sgml
+++ b/doc/src/sgml/ref/pgarchivecleanup.sgml
@@ -197,6 +197,14 @@ archive_cleanup_command = 'pg_archivecleanup -d /mnt/standby/archive %r 2>>clean
  </refsect1>
 
  <refsect1>
+  <title>Author</title>
+
+  <para>
+   Simon Riggs <email>si...@2ndquadrant.com</email>
+  </para>
+ </refsect1>
+
+ <refsect1>
   <title>See Also</title>
 
   <simplelist type="inline">
diff --git a/doc/src/sgml/ref/pgstandby.sgml b/doc/src/sgml/ref/pgstandby.sgml
index 87d5043..698a6c2 100644
--- a/doc/src/sgml/ref/pgstandby.sgml
+++ b/doc/src/sgml/ref/pgstandby.sgml
@@ -380,6 +380,14 @@ recovery_end_command = 'del C:\pgsql.trigger.5442'
  </refsect1>
 
  <refsect1>
+  <title>Author</title>
+
+  <para>
+   Simon Riggs <email>si...@2ndquadrant.com</email>
+  </para>
+ </refsect1>
+
+ <refsect1>
   <title>See Also</title>
 
   <simplelist type="inline">
diff --git a/doc/src/sgml/ref/pgtestfsync.sgml b/doc/src/sgml/ref/pgtestfsync.sgml
index 3f76071..f704ab5 100644
--- a/doc/src/sgml/ref/pgtestfsync.sgml
+++ b/doc/src/sgml/ref/pgtestfsync.sgml
@@ -107,6 +107,14 @@ PostgreSQL documentation
  </refsect1>
 
  <refsect1>
+  <title>Author</title>
+
+  <para>
+   Bruce Momjian <email>br...@momjian.us</email>
+  </para>
+ </refsect1>
+
+ <refsect1>
   <title>See Also</title>
 
   <simplelist type="inline">
diff --git a/doc/src/sgml/ref/pgtesttiming.sgml b/doc/src/sgml/ref/pgtesttiming.sgml
index 9850538..d1279fc 100644
--- a/doc/src/sgml/ref/pgtesttiming.sgml
+++ b/doc/src/sgml/ref/pgtesttiming.sgml
@@ -294,6 +294,14 @@ Histogram of timing durations:
  </refsect1>
 
  <refsect1>
+  <title>Author</title>
+
+  <para>
+   Ants Aasma <email>ants.aa...@eesti.ee</email>
+  </para>
+ </refsect1>
+
+ <refsect1>
   <title>See Also</title>
 
   <simplelist type="inline">
diff --git a/src/bin/pg_archivecleanup/Makefile b/src/bin/pg_archivecleanup/Makefile
index 5df86eb..b7d792e 100644
--- a/src/bin/pg_archivecleanup/Makefile
+++ b/src/bin/pg_archivecleanup/Makefile
@@ -1,4 +1,13 @@
+#-------------------------------------------------------------------------
+#
+# Makefile for src/bin/pg_archivecleanup
+#
+# Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
 # src/bin/pg_archivecleanup/Makefile
+#
+#-------------------------------------------------------------------------
 
 PGFILEDESC = "pg_archivecleanup - cleans archive when used with streaming replication"
 PGAPPICON = win32
@@ -7,8 +16,21 @@ subdir = src/bin/pg_archivecleanup
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-PROGRAM = pg_archivecleanup
-OBJS	= pg_archivecleanup.o $(WIN32RES)
+OBJS = pg_archivecleanup.o $(WIN32RES)
 
-NO_PGXS = 1
-include $(top_srcdir)/src/makefiles/pgxs.mk
+all: pg_archivecleanup
+
+pg_archivecleanup: $(OBJS)
+	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+
+install: all installdirs
+	$(INSTALL_PROGRAM) pg_archivecleanup$(X) '$(DESTDIR)$(bindir)/pg_archivecleanup$(X)'
+
+installdirs:
+	$(MKDIR_P) '$(DESTDIR)$(bindir)'
+
+uninstall:
+	rm -f '$(DESTDIR)$(bindir)/pg_archivecleanup$(X)'
+
+clean distclean maintainer-clean:
+	rm -f pg_archivecleanup$(X) $(OBJS)
diff --git a/src/bin/pg_standby/Makefile b/src/bin/pg_standby/Makefile
index d45a47d..a975eae 100644
--- a/src/bin/pg_standby/Makefile
+++ b/src/bin/pg_standby/Makefile
@@ -1,4 +1,13 @@
+#-------------------------------------------------------------------------
+#
+# Makefile for src/bin/pg_standby
+#
+# Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
 # src/bin/pg_standby/Makefile
+#
+#-------------------------------------------------------------------------
 
 PGFILEDESC = "pg_standby - supports creation of a warm standby"
 PGAPPICON = win32
@@ -7,8 +16,21 @@ subdir = src/bin/pg_standby
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-PROGRAM = pg_standby
-OBJS	= pg_standby.o $(WIN32RES)
+OBJS = pg_standby.o $(WIN32RES)
 
-NO_PGXS = 1
-include $(top_srcdir)/src/makefiles/pgxs.mk
+all: pg_standby
+
+pg_standby: $(OBJS)
+	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+
+install: all installdirs
+	$(INSTALL_PROGRAM) pg_standby$(X) '$(DESTDIR)$(bindir)/pg_standby$(X)'
+
+installdirs:
+	$(MKDIR_P) '$(DESTDIR)$(bindir)'
+
+uninstall:
+	rm -f '$(DESTDIR)$(bindir)/pg_standby$(X)'
+
+clean distclean maintainer-clean:
+	rm -f pg_standby$(X) $(OBJS)
diff --git a/src/bin/pg_test_fsync/Makefile b/src/bin/pg_test_fsync/Makefile
index e8d1952..72cf50b 100644
--- a/src/bin/pg_test_fsync/Makefile
+++ b/src/bin/pg_test_fsync/Makefile
@@ -1,4 +1,13 @@
+#-------------------------------------------------------------------------
+#
+# Makefile for src/bin/pg_test_fsync
+#
+# Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
 # src/bin/pg_test_fsync/Makefile
+#
+#-------------------------------------------------------------------------
 
 PGFILEDESC = "pg_test_fsync - test various disk sync methods"
 PGAPPICON = win32
@@ -7,8 +16,21 @@ subdir = src/bin/pg_test_fsync
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-PROGRAM  = pg_test_fsync
 OBJS = pg_test_fsync.o $(WIN32RES)
 
-NO_PGXS = 1
-include $(top_srcdir)/src/makefiles/pgxs.mk
+all: pg_test_fsync
+
+pg_test_fsync: $(OBJS)
+	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+
+install: all installdirs
+	$(INSTALL_PROGRAM) pg_test_fsync$(X) '$(DESTDIR)$(bindir)/pg_test_fsync$(X)'
+
+installdirs:
+	$(MKDIR_P) '$(DESTDIR)$(bindir)'
+
+uninstall:
+	rm -f '$(DESTDIR)$(bindir)/pg_test_fsync$(X)'
+
+clean distclean maintainer-clean:
+	rm -f pg_test_fsync$(X) $(OBJS)
diff --git a/src/bin/pg_test_timing/Makefile b/src/bin/pg_test_timing/Makefile
index f96d2e9..61f0a04 100644
--- a/src/bin/pg_test_timing/Makefile
+++ b/src/bin/pg_test_timing/Makefile
@@ -1,4 +1,13 @@
+#-------------------------------------------------------------------------
+#
+# Makefile for src/bin/pg_test_timing
+#
+# Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
 # src/bin/pg_test_timing/Makefile
+#
+#-------------------------------------------------------------------------
 
 PGFILEDESC = "pg_test_timing - test timing overhead"
 PGAPPICON = win32
@@ -7,8 +16,21 @@ subdir = src/bin/pg_test_timing
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-PROGRAM  = pg_test_timing
 OBJS = pg_test_timing.o $(WIN32RES)
 
-NO_PGXS = 1
-include $(top_srcdir)/src/makefiles/pgxs.mk
+all: pg_test_timing
+
+pg_test_timing: $(OBJS)
+	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+
+install: all installdirs
+	$(INSTALL_PROGRAM) pg_test_timing$(X) '$(DESTDIR)$(bindir)/pg_test_timing$(X)'
+
+installdirs:
+	$(MKDIR_P) '$(DESTDIR)$(bindir)'
+
+uninstall:
+	rm -f '$(DESTDIR)$(bindir)/pg_test_timing$(X)'
+
+clean distclean maintainer-clean:
+	rm -f pg_test_timing$(X) $(OBJS)
diff --git a/src/bin/pg_upgrade/Makefile b/src/bin/pg_upgrade/Makefile
index c22daa5..0f67a76 100644
--- a/src/bin/pg_upgrade/Makefile
+++ b/src/bin/pg_upgrade/Makefile
@@ -1,4 +1,13 @@
+#-------------------------------------------------------------------------
+#
+# Makefile for src/bin/pg_upgrade
+#
+# Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
 # src/bin/pg_upgrade/Makefile
+#
+#-------------------------------------------------------------------------
 
 PGFILEDESC = "pg_upgrade - an in-place binary upgrade utility"
 PGAPPICON = win32
@@ -7,20 +16,32 @@ subdir = src/bin/pg_upgrade
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-PROGRAM  = pg_upgrade
 OBJS = check.o controldata.o dump.o exec.o file.o function.o info.o \
        option.o page.o parallel.o pg_upgrade.o relfilenode.o server.o \
        tablespace.o util.o version.o $(WIN32RES)
 
-PG_CPPFLAGS  = -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir)
-PG_LIBS = $(libpq_pgport)
+override CPPFLAGS := -DFRONTEND -DDLSUFFIX=\"$(DLSUFFIX)\" -I$(srcdir) -I$(libpq_srcdir) $(CPPFLAGS)
 
-EXTRA_CLEAN = analyze_new_cluster.sh delete_old_cluster.sh log/ tmp_check/ \
-              pg_upgrade_dump_globals.sql \
-              pg_upgrade_dump_*.custom pg_upgrade_*.log
+EXTRA_OBJS = analyze_new_cluster.sh delete_old_cluster.sh log/ tmp_check/ \
+	     pg_upgrade_dump_globals.sql \
+	     pg_upgrade_dump_*.custom pg_upgrade_*.log
 
-NO_PGXS = 1
-include $(top_srcdir)/src/makefiles/pgxs.mk
+all: pg_upgrade
+
+pg_upgrade: $(OBJS) | submake-libpq submake-libpgport
+	$(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+
+install: all installdirs
+	$(INSTALL_PROGRAM) pg_upgrade$(X) '$(DESTDIR)$(bindir)/pg_upgrade$(X)'
+
+installdirs:
+	$(MKDIR_P) '$(DESTDIR)$(bindir)'
+
+uninstall:
+	rm -f '$(DESTDIR)$(bindir)/pg_upgrade$(X)'
+
+clean distclean maintainer-clean:
+	rm -rf pg_upgrade$(X) $(OBJS) $(EXTRA_OBJS)
 
 check: test.sh all
 	MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) EXTRA_REGRESS_OPTS="$(EXTRA_REGRESS_OPTS)" $(SHELL) $< --install
diff --git a/src/bin/pg_xlogdump/Makefile b/src/bin/pg_xlogdump/Makefile
index ab8597b..067ed44 100644
--- a/src/bin/pg_xlogdump/Makefile
+++ b/src/bin/pg_xlogdump/Makefile
@@ -1,13 +1,21 @@
+#-------------------------------------------------------------------------
+#
+# Makefile for src/bin/pg_xlogdump
+#
+# Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
 # src/bin/pg_xlogdump/Makefile
+#
+#-------------------------------------------------------------------------
 
 PGFILEDESC = "pg_xlogdump - decode and display WAL"
-PGAPPICON=win32
+PGAPPICON = win32
 
 subdir = src/bin/pg_xlogdump
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-PROGRAM = pg_xlogdump
 OBJS = pg_xlogdump.o compat.o xlogreader.o rmgrdesc.o \
 	$(RMGRDESCOBJS) $(WIN32RES)
 override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
@@ -15,14 +23,27 @@ override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
 RMGRDESCSOURCES = $(notdir $(wildcard $(top_srcdir)/src/backend/access/rmgrdesc/*desc.c))
 RMGRDESCOBJS = $(patsubst %.c,%.o,$(RMGRDESCSOURCES))
 
-EXTRA_CLEAN = $(RMGRDESCSOURCES) xlogreader.c
-
-NO_PGXS = 1
-include $(top_srcdir)/src/makefiles/pgxs.mk
+EXTRA_OBJS = $(RMGRDESCSOURCES) xlogreader.c
 
+all: pg_xlogdump
 
 xlogreader.c: % : $(top_srcdir)/src/backend/access/transam/%
 	rm -f $@ && $(LN_S) $< .
 
 $(RMGRDESCSOURCES): % : $(top_srcdir)/src/backend/access/rmgrdesc/%
 	rm -f $@ && $(LN_S) $< .
+
+pg_xlogdump: $(OBJS)
+	$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+
+install: all installdirs
+	$(INSTALL_PROGRAM) pg_xlogdump$(X) '$(DESTDIR)$(bindir)/pg_xlogdump$(X)'
+
+installdirs:
+	$(MKDIR_P) '$(DESTDIR)$(bindir)'
+
+uninstall:
+	rm -f '$(DESTDIR)$(bindir)/pg_xlogdump$(X)'
+
+clean distclean maintainer-clean:
+	rm -f pg_xlogdump$(X) $(OBJS) $(EXTRA_OBJS)
diff --git a/src/bin/pgbench/Makefile b/src/bin/pgbench/Makefile
index de4863c..5ac7283 100644
--- a/src/bin/pgbench/Makefile
+++ b/src/bin/pgbench/Makefile
@@ -1,4 +1,13 @@
+#-------------------------------------------------------------------------
+#
+# Makefile for src/bin/pgbench
+#
+# Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
+# Portions Copyright (c) 1994, Regents of the University of California
+#
 # src/bin/pgbench/Makefile
+#
+#-------------------------------------------------------------------------
 
 PGFILEDESC = "pgbench - a simple program for running benchmark tests"
 PGAPPICON = win32
@@ -7,15 +16,27 @@ subdir = src/bin/pgbench
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-PROGRAM = pgbench
 OBJS	= pgbench.o $(WIN32RES)
 
-PG_CPPFLAGS = -I$(libpq_srcdir)
-PG_LIBS = $(libpq_pgport) $(PTHREAD_LIBS)
-
-NO_PGXS = 1
-include $(top_srcdir)/src/makefiles/pgxs.mk
+override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
 
 ifneq ($(PORTNAME), win32)
 override CFLAGS += $(PTHREAD_CFLAGS)
 endif
+
+all: pgbench
+
+pgbench: $(OBJS) | submake-libpq submake-libpgport
+	$(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(PTHREAD_LIBS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+
+install: all installdirs
+	$(INSTALL_PROGRAM) pgbench$(X) '$(DESTDIR)$(bindir)/pgbench$(X)'
+
+installdirs:
+	$(MKDIR_P) '$(DESTDIR)$(bindir)'
+
+uninstall:
+	rm -f '$(DESTDIR)$(bindir)/pgbench$(X)'
+
+clean distclean maintainer-clean:
+	rm -f pgbench$(X) $(OBJS)
-- 
2.2.2

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to