diff options
author | Andrea Richiardi <a.richiardi.work@gmail.com> | 2018-11-17 12:29:47 -0800 |
---|---|---|
committer | Bozhidar Batsov <bozhidar.batsov@gmail.com> | 2018-11-25 20:11:16 -0500 |
commit | 99f0c62b3edc3c03ef7ef3dbfb581aef0c4c6caf (patch) | |
tree | 3a032a3a9e1c9e833b65ee55ab17fd6e4ce28deb | |
parent | 6813fe93141556cc716498ecffcff33c364e3b9c (diff) |
Improve the Makefile autoload and compilation sections
Inspired by the immense magit, we now have a similar way to build the
autoloads.el file and additionally we combine both autoload and compilation
steps under the build target. With this change, manual installation and tools
like borg can just call make and have everything ready for consumption.
-rw-r--r-- | Makefile | 60 | ||||
-rw-r--r-- | doc/hacking_on_cider.md | 5 | ||||
-rw-r--r-- | doc/installation.md | 9 |
3 files changed, 52 insertions, 22 deletions
@@ -2,13 +2,15 @@ export EMACS ?= emacs EMACSFLAGS = -L . CASK = cask VERSION = $(shell git describe --tags --abbrev=0 | sed 's/^v//') -PACKAGE_NAME = cider-$(VERSION) +PKG = cider -ELS = $(wildcard *.el) -LINTELS = $(filter-out cider-autoloads.el,$(ELS)) +ELS_ALL = $(wildcard *.el) +ELS = $(filter-out $(PKG)-autoloads.el,$(ELS_ALL)) OBJECTS = $(ELS:.el=.elc) -.PHONY: elpa build version test lint clean elpaclean run-cider +.PHONY: elpa build version test lint clean elpaclean autoloads run-$(PKG) + +all: build .depend: $(ELS) @echo Compute dependencies @@ -26,7 +28,21 @@ elpa-$(EMACS): elpa: elpa-$(EMACS) -build: version elpa +autoloads: $(PKG)-autoloads.el + +$(PKG)-autoloads.el: $(ELS) + @printf "Generating $@\n" + @printf "%s" "$$LOADDEFS_TMPL" > $@ + @$(CASK) exec $(EMACS) -Q --batch -l autoload.el --eval "(progn\ + (fset 'message (lambda (&rest _)))\ + (setq make-backup-files nil)\ + (setq vc-handled-backends nil)\ + (setq default-directory (file-truename default-directory))\ + (setq generated-autoload-file (expand-file-name \"$@\"))\ + (setq find-file-visit-truename t)\ + (update-directory-autoloads default-directory))" + +build: version elpa autoloads $(CASK) build version: @@ -35,31 +51,45 @@ version: test: version build $(CASK) exec buttercup -L . -L ./test/utils/ -autoloads: - $(CASK) exec $(EMACS) -Q --batch \ - -l autoload.el \ - --eval "(let ((generated-autoload-file (expand-file-name \"cider-autoloads.el\"))) \ - (update-directory-autoloads (expand-file-name \".\")))" - lint: version elpa $(CASK) exec $(EMACS) -Q --batch \ --eval "(setq enable-local-variables :safe)" \ -l elisp-lint.el -f elisp-lint-files-batch \ --no-package-format \ --no-fill-column \ - $(LINTELS) + $(ELS) test-all: lint test clean: - rm -f .depend $(OBJECTS) cider-autoloads.el + rm -f .depend $(OBJECTS) $(PKG)-autoloads.el elpaclean: clean rm -f elpa* rm -rf .cask # Clean packages installed for development -run-cider: elpa - cask exec $(EMACS) -Q -L . --eval "(require 'cider)" +run-$(PKG): elpa + cask exec $(EMACS) -Q -L . --eval "(require '$(PKG))" html: mkdocs build + +## Templates ######################################################### + +define LOADDEFS_TMPL +;;; $(PKG)-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (directory-file-name \ +(or (file-name-directory #$$) (car load-path)))) + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; $(PKG)-autoloads.el ends here + +endef +export LOADDEFS_TMPL +#' diff --git a/doc/hacking_on_cider.md b/doc/hacking_on_cider.md index f260f519..163e699c 100644 --- a/doc/hacking_on_cider.md +++ b/doc/hacking_on_cider.md @@ -30,10 +30,11 @@ Then: ```el ;; load CIDER from its source code (add-to-list 'load-path "~/projects/cider") -(require 'cider) -(require 'cider-autoloads) +(load "cider-autoloads" t t) ``` +If you want to compile **and** generate autoloads, just run `make`. + ### Changing the code It's perfectly fine to load CIDER from `package.el` and then to start making diff --git a/doc/installation.md b/doc/installation.md index 8ebcbf47..82aa91b7 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -114,11 +114,10 @@ following command: ## Manual installation -Installing CIDER manually is discouraged unless you plan to work with -CIDER's codebase. The manual installation is relatively involved as it -requires manual installation of the dependencies and manual generation -of the package autoloads. Check out the section [Hacking on -CIDER](hacking_on_cider.md) for more details. +Installing CIDER manually is discouraged unless you plan to work with CIDER's +codebase. The manual installation is relatively involved as it requires manual +installation of the dependencies. Check out the section +[Hacking on CIDER](hacking_on_cider.md) for more details. ## CIDER's nREPL middleware |