From: Nick Bowler Date: Sat, 25 Feb 2012 01:54:45 +0000 (-0500) Subject: Fix "make dist" permissions when using a read-only srcdir. X-Git-Tag: v1~68 X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/commitdiff_plain/c58a93b9b3e42eb3668d9217a35b66d47ac47d50 Fix "make dist" permissions when using a read-only srcdir. 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. --- diff --git a/Makefile.am b/Makefile.am index 1132d5a..535eff8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -166,10 +166,19 @@ src/parse.c src/parse.h: src/parse.stamp # up-to-date timestamps, otherwise make will try to update them in a fresh # VPATH build. dist-hook: update-headers -update-headers: +update-headers: unfuck-distdir 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))