diff --git a/mk/default.mk b/mk/default.mk index 72068d18d..0e639d102 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 cab65cb8e..0ccb6eafb 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) ; \ + }