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.
This commit is contained in:
parent
a4cfd3343a
commit
bb3dca06a5
|
@ -150,6 +150,10 @@ RM = rm -f
|
||||||
# How to remove files recursively
|
# How to remove files recursively
|
||||||
RMR = rm -fr
|
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.
|
# How to copy the lisp files and elc files to their destination.
|
||||||
# CP = cp -p # try this if you have no install
|
# CP = cp -p # try this if you have no install
|
||||||
CP = install -m 644 -p
|
CP = install -m 644 -p
|
||||||
|
|
|
@ -37,7 +37,7 @@ endif
|
||||||
CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
|
CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
|
||||||
CONF_DEST = lispdir infodir datadir testdir
|
CONF_DEST = lispdir infodir datadir testdir
|
||||||
CONF_TEST = BTEST_PRE BTEST_POST BTEST_OB_LANGUAGES BTEST_EXTRA BTEST_RE
|
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
|
CONF_CALL = BATCH BATCHL ELC ELCDIR NOBATCH BTEST MAKE_LOCAL_MK MAKE_ORG_INSTALL MAKE_ORG_VERSION
|
||||||
config-eol:: EOL = \#
|
config-eol:: EOL = \#
|
||||||
config-eol:: config-all
|
config-eol:: config-all
|
||||||
|
@ -137,11 +137,11 @@ cleandirs:
|
||||||
clean: cleanlisp cleandoc
|
clean: cleanlisp cleandoc
|
||||||
|
|
||||||
cleanall: cleandirs cleantest cleanaddcontrib
|
cleanall: cleandirs cleantest cleanaddcontrib
|
||||||
-$(FIND) . \( -name \*~ -o -name \*# -o -name .#\* \) -exec $(RM) {} \;
|
-$(FIND) . \( -name \*~ -o -name \*# -o -name .#\* \) -exec $(RM) {} +
|
||||||
-$(FIND) $(CLEANDIRS) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
|
-$(FIND) $(CLEANDIRS) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} +
|
||||||
|
|
||||||
$(CLEANDIRS:%=clean%):
|
$(CLEANDIRS:%=clean%):
|
||||||
-$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} \;
|
-$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} +
|
||||||
|
|
||||||
cleanelc:
|
cleanelc:
|
||||||
$(MAKE) -C lisp $@
|
$(MAKE) -C lisp $@
|
||||||
|
@ -158,6 +158,10 @@ cleandocs:
|
||||||
-$(FIND) doc -name \*~ -exec $(RM) {} \;
|
-$(FIND) doc -name \*~ -exec $(RM) {} \;
|
||||||
|
|
||||||
cleantest:
|
cleantest:
|
||||||
# git annex makes files 444, change to user writable so we can delete them
|
# git-annex creates non-writable directories so that the files within
|
||||||
if [ -d $(testdir) ] ; then chmod u+w -R $(testdir) ; fi
|
# them can't be removed; if rm fails, try to recover by making all
|
||||||
$(RMR) $(testdir)
|
# directories writable
|
||||||
|
-$(RMR) $(testdir) || { \
|
||||||
|
$(FIND) $(testdir) -type d -exec $(CHMOD) u+w {} + && \
|
||||||
|
$(RMR) $(testdir) ; \
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue