Reduce worst-case shell command line length during "make install".
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 8 Apr 2018 19:08:32 +0000 (15:08 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 8 Apr 2018 19:08:32 +0000 (15:08 -0400)
Addition of the catalog/pg_foo_d.h headers seems to have pushed us over
the brink of the maximum command line length for some older platforms
during "make install" for our header files.  The main culprit here is
repetition of the target directory path, which could be long.
Rearrange so that we don't repeat that once per file, but only once
per subdirectory.

Per buildfarm.

Discussion: https://postgr.es/m/E1f5Dwm-0004n5-7O@gemulon.postgresql.org

src/include/Makefile

index 59e18c73d71ddccd06576b190fd36fcc747724e5..19d2524e5313f37cacee5c533fc8969c9d19ea75 100644 (file)
@@ -47,18 +47,21 @@ install: all installdirs
    $(INSTALL_DATA) utils/fmgroids.h '$(DESTDIR)$(includedir_server)/utils'
    $(INSTALL_DATA) utils/fmgrprotos.h '$(DESTDIR)$(includedir_server)/utils'
 # 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; \
+# (in fact, we have to take some pains to avoid overlength shell commands here)
+   cp $(srcdir)/*.h '$(DESTDIR)$(includedir_server)'/
    for dir in $(SUBDIRS); do \
      cp $(srcdir)/$$dir/*.h '$(DESTDIR)$(includedir_server)'/$$dir/ || exit; \
-     chmod $(INSTALL_DATA_MODE) '$(DESTDIR)$(includedir_server)'/$$dir/*.h  || exit; \
    done
 ifeq ($(vpath_build),yes)
    for file in dynloader.h catalog/schemapg.h catalog/pg_*_d.h parser/gram.h storage/lwlocknames.h utils/probes.h; do \
      cp $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \
-     chmod $(INSTALL_DATA_MODE) '$(DESTDIR)$(includedir_server)'/$$file || exit; \
    done
 endif
+   cd '$(DESTDIR)$(includedir_server)' && chmod $(INSTALL_DATA_MODE) *.h
+   for dir in $(SUBDIRS); do \
+     cd '$(DESTDIR)$(includedir_server)'/$$dir || exit; \
+     chmod $(INSTALL_DATA_MODE) *.h || exit; \
+   done
 
 installdirs:
    $(MKDIR_P) '$(DESTDIR)$(includedir)/libpq' '$(DESTDIR)$(includedir_internal)/libpq'