postgresql/src/bin
Tom Lane 4b538727e2 Fix make rules that generate multiple output files.
For years, our makefiles have correctly observed that "there is no correct
way to write a rule that generates two files".  However, what we did is to
provide empty rules that "generate" the secondary output files from the
primary one, and that's not right either.  Depending on the details of
the creating process, the primary file might end up timestamped later than
one or more secondary files, causing subsequent make runs to consider the
secondary file(s) out of date.  That's harmless in a plain build, since
make will just re-execute the empty rule and nothing happens.  But it's
fatal in a VPATH build, since make will expect the secondary file to be
rebuilt in the build directory.  This would manifest as "file not found"
failures during VPATH builds from tarballs, if we were ever unlucky enough
to ship a tarball with apparently out-of-date secondary files.  (It's not
clear whether that has ever actually happened, but it definitely could.)

To ensure that secondary output files have timestamps >= their primary's,
change our makefile convention to be that we provide a "touch $@" action
not an empty rule.  Also, make sure that this rule actually gets invoked
during a distprep run, else the hazard remains.

It's been like this a long time, so back-patch to all supported branches.

In HEAD, I skipped the changes in src/backend/catalog/Makefile, because
those rules are due to get replaced soon in the bootstrap data format
patch, and there seems no need to create a merge issue for that patch.
If for some reason we fail to land that patch in v11, we'll need to
back-fill the changes in that one makefile from v10.

Discussion: https://postgr.es/m/18556.1521668179@sss.pgh.pa.us
2018-03-23 13:46:00 -04:00
..
initdb Fix more format truncation issues 2018-03-15 11:41:42 -04:00
pg_archivecleanup pg_archivecleanup: Add test suite 2017-09-14 22:23:00 -04:00
pg_basebackup Exclude unlogged tables from base backups 2018-03-23 19:14:12 +03:00
pg_config Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_controldata pg_controldata: Prevent division-by-zero errors 2018-03-21 12:21:23 -04:00
pg_ctl Support huge pages on Windows 2018-01-21 15:40:46 +01:00
pg_dump Fix mishandling of quoted-list GUC values in pg_dump and ruleutils.c. 2018-03-21 20:03:28 -04:00
pg_resetwal pg_resetwal: Prevent division-by-zero errors 2018-03-23 10:14:25 -04:00
pg_rewind Fix pg_rewind to handle relation data files in tablespaces properly. 2018-03-06 02:08:18 +09:00
pg_test_fsync Make WAL segment size configurable at initdb time. 2017-09-19 22:03:48 -07:00
pg_test_timing pg_test_timing: Some NLS fixes 2017-08-26 09:25:19 -04:00
pg_upgrade Empty search_path in Autovacuum and non-psql/pgbench clients. 2018-02-26 07:39:44 -08:00
pg_waldump Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgbench UINT64CONST'fy long constants in pgbench 2018-03-22 19:38:54 +03:00
pgevent Update copyright for 2018 2018-01-02 23:30:12 -05:00
psql Fix make rules that generate multiple output files. 2018-03-23 13:46:00 -04:00
scripts Empty search_path in Autovacuum and non-psql/pgbench clients. 2018-02-26 07:39:44 -08:00
Makefile Update copyright for 2018 2018-01-02 23:30:12 -05:00