Debian Codegraph @

Makefile

raw
1 # Makefile for Dash.
2
3 # Copyright (C) 2021-2025 Free Software Foundation, Inc.
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18 # Variables.
19
20 EMACS ?= emacs
21 batch := $(EMACS) -Q -batch -L .
22 els := dash.el dev/dash-defs.el dev/examples.el
23 elcs := $(addsuffix c,$(els))
24 docs := README.md dash.texi
25 tmpls := readme-template.md dash-template.texi $(wildcard doc/*.texi)
26
27 # Targets.
28
29 lisp: $(elcs)
30 .PHONY: lisp
31
32 docs: $(docs)
33 .PHONY: docs
34
35 force-docs: maintainer-clean docs
36 .PHONY: force-docs
37
38 # ERT_SELECTOR is a Lisp expression determining which tests to run.
39 # Its format is described in (info "(ert) Test Selectors"). It
40 # defaults to selecting all tests. Note that in batch mode, a nil
41 # selector is the same as t.
42 check: ERT_SELECTOR ?= t
43 check: run := '(ert-run-tests-batch-and-exit (quote $(ERT_SELECTOR)))'
44 check: lisp
45 EMACS_TEST_VERBOSE=1 $(batch) -l dev/examples -eval $(run)
46 .PHONY: check
47
48 all: lisp docs check
49 .PHONY: all
50
51 force-all: maintainer-clean lisp docs check
52 .PHONY: force-all
53
54 clean:
55 $(RM) $(elcs)
56 .PHONY: clean
57
58 maintainer-clean: ver := 26
59 maintainer-clean: msg := Doc regeneration requires $(ver)+
60 maintainer-clean: clean
61 $(batch) -eval '(if (< emacs-major-version $(ver)) (error "$(msg)"))'
62 $(RM) $(docs)
63 .PHONY: maintainer-clean
64
65 # Files.
66
67 %.elc: WERROR := '(setq byte-compile-error-on-warn t)'
68 %.elc: %.el
69 $(batch) -eval $(WERROR) -f batch-byte-compile $<
70
71 $(docs) &: $(elcs) $(tmpls)
72 $(batch) -l dev/examples -f dash-make-docs
73
74 dev/dash-defs.elc: dash.elc
75 dev/examples.elc: dash.elc dev/dash-defs.elc