Add cruft.mak file that can be included from modules to check for cruft
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 13 Jan 2010 00:28:03 +0000 (00:28 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 13 Jan 2010 00:36:34 +0000 (00:36 +0000)
When plugins get renamed, moved or removed we often leave behind unwanted
left-overs in our source tree, since no one runs 'make clean' before every
git update. This can cause problems and be confusing, so add a little
Makefile rule to include to print a warning for if any of the files or
directories specified in CRUFT_FILES and/or CRUFT_DIRS are still present
in our uninstalled tree.

cruft.mak [new file with mode: 0644]

diff --git a/cruft.mak b/cruft.mak
new file mode 100644 (file)
index 0000000..ca59440
--- /dev/null
+++ b/cruft.mak
@@ -0,0 +1,39 @@
+# checks for left-over files in the (usually uninstalled) tree, ie. for
+# stuff that best be deleted to avoid problems like having old plugin binaries
+# lying around.
+#
+# set CRUFT_FILES and/or CRUFT_DIRS in your Makefile.am when you include this
+
+check-cruft:
+       cruft_files=""; cruft_dirs=""; \
+       for f in $(CRUFT_FILES); do \
+         if test -e $$f; then \
+           cruft_files="$$cruft_files $$f"; \
+         fi \
+       done; \
+       for d in $(CRUFT_DIRS); do \
+         if test -e $$d; then \
+           cruft_dirs="$$cruft_dirs $$d"; \
+         fi \
+       done; \
+       if test "x$$cruft_files$$cruft_dirs" != x; then \
+         echo; \
+         echo "**** CRUFT ALERT *****"; \
+         echo; \
+         echo "The following files and directories may not be needed any "; \
+         echo "longer (usually because a plugin has been merged into     "; \
+         echo "another plugin, moved to a different module, or been      "; \
+         echo "renamed), and you probably want to clean them up if you   "; \
+         echo "don't have local changes:                                 "; \
+         echo; \
+         for f in $$cruft_files; do echo "file $$f"; done; \
+         echo; \
+         for d in $$cruft_dirs; do echo "directory $$d"; done; \
+         echo; \
+       fi
+
+
+# also might want to add this to your Makefile.am:
+#
+# all-local: check-cruft
+