+.PHONY: check-chktex
+CHKTEX = chktex --localrc .chktexrc --quiet --inputfiles=0
+check-chktex:
+ @[ -z "$(shell $(CHKTEX) mjotex.sty)" ]
+
+# Ensure that there are no undefined references in the document by
+# parsing the log file for said warnings.
+.PHONY: check-undefined
+check-undefined: $(PN).log
+ @! grep -i 'undefined' $<
+
+# Use sage to doctest any \sagelisting{}s in SAGE_LISTING_DSTS.
+# The actuall command is ifdef'd so that we can comment out
+# the definition of SAGE_LISTING_DSTS without breaking the
+# default definition of the "check" target.
+.PHONY: check-sage
+check-sage: $(SAGE_LISTING_DSTS)
+ifdef SAGE_LISTING_DSTS
+ PYTHONPATH="$(HOME)/src/sage.d" \
+ sage -t --timeout=0 --memlimit=0 \
+ $^
+endif
+
+# Run a suite of checks.