summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAndrea Richiardi <a.richiardi.work@gmail.com>2018-11-17 12:29:47 -0800
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2018-11-25 20:11:16 -0500
commit99f0c62b3edc3c03ef7ef3dbfb581aef0c4c6caf (patch)
tree3a032a3a9e1c9e833b65ee55ab17fd6e4ce28deb /Makefile
parent6813fe93141556cc716498ecffcff33c364e3b9c (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.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile60
1 files changed, 45 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 507103d6..401239b6 100644
--- a/Makefile
+++ b/Makefile
@@ -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
+#'