From a7032690f96efde6e05f166c21c583b02bf71bd2 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Fri, 25 Mar 2005 23:22:54 +0000
Subject: [PATCH] Use 'cp' and 'chmod' in place of 'install' to install header
 files. This reduces header file install from 8 seconds to 0.40 seconds.

---
 src/Makefile.global.in |  8 +++++---
 src/include/Makefile   | 13 ++++++-------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 99faf46b80c..475902bc470 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -1,5 +1,5 @@
 # -*-makefile-*-
-# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.212 2005/03/25 18:17:12 momjian Exp $
+# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.213 2005/03/25 23:22:53 momjian Exp $
 
 #------------------------------------------------------------------------------
 # All PostgreSQL makefiles include this file and use the variables it sets,
@@ -232,9 +232,11 @@ BZIP2	= bzip2
 
 INSTALL	= $(SHELL) $(top_srcdir)/config/install-sh -c
 
+INSTALL_SCRIPT_MODE	= 755
+INSTALL_DATA_MODE	= 644
 INSTALL_PROGRAM	= $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
-INSTALL_SCRIPT	= $(INSTALL) -m 755
-INSTALL_DATA	= $(INSTALL) -m 644
+INSTALL_SCRIPT	= $(INSTALL) -m $(INSTALL_SCRIPT_MODE)
+INSTALL_DATA	= $(INSTALL) -m $(INSTALL_DATA_MODE)
 INSTALL_STLIB	= $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
 INSTALL_SHLIB	= $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
 # Override in Makefile.port if necessary
diff --git a/src/include/Makefile b/src/include/Makefile
index 0471869407e..beff38e4896 100644
--- a/src/include/Makefile
+++ b/src/include/Makefile
@@ -4,7 +4,7 @@
 #
 # 'make install' installs whole contents of src/include.
 #
-# $PostgreSQL: pgsql/src/include/Makefile,v 1.19 2005/01/06 21:00:24 tgl Exp $
+# $PostgreSQL: pgsql/src/include/Makefile,v 1.20 2005/03/25 23:22:54 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -37,13 +37,12 @@ install: all installdirs
 # These headers are needed for server-side development
 	$(INSTALL_DATA) pg_config.h    $(DESTDIR)$(includedir_server)
 	$(INSTALL_DATA) pg_config_os.h $(DESTDIR)$(includedir_server)
-	for file in $(srcdir)/*.h; do \
-	  $(INSTALL_DATA) $$file $(DESTDIR)$(includedir_server)/`basename $$file` || exit; \
-	done
+# We don't use INSTALL_DATA for performance reasons --- there are a lot of files
+	cp $(srcdir)/*.h $(DESTDIR)$(includedir_server)/ || exit; \
+	chmod $(INSTALL_DATA_MODE) $(DESTDIR)$(includedir_server)/*.h  || exit; \
 	for dir in $(SUBDIRS); do \
-	  for file in $(srcdir)/$$dir/*.h; do \
-	    $(INSTALL_DATA) $$file $(DESTDIR)$(includedir_server)/$$dir/`basename $$file` || exit; \
-	  done \
+	  cp $(srcdir)/$$dir/*.h $(DESTDIR)$(includedir_server)/$$dir/ || exit; \
+	  chmod $(INSTALL_DATA_MODE) $(DESTDIR)$(includedir_server)/$$dir/*.h  || exit; \
 	done
 
 installdirs:
-- 
GitLab