build: make each generated script unwritable
authorJim Meyering <meyering@fb.com>
Wed, 15 Nov 2017 16:49:01 +0000 (08:49 -0800)
committerJim Meyering <meyering@fb.com>
Thu, 16 Nov 2017 05:30:13 +0000 (21:30 -0800)
* Makefile.am (.in): Ensure that each generated script is unwritable.
This makes it less likely that someone (even me) will mistakenly
modify one of those generated files.

Makefile.am

index 6e5bb0fb3f0d8466a414b20bfb8e124cc2c81ce3..f3428088342e91247c75d70b68bcf9e561023750 100644 (file)
@@ -80,12 +80,13 @@ gzip.doc.gz: gzip.doc $(bin_PROGRAMS)
 
 SUFFIXES = .in
 .in:
-       $(AM_V_GEN)sed \
+       $(AM_V_GEN)rm -f $@-t $@ \
+          && sed \
                -e 's|/bin/sh|$(SHELL)|g' \
                -e 's|[@]GREP@|$(GREP)|g' \
                -e 's|[@]VERSION@|$(VERSION)|g' \
                $(srcdir)/$@.in >$@-t \
-         && chmod a+x $@-t \
+         && chmod a=rx $@-t \
          && mv $@-t $@
 
 # Arrange so that .tarball-version appears only in the distribution