]> git.draconx.ca Git - cdecl99.git/commitdiff
Fix "make dist" permissions when using a read-only srcdir.
authorNick Bowler <nbowler@draconx.ca>
Sat, 25 Feb 2012 01:54:45 +0000 (20:54 -0500)
committerNick Bowler <nbowler@draconx.ca>
Thu, 1 Mar 2012 01:16:58 +0000 (20:16 -0500)
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.

Makefile.am

index 1132d5af5b2c5d7ff72a6624760af2b580f31549..535eff8630ef1f5ecc4c8a12313b1a3bb0a686d4 100644 (file)
@@ -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))