Apparently Automake copies permissions from the source directory, so
if you run "make dist" in a VPATH build from a read-only srcdir, the
resulting distdir will be read-only. Beyond the resulting tarball
permissions, this can actually cause dist hooks to fail in some
instances.
Add another dist hook which makes distdir user-writable.
# up-to-date timestamps, otherwise make will try to update them in a fresh
# VPATH build.
dist-hook: update-headers
# up-to-date timestamps, otherwise make will try to update them in a fresh
# VPATH build.
dist-hook: update-headers
+update-headers: unfuck-distdir
touch -c '$(distdir)/src/scan.h'
touch -c '$(distdir)/src/parse.h'
touch -c '$(distdir)/src/scan.h'
touch -c '$(distdir)/src/parse.h'
+# When running "make dist" in a VPATH build with a read-only srcdir, Automake
+# will produce a distribution with all files read-only. Moreover, the files
+# are read-only in distdir when the dist hooks are run. This hook will
+# manually fix up the permissions. All dist hooks that modify files in distdir
+# should list unfuck-distdir as a prerequisite.
+dist-hook: unfuck-distdir
+unfuck-distdir:
+ find '$(distdir)' -type f -exec chmod u+w {} +
+
# Supporting rules for bison/flex.
BISON_V = $(BISON_V_$(V))
# Supporting rules for bison/flex.
BISON_V = $(BISON_V_$(V))