>From e642619702bab9d37056486399bd8b7b6adc9abc Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Tue, 23 Dec 2014 13:56:19 +0900
Subject: [PATCH 05/13] Move pgbench from contrib/ to src/bin/

---
 contrib/Makefile                        |  1 -
 doc/src/sgml/contrib.sgml               |  1 -
 doc/src/sgml/reference.sgml             |  1 +
 src/bin/Makefile                        |  1 +
 {contrib => src/bin}/pgbench/.gitignore |  0
 {contrib => src/bin}/pgbench/Makefile   | 18 +++++++-----------
 {contrib => src/bin}/pgbench/pgbench.c  |  2 +-
 7 files changed, 10 insertions(+), 14 deletions(-)
 rename {contrib => src/bin}/pgbench/.gitignore (100%)
 rename {contrib => src/bin}/pgbench/Makefile (59%)
 rename {contrib => src/bin}/pgbench/pgbench.c (99%)

diff --git a/contrib/Makefile b/contrib/Makefile
index 8f0d926..12c7500 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -37,7 +37,6 @@ SUBDIRS = \
 		pg_trgm		\
 		pg_upgrade	\
 		pg_upgrade_support \
-		pgbench		\
 		pgcrypto	\
 		pgrowlocks	\
 		pgstattuple	\
diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml
index dbe9d0a..60c07ea 100644
--- a/doc/src/sgml/contrib.sgml
+++ b/doc/src/sgml/contrib.sgml
@@ -187,7 +187,6 @@ pages.
   </para>
 
  &oid2name;
- &pgbench;
  &vacuumlo;
  </sect1>
 
diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml
index de2cdff..a839af7 100644
--- a/doc/src/sgml/reference.sgml
+++ b/doc/src/sgml/reference.sgml
@@ -230,6 +230,7 @@
    &dropuser;
    &ecpgRef;
    &pgBasebackup;
+   &pgbench;
    &pgConfig;
    &pgDump;
    &pgDumpall;
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 54c61c9..d27096e 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -24,6 +24,7 @@ SUBDIRS = \
 	pg_resetxlog \
 	pg_standby \
 	pg_xlogdump \
+	pgbench \
 	psql \
 	scripts
 
diff --git a/contrib/pgbench/.gitignore b/src/bin/pgbench/.gitignore
similarity index 100%
rename from contrib/pgbench/.gitignore
rename to src/bin/pgbench/.gitignore
diff --git a/contrib/pgbench/Makefile b/src/bin/pgbench/Makefile
similarity index 59%
rename from contrib/pgbench/Makefile
rename to src/bin/pgbench/Makefile
index b8e2fc8..de4863c 100644
--- a/contrib/pgbench/Makefile
+++ b/src/bin/pgbench/Makefile
@@ -1,24 +1,20 @@
-# contrib/pgbench/Makefile
+# src/bin/pgbench/Makefile
 
 PGFILEDESC = "pgbench - a simple program for running benchmark tests"
 PGAPPICON = win32
 
+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)
 
-ifdef USE_PGXS
-PG_CONFIG = pg_config
-PGXS := $(shell $(PG_CONFIG) --pgxs)
-include $(PGXS)
-else
-subdir = contrib/pgbench
-top_builddir = ../..
-include $(top_builddir)/src/Makefile.global
-include $(top_srcdir)/contrib/contrib-global.mk
-endif
+NO_PGXS = 1
+include $(top_srcdir)/src/makefiles/pgxs.mk
 
 ifneq ($(PORTNAME), win32)
 override CFLAGS += $(PTHREAD_CFLAGS)
diff --git a/contrib/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
similarity index 99%
rename from contrib/pgbench/pgbench.c
rename to src/bin/pgbench/pgbench.c
index 25616ce..1c3b3d6 100644
--- a/contrib/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -4,7 +4,7 @@
  * A simple benchmark program for PostgreSQL
  * Originally written by Tatsuo Ishii and enhanced by many contributors.
  *
- * contrib/pgbench/pgbench.c
+ * src/bin/pgbench/pgbench.c
  * Copyright (c) 2000-2015, PostgreSQL Global Development Group
  * ALL RIGHTS RESERVED;
  *
-- 
2.2.1.212.gc5b9256

