--- /dev/null
+include $(top_srcdir)/common.mk
+
+PHONY=check test all check-elget test-elget help
+
+all: check
+
+#: same thing as "check"
+test: check
+
+#: overall help on running the make targets
+help:
+ @echo "The main function of this Makefile is to facilitate running tests."
+ @echo
+ @echo "To run all of the tests, use targets \"test\", \"check\" or \"check-short\"."
+ @echo "For example:"
+ @echo
+ @echo " make check"
+ @echo "or:"
+ @echo " make check-short"
+ @echo
+ @echo "The -short target uses a filter written in Ruby to remove extreanous output."
+ @echo
+ @echo "To run a specific test like test-srcbuf.el, change \".el\" to"
+ @echo "\".run\". For example:"
+ @echo
+ @echo " make test-srcbuf.run"
+ @echo
+ @echo "Tests can also be run via the Emacs el-get package and this loads dependent emacs "
+ @echo "package, like load-relative. To do this, use targets, \"check-elget\","
+ @echo "\"test-elget\", or \"check-short-elget\"."
+ @echo
+ @echo "To run a specific test like test-srcbuf.el via el-get change \".el\""
+ @echo "to \".elrun\" For example:"
+ @echo
+ @echo " make test-srcbuf.elrun"
+
+EXTRA_DIST=sample.txt
+
+#: same thing as "check-elget"
+test-elget: check-elget
+
+test_files := $(wildcard test-*.el)
+
+CHECK_FILES = $(notdir $(test_files:.el=.run))
+EL_GET_CHECK_FILES = $(notdir $(test_files:.el=.elrun))
+
+#: Run all tests
+check: $(CHECK_FILES)
+
+#: Run all tests via el-get
+check-elget:
+ (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash --load ./install-pkgs.el --load test-basic.el)
+
+#: Run all tests with minimum verbosity
+check-short:
+ $(MAKE) check 2>&1 | ruby ../make-check-filter.rb
+
+#: Run all tests with minimum verbosity via el-get
+check-short-elget:
+ $(MAKE) check-elget 2>&1 | ruby ./make-check-filter.rb
+
+test-%.run:
+ (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash --load $(@:.run=.el))
+
+#: Run tests using el-get to specify external Lisp dependencies
+test-%.elrun:
+ (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash --load ../el-get-install.el --load $(@:.elrun=.el))
+
+# Whatever it is you want to do, it should be forwarded to the
+# to top-level directories
+# %:
+# $(MAKE) -C .. $@