emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/emacsql d3d76ea72a 409/427: make: Use essentially same Mak


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql d3d76ea72a 409/427: make: Use essentially same Makefile as for other packages I maintain
Date: Tue, 13 Dec 2022 03:00:23 -0500 (EST)

branch: elpa/emacsql
commit d3d76ea72a80be03def8cc4570b8ff14f4197b1d
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    make: Use essentially same Makefile as for other packages I maintain
    
    I wasn't going to do that now, but then I noticed that the old
    Makefile failed to recompile an Elisp library when it was modified.
---
 Makefile | 93 +++++++++++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 65 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile
index e13a3f82bf..b1f1b4a00b 100644
--- a/Makefile
+++ b/Makefile
@@ -6,43 +6,80 @@
 # Or set LOAD_PATH to point at these packages elsewhere:
 #     $ make LOAD_PATH='-L path/to/pg'
 
-.POSIX:
-.SUFFIXES: .el .elc
-EMACS   ?= emacs
-LOAD_PATH ?= -L ../pg
-BATCH    = $(EMACS) -batch -Q -L . -L tests $(LOAD_PATH)
-
-EL = emacsql-compiler.el \
-     emacsql.el \
-     emacsql-sqlite.el \
-     emacsql-psql.el \
-     emacsql-mysql.el \
-     emacsql-pg.el
-ELC = $(EL:.el=.elc)
-TEST_EL = \
-    tests/emacsql-compiler-tests.el \
-    tests/emacsql-external-tests.el \
-    tests/emacsql-tests.el
-TEST_ELC = $(TEST_EL:.el=.elc)
-EXTRA_DIST = README.md UNLICENSE
-
-all: test
+PKG = emacsql
+
+ELS   = $(PKG)-compiler.el
+ELS  += $(PKG).el
+ELS  += $(PKG)-mysql.el
+ELS  += $(PKG)-pg.el
+ELS  += $(PKG)-psql.el
+ELS  += $(PKG)-sqlite.el
+ELCS  = $(ELS:.el=.elc)
+
+TEST_ELS  = tests/emacsql-compiler-tests.el
+TEST_ELS += tests/emacsql-external-tests.el
+TEST_ELS += tests/emacsql-tests.el
+TEST_ELCS = $(TEST_ELS:.el=.elc)
+
+DEPS  = pg
+
+EMACS      ?= emacs
+EMACS_ARGS ?=
+
+LOAD_PATH  ?= $(addprefix -L ../,$(DEPS))
+LOAD_PATH  += -L .
+
+all: binary lisp
+
+help:
+       $(info make all          - generate binary, byte-code and autoloads)
+       $(info make binary       - generate binary)
+       $(info make lisp         - generate byte-code and autoloads)
+       $(info make test         - run tests)
+       $(info make clean        - remove byte-code and autoloads)
+       $(info make distclean    - remove binary, byte-code and autoloads)
+       @printf "\n"
 
 binary: sqlite/emacsql-sqlite
 sqlite/emacsql-sqlite:
        $(MAKE) -C sqlite
 
-compile: binary $(ELC)
+lisp: $(ELCS) loaddefs check-declare
+
+loaddefs: $(PKG)-autoloads.el
+
+%.elc: %.el
+       @printf "Compiling $<\n"
+       @$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -f batch-byte-compile $<
 
-check: test
-test: compile $(TEST_ELC)
-       $(BATCH) -l tests/emacsql-tests.elc -f ert-run-tests-batch
+check-declare:
+       @printf " Checking function declarations\n"
+       @$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) \
+       --eval "(check-declare-directory default-directory)"
+
+CLEAN  = $(ELCS) $(PKG)-autoloads.el
 
 clean:
-       rm -f $(ELC) $(TEST_ELC)
+       @printf " Cleaning...\n"
+       @rm -rf $(CLEAN)
 
 distclean: clean
        $(MAKE) -C sqlite clean
 
-.el.elc:
-       $(BATCH) -f batch-byte-compile $<
+$(PKG)-autoloads.el: $(ELS)
+       @printf " Creating $@\n"
+       @$(EMACS) -Q --batch -l autoload -l cl-lib --eval "\
+(let ((file (expand-file-name \"$@\"))\
+      (autoload-timestamps nil) \
+      (backup-inhibited t)\
+      (version-control 'never)\
+      (coding-system-for-write 'utf-8-emacs-unix))\
+  (write-region (autoload-rubric file \"package\" nil) nil file nil 'silent)\
+  (cl-letf (((symbol-function 'progress-reporter-do-update) (lambda (&rest 
_)))\
+            ((symbol-function 'progress-reporter-done) (lambda (_))))\
+    (let ((generated-autoload-file file))\
+      (update-directory-autoloads default-directory))))"
+
+test: all $(TEST_ELCS)
+       @$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) \
+       -L tests -l tests/emacsql-tests.elc -f ert-run-tests-batch



reply via email to

[Prev in Thread] Current Thread [Next in Thread]