+# ==================== Cleaning up and miscellanea ====================
+
+.PHONY: mostlyclean clean distclean maintainer-clean extraclean
+
+### `mostlyclean'
+### Like `clean', but may refrain from deleting a few files that people
+### normally don't want to recompile. For example, the `mostlyclean'
+### target for GCC does not delete `libgcc.a', because recompiling it
+### is rarely necessary and takes a lot of time.
+mostlyclean: FRC
+ (cd src; $(MAKE) $(MFLAGS) mostlyclean)
+ (cd oldXMenu; $(MAKE) $(MFLAGS) mostlyclean)
+ (cd lwlib; $(MAKE) $(MFLAGS) mostlyclean)
+ (cd lib-src; $(MAKE) $(MFLAGS) mostlyclean)
+ -(cd man && $(MAKE) $(MFLAGS) mostlyclean)
+ (cd leim; $(MAKE) $(MFLAGS) mostlyclean)
+
+### `clean'
+### Delete all files from the current directory that are normally
+### created by building the program. Don't delete the files that
+### record the configuration. Also preserve files that could be made
+### by building, but normally aren't because the distribution comes
+### with them.
+###
+### Delete `.dvi' files here if they are not part of the distribution.
+clean: FRC
+ (cd src; $(MAKE) $(MFLAGS) clean)
+ (cd oldXMenu; $(MAKE) $(MFLAGS) clean)
+ (cd lwlib; $(MAKE) $(MFLAGS) clean)
+ (cd lib-src; $(MAKE) $(MFLAGS) clean)
+ -(cd man && $(MAKE) $(MFLAGS) clean)
+ (cd leim; $(MAKE) $(MFLAGS) clean)
+
+### `distclean'
+### Delete all files from the current directory that are created by
+### configuring or building the program. If you have unpacked the
+### source and built the program without creating any other files,
+### `make distclean' should leave only the files that were in the
+### distribution.
+top_distclean=\
+ rm -f config.status config.cache config.log ; \
+ rm -f Makefile ${SUBDIR_MAKEFILES} ; \
+ if [ -d lock ] ; then (cd lock && (rm -f * || true)); else true; fi
+distclean: FRC
+ (cd src; $(MAKE) $(MFLAGS) distclean)
+ (cd oldXMenu; $(MAKE) $(MFLAGS) distclean)
+ (cd lwlib; $(MAKE) $(MFLAGS) distclean)
+ (cd lib-src; $(MAKE) $(MFLAGS) distclean)
+ (cd man && $(MAKE) $(MFLAGS) distclean)
+ (cd leim; $(MAKE) $(MFLAGS) distclean)
+ ${top_distclean}
+
+### `maintainer-clean'
+### Delete everything from the current directory that can be
+### reconstructed with this Makefile. This typically includes
+### everything deleted by distclean, plus more: C source files
+### produced by Bison, tags tables, info files, and so on.
+###
+### One exception, however: `make maintainer-clean' should not delete
+### `configure' even if `configure' can be remade using a rule in the
+### Makefile. More generally, `make maintainer-clean' should not delete
+### anything that needs to exist in order to run `configure' and then
+### begin to build the program.
+maintainer-clean: FRC
+ (cd src; $(MAKE) $(MFLAGS) maintainer-clean)
+ (cd oldXMenu; $(MAKE) $(MFLAGS) maintainer-clean)
+ (cd lwlib; $(MAKE) $(MFLAGS) maintainer-clean)
+ (cd lib-src; $(MAKE) $(MFLAGS) maintainer-clean)
+ -(cd man && $(MAKE) $(MFLAGS) maintainer-clean)
+ (cd leim; $(MAKE) $(MFLAGS) maintainer-clean)
+ ${top_distclean}
+
+### This doesn't actually appear in the coding standards, but Karl
+### says GCC supports it, and that's where the configuration part of
+### the coding standards seem to come from. It's like distclean, but
+### it deletes backup and autosave files too.
+extraclean:
+ for i in ${SUBDIR}; do (cd $$i; $(MAKE) $(MFLAGS) extraclean); done
+ ${top_distclean}
+ -rm config-tmp-*
+ -rm -f *~ \#*
+
+### Unlocking and relocking. The idea of these productions is to reduce
+### hassles when installing an incremental tar of Emacs. Do `make unlock'
+### before unlocking the file to take the write locks off all sources so
+### that tar xvof will overwrite them without fuss. Then do `make relock'
+### afterward so that VC mode will know which files should be checked in
+### if you want to mung them.
+###
+### Note: it's no disaster if these productions miss a file or two; tar
+### and VC will swiftly let you know if this happens, and it is easily
+### corrected.
+SOURCES = ChangeLog GETTING.GNU.SOFTWARE INSTALL Makefile.in \
+ README configure make-dist move-if-change
+
+.PHONY: unlock relock
+
+unlock:
+ chmod u+w $(SOURCES)
+ -(cd elisp; chmod u+w Makefile README *.texi)
+ (cd etc; $(MAKE) $(MFLAGS) unlock)
+ (cd lib-src; $(MAKE) $(MFLAGS) unlock)
+ (cd lisp; $(MAKE) $(MFLAGS) unlock)
+ (cd lisp/term; chmod u+w README *.el)
+ (cd man; chmod u+w *texi* ChangeLog split-man)
+ (cd oldXMenu; chmod u+w *.[ch] Makefile README)
+ (cd lwlib; chmod u+w *.[ch] Makefile README)
+ (cd src; $(MAKE) $(MFLAGS) unlock)
+
+relock:
+ chmod u-w $(SOURCES)
+ -(cd elisp; chmod u-w Makefile README *.texi)
+ (cd etc; $(MAKE) $(MFLAGS) relock)
+ (cd lib-src; $(MAKE) $(MFLAGS) relock)
+ (cd lisp; $(MAKE) $(MFLAGS) relock)
+ (cd lisp/term; chmod u+w README *.el)
+ (cd man; chmod u+w *texi* ChangeLog split-man)
+ (cd oldXMenu; chmod u+w *.[ch] Makefile README)
+ (cd lwlib; chmod u+w *.[ch] Makefile README)
+ (cd src; $(MAKE) $(MFLAGS) relock)
+
+TAGS tags: lib-src src
+ # The src subdir knows how to do the right thing
+ # even when the build directory and source dir are different.
+ cd src; $(MAKE) tags