summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchim Gratz <Stromeko@Stromeko.DE>2016-02-14 12:44:56 +0100
committerAchim Gratz <Stromeko@Stromeko.DE>2016-02-14 12:44:56 +0100
commitbb3dca06a5308cba894a647d814952fb336c0902 (patch)
treef8650826a8a086eb08278c3d40ea6879241854cc
parenta4cfd3343a83b5b8cd2dfe5ac83b8f9a02b837a7 (diff)
downloadorg-mode-bb3dca06a5308cba894a647d814952fb336c0902.tar.gz
Makefile: provide CHMOD customization, use it for cleantest
* mk/default.mk (CHMOD): Addtional customization variable for chmod (change file permissions). Explain why we need it for git-annex. * mk/targets.mk (cleantest): If the plain $(RMR) fails, try to make directories writable recursively and retry the $(RMR). (cleanall, $(CLEANDIRS:%=clean%)): Use "+" instead of ";" to reduce the number of execs.
-rw-r--r--mk/default.mk4
-rw-r--r--mk/targets.mk18
2 files changed, 15 insertions, 7 deletions
diff --git a/mk/default.mk b/mk/default.mk
index 72068d1..0e639d1 100644
--- a/mk/default.mk
+++ b/mk/default.mk
@@ -150,6 +150,10 @@ RM = rm -f
# How to remove files recursively
RMR = rm -fr
+# How to change file permissions
+# currently only needed for git-annex due to its "lockdown" feature
+CHMOD = chmod
+
# How to copy the lisp files and elc files to their destination.
# CP = cp -p # try this if you have no install
CP = install -m 644 -p
diff --git a/mk/targets.mk b/mk/targets.mk
index cab65cb..0ccb6ea 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -37,7 +37,7 @@ endif
CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
CONF_DEST = lispdir infodir datadir testdir
CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA BTEST_RE
-CONF_EXEC = CP MKDIR RM RMR FIND SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
+CONF_EXEC = CP MKDIR RM RMR FIND CHMOD SUDO PDFTEX TEXI2PDF TEXI2HTML MAKEINFO INSTALL_INFO
CONF_CALL = BATCH BATCHL ELC ELCDIR NOBATCH BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
config-eol:: EOL = \#
config-eol:: config-all
@@ -137,11 +137,11 @@ cleandirs:
clean: cleanlisp cleandoc
cleanall: cleandirs cleantest cleanaddcontrib
- -$(FIND) . \( -name \*~ -o -name \*# -o -name .#\* \) -exec $(RM) {} \;
- -$(FIND) $(CLEANDIRS) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
+ -$(FIND) . \( -name \*~ -o -name \*# -o -name .#\* \) -exec $(RM) {} +
+ -$(FIND) $(CLEANDIRS) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} +
$(CLEANDIRS:%=clean%):
- -$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
+ -$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} +
cleanelc:
$(MAKE) -C lisp $@
@@ -158,6 +158,10 @@ cleandocs:
-$(FIND) doc -name \*~ -exec $(RM) {} \;
cleantest:
-# git annex makes files 444, change to user writable so we can delete them
- if [ -d $(testdir) ] ; then chmod u+w -R $(testdir) ; fi
- $(RMR) $(testdir)
+# git-annex creates non-writable directories so that the files within
+# them can't be removed; if rm fails, try to recover by making all
+# directories writable
+ -$(RMR) $(testdir) || { \
+ $(FIND) $(testdir) -type d -exec $(CHMOD) u+w {} + && \
+ $(RMR) $(testdir) ; \
+ }