Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. EMACS=emacs
  2. EMACS_CLEAN=-Q
  3. EMACS_BATCH=$(EMACS_CLEAN) --batch
  4. TESTS=
  5. CURL=curl --silent
  6. WORK_DIR=$(shell pwd)
  7. PACKAGE_NAME=$(shell basename $(WORK_DIR))
  8. AUTOLOADS_FILE=$(PACKAGE_NAME)-autoloads.el
  9. TRAVIS_FILE=.travis.yml
  10. TEST_DIR=test
  11. TEST_DEP_1=ert
  12. TEST_DEP_1_STABLE_URL=http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/emacs-lisp/ert.el?h=emacs-24.3
  13. TEST_DEP_1_LATEST_URL=http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/emacs-lisp/ert.el?h=master
  14. .PHONY : build downloads downloads-latest autoloads test-autoloads test-travis \
  15. test test-interactive clean edit test-dep-1 test-dep-2 test-dep-3 \
  16. test-dep-4 test-dep-5 test-dep-6 test-dep-7 test-dep-8 test-dep-9
  17. build :
  18. $(EMACS) $(EMACS_BATCH) --eval \
  19. "(progn \
  20. (setq byte-compile-error-on-warn t) \
  21. (batch-byte-compile))" *.el
  22. test-dep-1 :
  23. @cd $(TEST_DIR) && \
  24. $(EMACS) $(EMACS_BATCH) -L . -L .. -l $(TEST_DEP_1) || \
  25. (echo "Can't load test dependency $(TEST_DEP_1).el, run 'make downloads' to fetch it" ; exit 1)
  26. downloads :
  27. $(CURL) '$(TEST_DEP_1_STABLE_URL)' > $(TEST_DIR)/$(TEST_DEP_1).el
  28. downloads-latest :
  29. $(CURL) '$(TEST_DEP_1_LATEST_URL)' > $(TEST_DIR)/$(TEST_DEP_1).el
  30. autoloads :
  31. $(EMACS) $(EMACS_BATCH) --eval \
  32. "(progn \
  33. (setq generated-autoload-file \"$(WORK_DIR)/$(AUTOLOADS_FILE)\") \
  34. (update-directory-autoloads \"$(WORK_DIR)\"))"
  35. test-autoloads : autoloads
  36. @$(EMACS) $(EMACS_BATCH) -L . -l "./$(AUTOLOADS_FILE)" || \
  37. ( echo "failed to load autoloads: $(AUTOLOADS_FILE)" && false )
  38. test-travis :
  39. @if test -z "$$TRAVIS" && test -e $(TRAVIS_FILE); then travis-lint $(TRAVIS_FILE); fi
  40. test : build test-dep-1 test-autoloads
  41. @cd $(TEST_DIR) && \
  42. (for test_lib in *-test.el; do \
  43. $(EMACS) $(EMACS_BATCH) -L . -L .. -l cl -l $(TEST_DEP_1) -l $$test_lib --eval \
  44. "(flet ((ert--print-backtrace (&rest args) \
  45. (insert \"no backtrace in batch mode\"))) \
  46. (ert-run-tests-batch-and-exit '(and \"$(TESTS)\" (not (tag :interactive)))))" || exit 1; \
  47. done)
  48. clean :
  49. @rm -f $(AUTOLOADS_FILE) *.elc *~ */*.elc */*~
  50. @rm -f \#*\#
  51. @rm -rf .cask